I have three computers with dynamic IP addresses, and I use no-ip.com (highly recommended!) to give them pseudo-static addresses. The problem is, TCP wrappers won't recognize no-ip addresses, so I can't just stick myhost.noip.net into hosts.allow to give myself remote access to my other machines. No-ip's tech support confirmed that this can't be done:
Your only option will be to allow access from all IP addresses, and use username/password authentication to allow access to the system. You will be unable to do what you are trying to do without a real static IP address from your ISP.I couldn't imagine that this was really my only option, so I did a bit of fiddling around, and I came up with a solution that seems to work.
First, create a file called /etc/hostupdate that contains the following code:
HOSTNAMEA="yourfirsthost"<br>
HOSTNAMEB="yoursecondhost"<br>
DOMAIN="noip.net"<br>
NSIPA=`nslookup $HOSTNAMEA.$DOMAIN | grep -A 1 $HOSTNAMEA.$DOMAIN | awk '/Address:/ { print $2 }'`<br>
NSIPB=`nslookup $HOSTNAMEB.$DOMAIN | grep -A 1 $HOSTNAMEB.$DOMAIN | awk '/Address:/ { print $2 }'`<br>
echo -n "# hosts.allow file, updated " > /etc/hosts.allow<br>
date >> /etc/hosts.allow<br>
echo "ALL: 127.0.0.1" >> /etc/hosts.allow<br>
echo "ALL: localhost" >> /etc/hosts.allow<br>
echo "ALL: "$NSIPA >> /etc/hosts.allow<br>
echo "ALL: "$NSIPB >> /etc/hosts.allow<br>
Replace yourfirsthost, yoursecondhost, and noip.net with whatever's appropriate for your setup, and add any other hosts that you keep in hosts.allow, using the same syntax as the last four lines. Note that this will NOT retain hosts added by other programs. Once you've saved the file, source it to create your hosts.allow file. Then just create a hosts.deny file that looks like this:
ALL:ALL: spawn (/bin/sh < /etc/hostupdate) &<br><br>
You can jazz this up with other commands as well; for example, if you've set up njnystrom's Perl script that lets you use Mail.app as if it were mail, you could do:
ALL:ALL: spawn (echo Attempt from %h %a to %d at `date`|tee -a /var/log
tcp.deny.log|/bin/mail -F root@yourhost.noip.net -s "Security Alert!"
you@your.email.com; /bin/sh < /etc/hostupdate) &
Note that this must all be on one line, and there must be a carriage return at the end.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20031101121418826