Menu

Home

I got tired of China trying to hack my Linux based Raspberry PI . So I turned off IP forwarding for ssh on my router, but now I couldn’t get into my PI from the internet. So I locked down my PI with iptables, and I still I can’t get from the internet into my PI with ssh. So I wrote a bash script/CGI that if you know the URL and know the remote IP address where you are coming from, you can open a hole with iptables using a web browser and never have to login to the server. Then lock it back down when you are done.

NOTE: CHANGE THE NAME OF THE SCRIPT TO SOMETHING UNIQUE TO YOU! The point is that only YOU know about the URL.

How it works:

  • A cron job watches a file that is written with a IP address in it every minute.
  • Google search: whats my IP
  • Enter in the IP address
  • A clock shows up and wait for next minute to roll-over
  • ssh to the remote machine
  • When your done... Click "Flush" and the IP Table returns to being locked!

Note: Sometimes you may be NAT'd at the source or where you come from isn't what your computer sees and it will not work.