This script will help you to dig a hole in the inside network using container with docker and create a tunneling server.
Server config is in
./src/server/config
- Check the
.env.example
file and save another one to.env
.
Server side only use field of
USER_NAME
in.env
.
- Generate pairs of key
bash ./keygen-server.sh
- Run the reverse server
bash ./run-server.sh
Default tunnel port is
22222
and reverse tunnel port is22224
indocker-compose.server.yml
.
-
Check the
.env.example
file and save another one to.env
. -
Generate pairs of key
bash ./keygen.sh
Tunnel private user key in
./src/user_ssh_key/id_rsa
-> use to connect inside local servers.
Tunnel private server key in
./src/root_ssh_key/id_rsa
-> use to connect your outside tunnel server.
- Test connecting to the outside server specified in
.env
file
bash ./connect-outside-use-client-key.sh
- Run this command and copy the public key into outside server file
~/.ssh/authorized_keys
echo $(cat ./src/root_ssh_key/id_rsa.pub)
Or you can copy key with this command:
ssh-copy-id <YOUR_USERNAME_IN_OUTSIDE_SERVER>@<YOUR_OUSIDE_SERVER> -i ./src/root_ssh_key/id_rsa
- Start the OpenSSH server for tunneling inside
bash ./run-client.sh
In the first time, you need to go through the all steps.
When you turn on this tunnel in the second time, just feeling free to run step 4.
docker exec -it reverse-inside-tunnel /bin/bash
-
Copy public key to server
ssh-copy-id <YOUR_SERVER_ADDRESS>
-
SSH Config Example
Host SELF HostName example.com <- Your outside server domain! Port 22224 <- Your reversing port! User natlee Compression yes