17119: Merge branch 'master' into 17119-add-filter-groups
[arvados.git] / lib / crunchrun / container_gateway.go
index 1116c4bb1285d11ae39b4e194f21df6fd01c5d24..1a87b8c4f71d1db95b62dc6c572107f9e1e815d8 100644 (file)
@@ -40,18 +40,17 @@ type Gateway struct {
        respondAuth string
 }
 
-// startGatewayServer starts an http server that allows authenticated
-// clients to open an interactive "docker exec" session and (in
-// future) connect to tcp ports inside the docker container.
+// Start starts an http server that allows authenticated clients to open an
+// interactive "docker exec" session and (in future) connect to tcp ports
+// inside the docker container.
 func (gw *Gateway) Start() error {
        gw.sshConfig = ssh.ServerConfig{
                NoClientAuth: true,
                PasswordCallback: func(c ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error) {
                        if c.User() == "_" {
                                return nil, nil
-                       } else {
-                               return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                        }
+                       return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                },
                PublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
                        if c.User() == "_" {
@@ -60,9 +59,8 @@ func (gw *Gateway) Start() error {
                                                "pubkey-fp": ssh.FingerprintSHA256(pubKey),
                                        },
                                }, nil
-                       } else {
-                               return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                        }
+                       return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                },
        }
        pvt, err := rsa.GenerateKey(rand.Reader, 2048)