support proxy banner from upstream (#548)
* remove unused logs * add banner to server password * add updated crypto lib * add test * refactor: clean up whitespace in banner test * fix: update test case name to use underscores for consistency
This commit is contained in:
parent
af3d2586cd
commit
3757d80348
6 changed files with 50 additions and 3 deletions
2
crypto
2
crypto
|
|
@ -1 +1 @@
|
|||
Subproject commit 44c1e2eaee8770161331993e3bc151667a503363
|
||||
Subproject commit 8682cc0c5ad6edd98b8992b8b1a932738b3d1bb3
|
||||
|
|
@ -114,5 +114,50 @@ func TestBanner(t *testing.T) {
|
|||
|
||||
waitForStdoutContains(stdout, randtext, func(_ string) {
|
||||
})
|
||||
|
||||
t.Run("from_upstream", func(t *testing.T) {
|
||||
piperaddr, piperport := nextAvailablePiperAddress()
|
||||
|
||||
piper, _, _, err := runCmd("/sshpiperd/sshpiperd",
|
||||
"-p",
|
||||
piperport,
|
||||
"/sshpiperd/plugins/fixed",
|
||||
"--target",
|
||||
"host-password:2222",
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("failed to run sshpiperd: %v", err)
|
||||
}
|
||||
|
||||
defer killCmd(piper)
|
||||
|
||||
waitForEndpointReady(piperaddr)
|
||||
|
||||
c, stdin, stdout, err := runCmd(
|
||||
"ssh",
|
||||
"-v",
|
||||
"-o",
|
||||
"StrictHostKeyChecking=no",
|
||||
"-o",
|
||||
"UserKnownHostsFile=/dev/null",
|
||||
"-p",
|
||||
piperport,
|
||||
"-l",
|
||||
"user",
|
||||
"127.0.0.1",
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("failed to ssh to piper, %v", err)
|
||||
}
|
||||
|
||||
defer killCmd(c)
|
||||
|
||||
enterPassword(stdin, stdout, "wrongpass")
|
||||
|
||||
waitForStdoutContains(stdout, "sshpiper banner from upstream test", func(_ string) {
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ services:
|
|||
volumes:
|
||||
- shared:/shared
|
||||
- ./sshdconfig/no_penalties.conf:/config/sshd/sshd_config.d/no_penalties.conf:ro
|
||||
- ./sshdconfig/banner.conf:/config/sshd/sshd_config.d/banner.conf:ro
|
||||
- ./sshdconfig/banner:/tmp/banner:ro
|
||||
networks:
|
||||
- default
|
||||
- netdistract
|
||||
|
|
|
|||
1
e2e/sshdconfig/banner
Normal file
1
e2e/sshdconfig/banner
Normal file
|
|
@ -0,0 +1 @@
|
|||
sshpiper banner from upstream test
|
||||
1
e2e/sshdconfig/banner.conf
Normal file
1
e2e/sshdconfig/banner.conf
Normal file
|
|
@ -0,0 +1 @@
|
|||
Banner /tmp/banner
|
||||
|
|
@ -212,8 +212,6 @@ func (p *SkelPlugin) PublicKeyCallback(conn ConnMetadata, publicKey []byte) (*Up
|
|||
return false, err
|
||||
}
|
||||
|
||||
log.Debugf("trusted user ca keys: %v", rest)
|
||||
|
||||
var trustedca ssh.PublicKey
|
||||
for len(rest) > 0 {
|
||||
trustedca, _, _, rest, err = ssh.ParseAuthorizedKey(rest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue