So, everyone uses a jump host to help with security. It often causes people to require to configure SSH tunnels, to remotely browse the services and even connect to hosts in another network.
The best information I found was using a command like this:
1 |
/usr/bin/ssh -N -D 0.0.0.0:8080 localhost |
However you have to enter that at every single boot! There’s no status on it, and that doesn’t help you simply run it in the background even without logging into your jump host.
Solution:
Lets run it as a service! For this instruction I am using CentOS 7, simply because systemd is in the new OS’s, so it’s relevant.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# cat /usr/lib/systemd/system/socks5.service [Unit] Description=Socks5 After=sshd.service Requires=sshd.service [Service] Type=simple ExecStart=/usr/bin/ssh -f -N -D 0.0.0.0:8080 localhost User=<enter the user you want this to run as> Group=<enter the group you want this to run as> [Install] WantedBy=multi-user.target |
Now you have a no mess, socks5 service running on your host. If you want it to start with boot, just run:
1 |
systemctl enable socks5.service |