Dropbox 14 – Dropbox Server (Tunnels as a Service)

We are going to create monitored services for each of our tunnels. If they go down for any reason the system will restart them.

Create dbox-ssh-tunnel service

vi/vim/nano /etc/systemd/system/dbox-ssh-tunnel.service

[Unit]
Description=Create tunnel for SSH server on dbox-relay
After=network.target

[Service]
User=root
ExecStart=/usr/bin/ssh -NT -F /root/.ssh/config dbox-ssh-tunnel
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Create dbox-vnc-tunnel service

vi/vim/nano /etc/systemd/system/dbox-vnc-tunnel.service

[Unit]
Description=Create tunnel for VNC server on dbox-relay
After=network.target

[Service]
User=root
ExecStart=/usr/bin/ssh -NT -F /root/.ssh/config dbox-vnc-tunnel
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Create dbox-squid-tunnel service

vi/vim/nano /etc/systemd/system/dbox-squid-tunnel.service

[Unit]
Description=Create tunnel for Squid proxy on dbox-relay
After=network.target

[Service]
User=root
ExecStart=/usr/bin/ssh -NT -F /root/.ssh/config dbox-squid-tunnel
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Create dbox-socks-tunnel service

vi/vim/nano /etc/systemd/system/dbox-socks-tunnel.service

[Unit]
Description=Create tunnel for SOCKS proxy on dbox-relay
After=network.target

[Service]
User=root
ExecStart=/usr/bin/ssh -NT -F /root/.ssh/config dbox-socks-tunnel
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Let the system know we’ve added services.

systemctl daemon-reload

Set all of our new services to start on boot.

systemctl enable dbox-ssh-tunnel.service
systemctl enable dbox-vnc-tunnel.service
systemctl enable dbox-squid-tunnel.service
systemctl enable dbox-socks-tunnel.service

For fun reboot your Dropbox Server and run netstat in continuous refresh mode on your Dropbox Relay. Hopefully you’ll see your forwarded ports establish themselves.

netstat -clnt

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *