ÈÐ Wïgê† Ðð† ñåmê

ïñ£ð§ê¢, ïñ£ðrmå†ïðñ §ê¢µr, Ðïgï†ål £ðrêñ§ï¢§, hå¢kïñg, §¥§†êm åÐmïñ阮rå†ïðñ, lïñµx ßlðg

Sometimes the solution is simple….

, ,

There are times when I need to do things and I don’t trust using public access, hotspots, etc. So basically what I did was set up a vpn on my home network and I can then connect to it from anywhere. This has the advantage of encrypting my communications while in a public place. One of the problems was that my ISP will randomly change the ip address. Granted there are numerous services that will do dynamic dns….but that just has the potential to attract unwanted traffic. So, what I did was basically wrote a small 1 line script that dumps my ip once a day to my dropbox account (encrypted).  Either the script can be run (via crontab) or you can simply add the entire line to crontab:

[codesyntax lang=”bash”]

#!/bin/bash

# By Ed Wiget
# get and log ip address

# lynx using --dump option just shows contents
# first sed removes beginning and trailing white space from lines
# second sed removes blank lines
# gpg encrypts the file for [email protected] and saves it to /path/to/encrypted.file.asc
# then we log that we completed the task
lynx --dump http://ipecho.net/plain | sed 's/^[ \t]*//;s/[ \t]*$//' | sed '/^$/d' | gpg -ea -r [email protected] > /path/to/encrypted.file.asc | logger "external ip encrypted"

[/codesyntax]

Add it to your users crontab using ‘crontab -e’:

[codesyntax lang=”bash”]

# encrypted version hourly
0 * * * * lynx --dump http://ipecho.net/plain | sed 's/^[ \t]*//;s/[ \t]*$//'  | sed '/^$/d'  | gpg -ea -r [email protected] >  /path/to/encrypted.file.asc | logger "external ip encrypted"

[/codesyntax]

So now I can get my ip address from an encrypted file by simply using:

[codesyntax lang="bash"]
gpg -d /path/to/encrypted.file.asc
[/codesyntax]

Leave a Reply