add grpc e2e test
This commit is contained in:
parent
cfccf2106f
commit
289b1e51e6
4 changed files with 80 additions and 4 deletions
8
sshpiperd/e2e/Dockerfile-grpcremote
Normal file
8
sshpiperd/e2e/Dockerfile-grpcremote
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
FROM golang
|
||||
|
||||
ADD . /go/src/github.com/tg123/sshpiper/
|
||||
WORKDIR /go/src/github.com/tg123/sshpiper/sshpiperd/upstream/grpcupstream/simpleserver
|
||||
|
||||
RUN go build -o /simpleserver
|
||||
|
||||
|
||||
|
|
@ -29,6 +29,9 @@ services:
|
|||
- piper_pg
|
||||
- piper_mssql
|
||||
# - piper_sqlite
|
||||
- piper_grpc_privatekey_host1
|
||||
- piper_grpc_remotesigner_host1
|
||||
- piper_grpc_host2
|
||||
piper:
|
||||
environment:
|
||||
- "SSHPIPERD_UPSTREAM_WORKINGDIR_NOCHECKPERM=true"
|
||||
|
|
@ -160,9 +163,67 @@ services:
|
|||
- "ACCEPT_EULA=y"
|
||||
- "SA_PASSWORD=yourStrong(!)Password"
|
||||
- "MSSQL_PID=Developer"
|
||||
|
||||
#tmpfs:
|
||||
# - /var/opt/mssql/data
|
||||
grpc_remotesigner_host1:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: sshpiperd/e2e/Dockerfile-grpcremote
|
||||
command: ["/simpleserver", "--toaddr", "host1", "--totype", "REMOTESIGNER", "--mappeduser", "root", "--privatekey", "/workingdir/host1/id_rsa"]
|
||||
volumes:
|
||||
- workingdir:/workingdir
|
||||
depends_on:
|
||||
- host1
|
||||
piper_grpc_remotesigner_host1:
|
||||
environment:
|
||||
- "SSHPIPERD_UPSTREAM_DRIVER=grpc"
|
||||
- "SSHPIPERD_UPSTREAM_GRPC_INSECURE=true"
|
||||
- "SSHPIPERD_UPSTREAM_GRPC_ENDPOINT=grpc_remotesigner_host1:2233"
|
||||
- "SSHPIPERD_AUDITOR=typescript-logger"
|
||||
- "SSHPIPERD_BANNERTEXT=hellopiper"
|
||||
build: ../..
|
||||
volumes:
|
||||
- workingdir:/var/sshpiper
|
||||
depends_on:
|
||||
- grpc_remotesigner_host1
|
||||
grpc_privatekey_host1:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: sshpiperd/e2e/Dockerfile-grpcremote
|
||||
command: ["/simpleserver", "--toaddr", "host1", "--totype", "REMOTESIGNER", "--mappeduser", "root", "--privatekey", "/workingdir/host1/id_rsa"]
|
||||
volumes:
|
||||
- workingdir:/workingdir
|
||||
depends_on:
|
||||
- host1
|
||||
piper_grpc_privatekey_host1:
|
||||
environment:
|
||||
- "SSHPIPERD_UPSTREAM_DRIVER=grpc"
|
||||
- "SSHPIPERD_UPSTREAM_GRPC_INSECURE=true"
|
||||
- "SSHPIPERD_UPSTREAM_GRPC_ENDPOINT=grpc_privatekey_host1:2233"
|
||||
- "SSHPIPERD_AUDITOR=typescript-logger"
|
||||
- "SSHPIPERD_BANNERTEXT=hellopiper"
|
||||
build: ../..
|
||||
volumes:
|
||||
- workingdir:/var/sshpiper
|
||||
depends_on:
|
||||
- grpc_privatekey_host1
|
||||
grpc_remotepass_host2:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: sshpiperd/e2e/Dockerfile-grpcremote
|
||||
command: ["/simpleserver", "--toaddr", "host2", "--totype", "PASSWORD", "--mappeduser", "root", "--password", "root"]
|
||||
depends_on:
|
||||
- host2
|
||||
piper_grpc_host2:
|
||||
environment:
|
||||
- "SSHPIPERD_UPSTREAM_DRIVER=grpc"
|
||||
- "SSHPIPERD_UPSTREAM_GRPC_INSECURE=true"
|
||||
- "SSHPIPERD_UPSTREAM_GRPC_ENDPOINT=grpc_remotepass_host2:2233"
|
||||
- "SSHPIPERD_AUDITOR=typescript-logger"
|
||||
- "SSHPIPERD_BANNERTEXT=hellopiper"
|
||||
build: ../..
|
||||
depends_on:
|
||||
- grpc_remotepass_host2
|
||||
volumes:
|
||||
- workingdir:/var/sshpiper
|
||||
|
||||
|
||||
volumes:
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
/wait.sh piper_mysql 2222
|
||||
/wait.sh piper_pg 2222
|
||||
/wait.sh piper_mssql 2222
|
||||
/wait.sh piper_grpc_remotesigner_host1 2222
|
||||
/wait.sh piper_grpc_privatekey_host1 2222
|
||||
/wait.sh piper_grpc_host2 2222
|
||||
|
||||
|
||||
# TODO to python
|
||||
|
|
@ -76,3 +79,7 @@ runtest "yaml host2 with key mapkeykey:" "host1" "mapkeykey" "ssh mapkeykey@pipe
|
|||
runtest "yaml host2 with key mapkeykey2:" "host1" "mapkeykey2" "ssh mapkeykey2@piper_yaml -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /local/id_rsa2 cat /names/host1"
|
||||
runtest "yaml host2 with password regex:" "host2" "regex000" "sshpass -p root ssh regex000@piper_yaml -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null cat /names/host2"
|
||||
runtest "yaml host1 with none host1:" "host1" "host1" "ssh host1@piper_yaml -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null cat /names/host1"
|
||||
|
||||
runtest "grpc host1 with remotesigner:" "host1" "host1" "ssh host1@piper_grpc_remotesigner_host1 -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=no -o PasswordAuthentication=no cat /names/host1"
|
||||
runtest "grpc host1 with privatekey:" "host1" "host1" "ssh host1@piper_grpc_privatekey_host1 -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PubkeyAuthentication=no -o PasswordAuthentication=no cat /names/host1"
|
||||
runtest "grpc host2 with password:" "host2" "host2" "sshpass -p wrongpassword ssh host2@piper_grpc_host2 -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null cat /names/host2"
|
||||
|
|
@ -17,7 +17,7 @@ import (
|
|||
)
|
||||
|
||||
type args struct {
|
||||
ListenAddr string `short:"l" long:"listen" default:"127.0.0.1"`
|
||||
ListenAddr string `short:"l" long:"listen" default:"0.0.0.0"`
|
||||
Port uint `short:"p" long:"port" default:"2233"`
|
||||
server
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue