View previous topic :: View next topic |
Author |
Message |
iarwain Apprentice
Joined: 25 Sep 2003 Posts: 253
|
Posted: Wed Jul 27, 2005 10:16 am Post subject: hosts.allow with dynamic ip |
|
|
Hi,
I want to allow my remote computer (myip.dyndns.org) to access to another[/code] sshd. Here's my hosts.allow:
Code: | sshd:myip.dyndns.org |
And hosts.deny:
This way is doesn't work. It seems hosts.allow does not resolve myip.dyndns.org. If I put the ip number manually, it works.
Any ideas?
Thanks. |
|
Back to top |
|
|
magic919 Advocate
Joined: 17 Jun 2005 Posts: 2182 Location: Berkshire, UK
|
Posted: Wed Jul 27, 2005 7:50 pm Post subject: |
|
|
Your method would need it to (from the point of view of the hosts file) ignore the IP of the connecting machine, ignore the fact there is no reverse DNS configured for that IP and then resolve myip.dyndns.org and use that instead. That's why it fails, I'd say.
Tony |
|
Back to top |
|
|
iarwain Apprentice
Joined: 25 Sep 2003 Posts: 253
|
Posted: Fri Jul 29, 2005 11:03 am Post subject: |
|
|
Thanks for your reply magic919.
I've made 2 little scripts to make the job.
/usr/bin/act_ips :
Code: | #!/bin/bash
ip1=$(host name1.dyndns.org | awk '{print $4}')
ip2=$(host name2.dyndns.org | awk '{print $4}')
echo "sshd: localhost,172.26.0.,$ip1,$ip2" > /etc/hosts.allow
|
/usr/bin/ren_ips :
Code: | #!/bin/bash
while :; do
/usr/bin/act_ips;
sleep 300;
done
|
With the 1st script (act_ips) we update hosts.allow, and with the 2nd (ren_ips) we run the 1st every 300 seconds.
Finally I've added this line to /etc/conf.d/local.start :
And it works |
|
Back to top |
|
|
magic919 Advocate
Joined: 17 Jun 2005 Posts: 2182 Location: Berkshire, UK
|
Posted: Fri Jul 29, 2005 11:51 am Post subject: |
|
|
Sounds like that will do the job.
T |
|
Back to top |
|
|
|