Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've created an account with no-ip.com that registers my laptop's ip with a subdomain of their service (mysubdomain.no-ip.info). When I do an nslookup on that subdomain, I see that the service is working and that it is pointing to the correct IP for my laptop.

Now I want to provide access to that subdomain on the admin site of our server which is protected by htaccess IP restrictions. When I try to add the subdomain to my script it does not work. Am I doing something wrong? I'm basically trying to make my laptop so it can log in from no matter when I'm at while still preventing all other IPs from accessing the site.

The following is the .htaccess file in the server directory I'm trying to access. I get a 403 error when trying to access that directory. Entering the exact IP of my laptop instead of the subdomain works fine.

## password begin ##
AuthName     "Restricted Access"
AuthUserFile /usr/www/users/site/.passwd
AuthType     Basic
Require valid-user
Order deny,allow
Deny from all
Allow from 69.1.122.161 mysubdomain.no-ip.org
Satisfy All
share|improve this question
    
I'm not clear on what you're asking. Is the computer that corresponds to mysubdomain.no-ip.com (.com or .org, BTW?) your laptop, or is it a server? A different one from the server that hosts the admin site? The given .htaccess snippet comes from an .htaccess file on the server that hosts the admin site, right? Also, what exactly doesn't work, and how? Are you getting an HTTP 403 (Forbidden) error code when you try to access the admin site from your laptop? –  David Z Apr 3 '10 at 0:48
    
I've updated my question to clarify. The mysubdomain.no-ip.com is for my laptop's IP. The server I'm trying to access is on a remote machine with a completely different IP. The .htaccess shown is in the directory I'm trying to access on the server. I'm getting a 403 error when I try to access it. If I enter my IP address instead of the subdomain, it works fine. But the "subdomain.no-ip.org" is not working even though it seems to resolve correctly to my IP. –  kenja Apr 3 '10 at 0:54
    
You must use Allow from with 1 entry per line so you need a entry for 69.1.122.161 and another for your subdomain. –  Prix Aug 24 '10 at 23:31

2 Answers 2

Test it without the "deny from all" statement.

Deny from all

The order statement is already denying everything except what you've specifically allowed.

Order deny,allow

I have not tested this theory; be sure to test.

share|improve this answer

This doesn't work because access is also based on the PTR (IP Reverse Record) record, not only A records pointing to the IP Address. From the Apache manual:

A (partial) domain-name
Example:

Allow from apache.org
Allow from .net example.edu

Hosts whose names match, or end in, this string are allowed access. Only complete components are matched, so the above example will match foo.apache.org but it will not match fooapache.org. This configuration will cause Apache to perform a double reverse DNS lookup on the client IP address, regardless of the setting of the HostnameLookups directive. It will do a reverse DNS lookup on the IP address to find the associated hostname, and then do a forward lookup on the hostname to assure that it matches the original IP address. Only if the forward and reverse DNS are consistent and the hostname matches will access be allowed.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.