tempfork: temporarily fork gliderlabs/ssh and x/crypto/ssh
While we rearrange/upstream things. gliderlabs/ssh is forked into tempfork from our prior fork at https://github.com/tailscale/ssh/commit/be8b7add4057ef5a8e458b42331a7633c06d026a x/crypto/ssh OTOH is forked at https://github.com/tailscale/golang-x-crypto because it was gnarlier to vendor with various internal packages, etc. Its git history shows where it starts (2c7772ba30643b7a2026cbea938420dce7c6384d). Updates #3802 Change-Id: I546e5cdf831cfc030a6c42557c0ad2c58766c65f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
6fecc16c3b
commit
5a44f9f5b5
@@ -0,0 +1,40 @@
|
||||
package ssh_test
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"tailscale.com/tempfork/gliderlabs/ssh"
|
||||
)
|
||||
|
||||
func ExampleListenAndServe() {
|
||||
ssh.ListenAndServe(":2222", func(s ssh.Session) {
|
||||
io.WriteString(s, "Hello world\n")
|
||||
})
|
||||
}
|
||||
|
||||
func ExamplePasswordAuth() {
|
||||
ssh.ListenAndServe(":2222", nil,
|
||||
ssh.PasswordAuth(func(ctx ssh.Context, pass string) bool {
|
||||
return pass == "secret"
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
func ExampleNoPty() {
|
||||
ssh.ListenAndServe(":2222", nil, ssh.NoPty())
|
||||
}
|
||||
|
||||
func ExamplePublicKeyAuth() {
|
||||
ssh.ListenAndServe(":2222", nil,
|
||||
ssh.PublicKeyAuth(func(ctx ssh.Context, key ssh.PublicKey) bool {
|
||||
data, _ := ioutil.ReadFile("/path/to/allowed/key.pub")
|
||||
allowed, _, _, _, _ := ssh.ParseAuthorizedKey(data)
|
||||
return ssh.KeysEqual(key, allowed)
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
func ExampleHostKeyFile() {
|
||||
ssh.ListenAndServe(":2222", nil, ssh.HostKeyFile("/path/to/host/key"))
|
||||
}
|
||||
Reference in New Issue
Block a user