New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
explicitly reload config from ssh command #725
Conversation
|
ssh.go
Outdated
return w.WriteLine("HUP sent") | ||
func sshReload(c *config.C, w sshd.StringWriter) error { | ||
c.ReloadConfig() | ||
return w.WriteLine("Config reloaded") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the PR description, IIUC this will never be seen because c.ReloadConfig()
is a blocking call that restarts the SSH server.
Even if we change that line to go c.ReloadConfig()
we'll be racing it. I agree then that this message should be sent prior to c.ReloadConfig()
, e.g. "Reloading config"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kazzmir Thanks for this! |
The
reload
command sends SIGHUP to the process to let it reload the config, but SIGHUP is not implemented in windows. Rather than indirectly reloading via SIGHUP, this PR explicitly invokesc.ReloadConfig()
when thereload
command is given in ssh.Previous behavior on windows:
The new behavior immediately closes the ssh connection once
reload
is given because the sshd server closes, so the user never sees a message, which is probably ok but the ssh handler forreload
could write a message back to the client just before callingc.ReloadConfig()
Resolves #694