gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
16.97k stars 1.71k forks source link

join openssh failing with Ubuntu 24.04 #42227

Open stevenGravy opened 1 month ago

stevenGravy commented 1 month ago

Expected behavior:

The teleport join openssh would work in Ubuntu 24.04 as with Ubuntu 22.04

Current behavior:

Attempting to run teleport join openssh results in this error. This was on the default Ubuntu 24.04 in Amazon with a Arm 4g.nano.

 $ sudo ./teleport join openssh   --address host:22   --proxy-server teleport.example.com:443   --join-method token   --token abc123   --labels env=dev
2024-05-31T11:59:19Z ERRO [PROC:1]    Critical service has exited with error, aborting. pid:1221.1 service:openssh.rotate error:[
ERROR REPORT:
Original Error: *exec.ExitError exit status 5
Stack Trace:
    github.com/gravitational/teleport/lib/openssh/sshd.go:207 github.com/gravitational/teleport/lib/openssh.(*sshdBackend).restart
    github.com/gravitational/teleport/lib/openssh/sshd.go:143 github.com/gravitational/teleport/lib/openssh.(*SSHD).UpdateConfig
    github.com/gravitational/teleport/lib/service/connect.go:568 github.com/gravitational/teleport/lib/service.(*TeleportProcess).syncOpenSSHRotationState
    github.com/gravitational/teleport/lib/service/supervisor.go:587 github.com/gravitational/teleport/lib/service.(*LocalService).Serve
    github.com/gravitational/teleport/lib/service/supervisor.go:312 github.com/gravitational/teleport/lib/service.(*LocalSupervisor).serve.func1
    runtime/asm_arm64.s:1197 runtime.goexit
User Message: failed to restart the sshd service
    exit status 5] service/signals.go:177
ERROR: failed to restart the sshd service
    exit status 5

Bug details:

stevenGravy commented 1 month ago

The issue appears to be that there is no longer a sshd service but rather just a ssh service.

rosstimothy commented 1 month ago

teleport join openssh defaults to using systemctl restart sshd as the restart command but this can be supplied manually by users via: teleport join openssh --restart-sshd=systemctl restart ssh

stevenGravy commented 1 month ago

thanks @rosstimothy , let me see about putting that in docs. Do you think this is common enough it whou

teleport join openssh defaults to using systemctl restart sshd as the restart command but this can be supplied manually by users via: teleport join openssh --restart-sshd=systemctl restart ssh

thanks @rosstimothy , let me see about putting that in docs. Do you think this is common enough it should be part of the regular flow to check what is your service?

Tener commented 1 month ago

Another option is to see which units are available and restart either ssh.service or sshd.service. We can get the available units using systemctl list-units --type=service --all --output=json.