Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-19-2005, 09:43 PM
|
#1
|
Member
Registered: Mar 2003
Posts: 178
Rep:
|
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.
|
|
|
08-21-2005, 06:28 PM
|
#2
|
LQ Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852
|
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.
|
|
|
08-22-2005, 08:35 AM
|
#3
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
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.
|
|
|
08-22-2005, 06:21 PM
|
#4
|
Member
Registered: Mar 2003
Posts: 178
Original Poster
Rep:
|
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?
|
|
|
All times are GMT -5. The time now is 03:11 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|