Skip to content
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

Merged
merged 4 commits into from Aug 8, 2022

Conversation

kazzmir
Copy link
Contributor

@kazzmir kazzmir commented Jul 27, 2022

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 invokes c.ReloadConfig() when the reload command is given in ssh.

Previous behavior on windows:

user@nebula > reload
not supported by 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 for reload could write a message back to the client just before calling c.ReloadConfig()

Resolves #694

@CLAassistant
Copy link

CLAassistant commented Jul 27, 2022

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

ssh.go Outdated
return w.WriteLine("HUP sent")
func sshReload(c *config.C, w sshd.StringWriter) error {
c.ReloadConfig()
return w.WriteLine("Config reloaded")
Copy link
Collaborator

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"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wadey wadey added this to the v1.7.0 milestone Jul 27, 2022
@nbrownus nbrownus merged commit c2259f1 into slackhq:master Aug 8, 2022
@johnmaguire
Copy link
Collaborator

@kazzmir Thanks for this!

@kazzmir kazzmir deleted the ssh-reload-config branch August 8, 2022 18:23
@wadey wadey modified the milestones: v1.7.0, v1.6.1 Sep 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

windows: expose some method to reload config at runtime
5 participants