Skip to content

Add DefaultServerConfigCallback option for create custom default ServerConfigs#95

Merged
progrium merged 1 commit into
gliderlabs:masterfrom
binwiederhier:serverconfig-callback
Feb 21, 2019
Merged

Add DefaultServerConfigCallback option for create custom default ServerConfigs#95
progrium merged 1 commit into
gliderlabs:masterfrom
binwiederhier:serverconfig-callback

Conversation

@binwiederhier

Copy link
Copy Markdown
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
Copy Markdown
Contributor

LGTM

@belak

belak commented Feb 21, 2019

Copy link
Copy Markdown
Collaborator

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

@belak

belak commented Feb 21, 2019

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor Author

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

@progrium

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

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

@progrium

Copy link
Copy Markdown
Contributor

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

@belak

belak commented Feb 21, 2019

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Contributor

Pre-1.0 the API will be changing a lot

@belak

belak commented Feb 21, 2019

Copy link
Copy Markdown
Collaborator

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

@progrium progrium merged commit 4b72c66 into gliderlabs:master Feb 21, 2019
@binwiederhier

Copy link
Copy Markdown
Contributor Author

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

@belak

belak commented Feb 21, 2019

Copy link
Copy Markdown
Collaborator

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