Skip to content

Instantly share code, notes, and snippets.

@arekinath
Created January 24, 2012 10:19
Show Gist options
  • Save arekinath/1669479 to your computer and use it in GitHub Desktop.
Save arekinath/1669479 to your computer and use it in GitHub Desktop.
1. Put these files in /etc/persistent on the ubnt
2. on the ubnt device, do:
cd /etc/persistent
chmod +x rc.postsysinit ssh-tunnel
dropbearkey -t rsa -f ubnt-rsa
3. dropbear will print out the public-key part (line that looks like: ssh-rsa XXXXXX... )
4. put this ssh-rsa line into ~/.ssh/authorized_keys on the server
5. on the ubnt device, do:
cfgmtd -r
cfgmtd -w -p /etc
6. reboot the ubnt (eg type "reboot" and enter)
Now, on the server (in this case xylem.cooperi.net) you can do
ssh -p 12345 admin@localhost
type the admin password for the ubnt device and you're in!
Note: this is a simple draft, it needs support for dynamic port numbers, needs to handle timeouts better and have some sort of mechanism on the server side to keep track of which ports belong to which APs
#!/usr/bin/sh
/etc/persistent/ssh-tunnel &
#!/usr/bin/sh
trap "echo hup" 1
while true; do
ssh -R 12345:127.0.0.1:22 -y -N -i /etc/persistent/ubnt-rsa ubnt@xylem.cooperi.net
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment