Skip to content

Commit 57d7d70

Browse files
committed
[supervisor] always allow gitpod user ssh
1 parent e21e02a commit 57d7d70

File tree

1 file changed

+2
-24
lines changed
  • components/supervisor/pkg/supervisor

1 file changed

+2
-24
lines changed

components/supervisor/pkg/supervisor/ssh.go

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ func (s *sshServer) handleConn(ctx context.Context, conn net.Conn) {
104104
args = append(args,
105105
"-ieD", "-f/dev/null",
106106
"-oProtocol 2",
107+
"-oAllowUsers root gitpod",
107108
"-oPasswordAuthentication no",
108109
"-oChallengeResponseAuthentication no",
109110
"-oPermitRootLogin yes",
@@ -158,6 +159,7 @@ func (s *sshServer) handleConn(ctx context.Context, conn net.Conn) {
158159

159160
log.WithField("args", args).Debug("sshd flags")
160161
cmd := exec.CommandContext(ctx, openssh, args...)
162+
cmd = runAsGitpodUser(cmd)
161163
cmd.Env = s.envvars
162164
cmd.ExtraFiles = []*os.File{socketFD}
163165
cmd.Stderr = os.Stderr
@@ -252,30 +254,6 @@ func ensureSSHDir(cfg *Config) error {
252254
return nil
253255
}
254256

255-
func ensurePrivsepDir() error {
256-
// Privilege separation, or privsep, is method in OpenSSH by which
257-
// operations that require root privilege are performed by a separate
258-
// privileged monitor process.
259-
// see detail: https://github.com/openssh/openssh-portable/blob/master/README.privsep
260-
privsepPath := "/var/empty"
261-
err := os.MkdirAll(privsepPath, 0o755)
262-
if err != nil {
263-
return xerrors.Errorf("cannot create privsep path: %w", err)
264-
}
265-
return nil
266-
}
267-
268-
func ensureSSHCAFile(cfg *Config, caPath string) error {
269-
if cfg.SSHGatewayCAPublicKey == "" {
270-
return nil
271-
}
272-
err := os.WriteFile(caPath, []byte(cfg.SSHGatewayCAPublicKey), 0o644)
273-
if err != nil {
274-
return xerrors.Errorf("cannot write ssh ca pem: %w", err)
275-
}
276-
return nil
277-
}
278-
279257
func configureSSHDefaultDir(cfg *Config) {
280258
if cfg.RepoRoot == "" {
281259
log.Error("cannot configure ssh default dir with empty repo root")

0 commit comments

Comments
 (0)