LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-19-2005, 09:43 PM   #1
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Rep: Reputation: 30
Is it possible to use a DNS name instead of an IP in xinetd?


I'm interested in blocking a service from running outside of the LAN except to myself. Since my ISP uses a dynamic IP I use no-ip to give myself a static name I can use to SSH into my system. For those unaware, no-ip.com offers a client service that runs on your system and updates there DNS servers anytime your IP changes. You can register for a surname.no-ip.com or from a selection of others as a way to run a website off a dynamic IP system. This also works with VNC, SSH, etc. I was thinking if I can put surname.no-ip.com as an allowed IP in my server's xinetd directory for SSH, VNC, etc. only my home PC can get to SSH from outside the network no matter what my IP address changes to. Would this work? How can I write this? I was thinking I can put in a cron job on the server to get the IP of surname.no-ip.com on a set interval (say 15 minutes) and parse it to a string or environment variable so that in the file I could write $adminip and it would check against it's system.
 
Old 08-21-2005, 06:28 PM   #2
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
While I have never used xinetd, I imagine it works the same as every other Linux program I have ever used.

In which case, you just give it the hostname, and it will resolve that when it needs to.

As long as the machine can resolve the hostname to an IP through it's DNS server, there shouldn't be a problem.
 
Old 08-22-2005, 08:35 AM   #3
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
I've never seen either a hostname OR an IP address in inetd setups. It is uses to allow the SERVICE not the address. Your configuration file for the SERVICE itself should deal with the address.

Rather than a cron job you might want to setup an init script (/etc/init.d) to do the setup you're looking for right after DHCP has started. As far as that goes it may be you can edit /etc/dhclient.conf (assuming you're using dhclient) to do what you want.
 
Old 08-22-2005, 06:21 PM   #4
HGeneAnthony
Member
 
Registered: Mar 2003
Posts: 178

Original Poster
Rep: Reputation: 30
Reply

Thanx for your help. What I ended up doing was using the hosts.allow hosts.deny files. For some reason you can't just use the noip domain with a DNS lookup like others. Luckily, I found someone who wrote out a solution when looking through google. What he did was create a file that did an nslookup for the no-ip DNS files and parsed the IP. The file would then recreate the hosts.allow file with the IP of the last known IP at that noip address. The script would execute whenever something tried to connect to the machine not in the allow list. So the first time it would drop the connection but the next time you'd be able to get in. The allow list also allowed for anyone on the LAN and local machine to connect. So I can run any service without a firewall (still do though) and the only people who could get to it is me and anyone in the subnet. Here's the script for hostupdate and the hosts.deny file if anyone wants it.

[/etc/hostupdate]
DNSA="fakename.noip.com"
NSIPA=`nslookup $DNSA | grep -A 1 $DNSA | awk '/Address:/ { print $2 }'`
echo -n "# hosts.allow file, updated " > /etc/hosts.allow
date >> /etc/hosts.allow
echo "ALL: 127.0.0.1" >> /etc/hosts.allow
echo "ALL: localhost" >> /etc/hosts.allow
echo "ALL: 192.168.0." >> /etc/hosts.allow
echo "ALL: "$NSIPA >> /etc/hosts.allow
[end file]

[/etc/hosts.deny]
ALL:ALL: spawn (/bin/sh < /etc/hostupdate) &
[end file]

I'm not too fond of having it recreate the file each time. I do something like this on my server at work so I can get in from home and if someone kept pinging it who wasn't in the list it would constantly be recreating the file and potentially locking out people on the subnet. At least this is a theory. What I'm thinking about doing is setting up a DNS on the machine and having it update the servers every 15 minutes. I know you can use DNS names through the hosts.allow and hosts.deny files it just can't with no-ip because TCP wrappers won't recognize them. This way I can just have it look on the local machine and I just check the local DNS and I won't have to worry about any issues. What do you think?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do I leave primary and seconday DNS blank for a DNS Server? imsam Linux - Networking 3 10-25-2004 01:48 PM
lame dns servers etc and general dns issues suse_linux9.1 Linux - Networking 3 06-01-2004 01:50 PM
Xinetd dead --xinetd dead but pid file exists hillxy Linux - General 1 04-15-2004 02:10 PM
need help to set up caching only dns server to with bogus DNS entries ullas Linux - Networking 1 10-28-2003 01:54 PM
xinetd gui10 Linux - Security 1 11-21-2001 01:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration