Start Service endpoints remotely [Beta]
We know that webrelay can allow you to connect to remote services by starting a service on the remote machine and then connecting your local client to it. This is useful when you want to connect to a service that is not accessible from the internet, and you also don't want to make the service publicly accessible.
In addition to this, You can ask Webrelay to bind to a service on the remote machine, without needing to log into the remote machine. This is done using the relay command
Example
On the remote machine
Ensure that you are logged into the remote machine and have installed webrelay Login with your webrelay account
First install and start the relay service on the remote machine in daemon mode
```bash
webrelay relay install
webrelay relay start -d
We need a test service to connect to, lets start a simple echo service
nc -l 12345 -k -c 'xargs -n1 echo'
This command does the following:
-l
tells netcat to listen for incoming connections.12345
is the port number to listen on.-k
tells netcat to keep listening for another connection after the current one is completed.-c
'xargs -n1 echo' sets up a simple echo service that reads input line by line and echoes it back.
On your local machine
Connect your client
Start by listing your relays
webrelay relay list
You should see that a new service named relay-<hostname>
has been added to your list of services.
+-----+----------------------------------------------+
| NO | RELAY |
+-----+----------------------------------------------+
| 1 | relay-CentOS-80-stream-amd64-base-MainServer |
+-----+----------------------------------------------+
You can now ask this relay to start a service on the remote machine by running the following command
webrelay service start -r relay-CentOS-80-stream-amd64-base -n echo -u 127.0.0.1 -p 12345 -t tcp
This command instructs the relay running on the remote machine to start a service named echo
on the remote machine,
which will connect to the netcat echo service we ran earlier.
List your services again
webrelay service list
You should see the echo service now listed
Bind the remote service to a local port
webrelay client -n echo -p 9000
The command above binds the remote service to a local port. Now you can access the service as if it were running locally
at localhost:9000
You can connect to the local service on telnet and test it out
telnet localhost 9000
You can now ask your relay to close the echo
service
webrelay service stop echo
You can hit Ctrl+C
to stop the relay anytime and all connections will be closed.