LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   iptable to block a sub-domain (https://www.linuxquestions.org/questions/linux-security-4/iptable-to-block-a-sub-domain-864484/)

ZAMO 02-23-2011 05:08 AM

iptable to block a sub-domain
 
HI all.,

Is it possible to block a subdomain or a one lower level directory URL access from other hosts or network ? I have a site running on my server and i want to block the particular directory under the domain, with the exception of loopback access? I mean the directory must be accessible from loopback/localhost.
http://mydomain.com/sub on port 10016(expect loopback)
http://mydomain.com/sub/sub1 on port 10016 (expect loopback)
please suggest

Code:

iptables -I INPUT 1 -i lo -p tcp --dport 10016 -m string -algo kmp --string "mydomain/sub" -j ACCEPT
iptables -I INPUT 2 -i lo -p tcp --dport 10016 -m string -algo kmp --string "mydomain/sub/sub1" -j ACCEPT

iptables -I INPUT 3 -i eth0 -p tcp --dport 10016 -m string -algo kmp --string "mydomain/sub" -j DROP
iptables -I INPUT 4 -i eth0 -p tcp --dport 10016 -m string -algo kmp --string "mydomain/sub/sub1" -j DROP


acid_kewpie 02-24-2011 01:33 AM

You can't do this with iptables, it's none if it's business. You should look at mod_authz on apache for this.


All times are GMT -5. The time now is 03:13 AM.