Bind sshd, dns and stats listeners in the reload so a bind failure fails it

This commit is contained in:
Nate Brown committed 2026-10-19 09:57:21 -05:00
1 parent 8a4bd8b10f
commit 357b129749
7 files changed
+184 -51

No files matched your search

+9 -4
View File
@@ -30,15 +30,20 @@ func wireSSHReload(l *slog.Logger, ssh *sshd.SSHServer, c *config.C) {
}
return
}
sshRun, err := configSSH(l, ssh, c, r)
if err != nil {
if _, err := configSSH(l, ssh, c, r); err != nil {
l.Error("Failed to reconfigure the sshd", "error", err)
ssh.Stop()
r.Failed()
return
}
if sshRun != nil {
go sshRun()
// Bind here rather than in the background, so a reload that can't listen says so
listener, err := ssh.Listen(c.GetString("sshd.listen", ""))
if err != nil {
l.Error("Failed to run the SSH server", "error", err)
r.Failed()
return
}
go ssh.Serve(listener)
} else {
ssh.Stop()
}