Skip to content

Instantly share code, notes, and snippets.

@parsec
Created April 27, 2016 13:53
Show Gist options
  • Select an option

  • Save parsec/69967df7b65230626071a6d9254d8975 to your computer and use it in GitHub Desktop.

Select an option

Save parsec/69967df7b65230626071a6d9254d8975 to your computer and use it in GitHub Desktop.
RasPi Dropbox Setup
On server-side
--------------
sTunnel configured like so:
cert = /etc/stunnel/stunnel.pem
[ssh]
accept = 443
connect = 127.0.0.1:22
On client side
---------------
sTunnel configured like so (cert needs to be copied from server):
cert = /etc/stunnel/stunnel.pem
[ssh]
accept = 127.0.0.1:22
connect = [your.server.ip]:443
Autossh setup for creating an SSH tunnel to server:
sudo autossh -nNT -f -R 2201:localhost:22 parsec@localhost -p 2200
To have sTunnel and autoSSH start on network connection:
Copy following script into /etc/network/if-up.d/:
#!/bin/sh
#reverse-connect script using sTunnel and autoSSH
#created by p4rsec
sleep 10 #to make sure network has had a chance to get DHCP IP
sudo stunnel
sleep 10 #to make sure the stunnel connection gets created before autossh tries to connect
sudo autossh -nNT -f -R 2201:localhost:22 parsec@localhost -p 2200 #autossh command that connect to SSH through sTunnel
Add the following line to /etc/network/interfaces
post-up /etc/network/if-up.d/reverse-connect #or whatever you named the script
NOTE: Public keys MUST be copied into root for autoSSH to connect during boot! Easiest way is this (you can even create a seperate root keypair)
root@raspberrypi ~: ssh-keygen
root@raspberrypi ~: ssh-copy-id user@server
user@server ~: ssh-copy-id root@raspberrypi #use the IP of said raspberry pi, or whatever other device you might be using.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment