I have a home system which syncs to dyndns. As a result I can ping my dyndns hostname and find my IP from work. I need a script I can run as a cron job to ping the hostname, find the IP and allow port 22 for that IP. (And remove the old IP)

I use Firestarter for my firewall config, I'll admit I don't know much about iptables.