You can expose a http port from a private network using caddy and ssh
- Set up the server
- Set up the client
- Navigate to your host.
Server must be a pc or a server with a static public ip and a nameserver.
In my case, it's gonna be kirpachov.com
.
# Step 1
git clone https://github.com/anderspitman/SirTunnel.git
# Step 2
# In this step you will be asked the password, this is necessary to enable caddy to bind low ports
# as low ports such as 80 require root permissions
cd SirTunnel; ./install.sh
# Step 3 - run the server
# Note that 'run' action will block the console; If you want a background process, use 'start' instead.
./caddy run --config caddy_config.json
At this point, your server should be set up.
Client can by either your pc or another server.
You can expose any port. In my case I'm just gonna expose port 80
.
# After the server setup
ssh -tR 9001:localhost:80 kirpachov.com /home/sasha/SirTunnel/sirtunnel.py kirpachov.com 9001
9001
is the port where the tunnel will be created.
The path of the sirtunnel.py
file must be relative to the server.
The last kirpachov.com
can be replaced with anything such as cloud.kirpachov.com
.
WARNING: caddy server
will auto-find ssl certificates and force https. It it will not find any certificate you may have issues.