add base64 host key param
This commit is contained in:
parent
e7b276d6a5
commit
f0e9accbd0
4 changed files with 72 additions and 13 deletions
|
|
@ -1,7 +1,9 @@
|
|||
package e2e_test
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -58,3 +60,35 @@ func TestFixed(t *testing.T) {
|
|||
|
||||
checkSharedFileContent(t, targetfie, randtext)
|
||||
}
|
||||
|
||||
func TestHostkeyParam(t *testing.T) {
|
||||
_, piperport := nextAvailablePiperAddress()
|
||||
keyparam := base64.StdEncoding.EncodeToString([]byte(testprivatekey))
|
||||
|
||||
piper, _, _, err := runCmd("/sshpiperd/sshpiperd",
|
||||
"-p",
|
||||
piperport,
|
||||
"--server-key-data",
|
||||
keyparam,
|
||||
"/sshpiperd/plugins/fixed",
|
||||
"--target",
|
||||
"host-password:2222",
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("failed to run sshpiperd: %v", err)
|
||||
}
|
||||
|
||||
defer killCmd(piper)
|
||||
|
||||
b, err := runAndGetStdout(
|
||||
"ssh-keyscan",
|
||||
"-p",
|
||||
piperport,
|
||||
"127.0.0.1",
|
||||
)
|
||||
|
||||
if !strings.Contains(string(b), testpublickey) {
|
||||
t.Errorf("failed to get correct hostkey, %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ AAAEDcQgdh2z2r/6blq0ziJ1l6s6IAX8C+9QHfAH931cHNO9RGTH325rDUp12tplwukHmR
|
|||
-----END OPENSSH PRIVATE KEY-----
|
||||
`
|
||||
|
||||
const testpublickey = `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINRGTH325rDUp12tplwukHmR8ytbC9TPZ886gCstynP1`
|
||||
|
||||
const waitTimeout = time.Second * 10
|
||||
|
||||
func waitForEndpointReady(addr string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue