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

Add DefaultServerConfigCallback option for create custom default ServerConfigs #95

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

binwiederhier
Copy link
Contributor

This callback allows a more granular control of the SSH server configuration, such as for the key exchange / cipher / MAC algorithms.

Example usage:

server := ssh.Server{
  Addr: ":2222",
  // ...
  DefaultServerConfigCallback: func (ctx ssh.Context) *gossh.ServerConfig {
    config := &gossh.ServerConfig{}

    config.KeyExchanges = []string{"curve25519-sha256@libssh.org"}
    config.MACs = []string{"hmac-sha2-256-etm@openssh.com"}
    config.Ciphers = []string{
      "aes128-gcm@openssh.com",
      "ssh-ed25519",
      "ssh-rsa",
    }

    return config
  },
}

server.ListenAndServe()

@progrium
Copy link
Contributor

LGTM

@belak
Copy link
Collaborator

belak commented Feb 21, 2019

Huh, interesting. I like this approach. This would also replace #86

@belak
Copy link
Collaborator

belak commented Feb 21, 2019

Alternatively, this could be done by adding a config hook which would take a context and the ServerConfig and allow the user to modify it before actually using it.

@binwiederhier
Copy link
Contributor Author

I didn't see that #86 existed. Whatever you guys think is best. :-)

@progrium
Copy link
Contributor

I like callbacks. Eventually will clean up the API into single delegate that can implement various interfaces. We/somebody can change this to pass in a default config later.

@binwiederhier
Copy link
Contributor Author

Awesome. You guys are super quick. How long does it usually take to get things merged / into a tag?

@progrium
Copy link
Contributor

I'd have merged already if @belak explicitly gave thumbs up. Tagging is done by request right now.

@belak
Copy link
Collaborator

belak commented Feb 21, 2019

As long as we understand that the API may change later, I'm fine with this in its current form. It looks good to me!

@progrium
Copy link
Contributor

Pre-1.0 the API will be changing a lot

@belak
Copy link
Collaborator

belak commented Feb 21, 2019

Then I'm good with this. 👍 from me!

@progrium progrium merged commit 4b72c66 into gliderlabs:master Feb 21, 2019
@binwiederhier
Copy link
Contributor Author

Awesome thanks guys. Thank was so quick!
Can I get a tag too? ❤️

@belak
Copy link
Collaborator

belak commented Feb 21, 2019

Tagged as v0.1.3. Thanks for contributing!

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.

3 participants