mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-06 21:04:39 +02:00
test that upstream banner is sent to client
This commit is contained in:
parent
95d0baf137
commit
fe2df405e0
1 changed files with 7 additions and 0 deletions
|
@ -28,6 +28,7 @@ func TestSSH(t *testing.T) {
|
|||
|
||||
// ssh client setup
|
||||
var ki scenarios.EmptyKeyboardInteractiveChallenge
|
||||
var bannerReceived string
|
||||
clientConfig := &ssh.ClientConfig{
|
||||
User: "demo@example",
|
||||
Auth: []ssh.AuthMethod{
|
||||
|
@ -35,6 +36,7 @@ func TestSSH(t *testing.T) {
|
|||
ssh.KeyboardInteractive(ki.Do),
|
||||
},
|
||||
HostKeyCallback: ssh.FixedHostKey(newPublicKey(t, serverHostKey.Public())),
|
||||
BannerCallback: func(message string) error { bannerReceived = message; return nil },
|
||||
}
|
||||
|
||||
// pomerium + upstream setup
|
||||
|
@ -56,6 +58,9 @@ func TestSSH(t *testing.T) {
|
|||
up := upstreams.SSH(
|
||||
upstreams.WithHostKeys(newSignerFromKey(t, serverHostKey)),
|
||||
upstreams.WithPublicKeyCallback(certChecker.Authenticate),
|
||||
upstreams.WithBannerCallback(func(_ ssh.ConnMetadata) string {
|
||||
return "UPSTREAM BANNER"
|
||||
}),
|
||||
)
|
||||
up.SetServerConnCallback(echoShell{t}.handleConnection)
|
||||
r := up.Route().
|
||||
|
@ -70,6 +75,8 @@ func TestSSH(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
defer client.Close()
|
||||
|
||||
assert.Equal(t, "UPSTREAM BANNER", bannerReceived)
|
||||
|
||||
sess, err := client.NewSession()
|
||||
require.NoError(t, err)
|
||||
defer sess.Close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue