Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
DNS, iptables and dropping.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jzono1
Tux's lil' helper
Tux's lil' helper


Joined: 01 Feb 2004
Posts: 128

PostPosted: Tue Jan 24, 2006 12:50 pm    Post subject: DNS, iptables and dropping. Reply with quote

My apache serves different pages depending on the dns adress resolved to get to it. Would it be possible to only allow ssh, IF ssh was innitiated by ssh some.host.my.domain.com, but NOT some.other.host.my.domain.com?
Back to top
View user's profile Send private message
tuxmin
l33t
l33t


Joined: 24 Apr 2004
Posts: 838
Location: Heidelberg

PostPosted: Tue Jan 24, 2006 2:03 pm    Post subject: Reply with quote

Certainly, you can filter by source and/or target address. However, as it's called ipfilter and not dnsfilter, you cannot create rules by dns names if that was your question.


alex
_________________
ALT-F4
Back to top
View user's profile Send private message
jzono1
Tux's lil' helper
Tux's lil' helper


Joined: 01 Feb 2004
Posts: 128

PostPosted: Tue Jan 24, 2006 7:16 pm    Post subject: Reply with quote

Well, dns names is what i'd want.
Like, run a public http server on my.example.domain.com, with just letting through port 80 when someone scans my.example.domain.com, but allow ssh on another dns.
Is it even possible?
Back to top
View user's profile Send private message
tuxmin
l33t
l33t


Joined: 24 Apr 2004
Posts: 838
Location: Heidelberg

PostPosted: Wed Jan 25, 2006 9:03 am    Post subject: Reply with quote

You can always try to resolve these dns names to IP addresses. However, things will break with dynamic IPs.
_________________
ALT-F4
Back to top
View user's profile Send private message
HAL_9000
Tux's lil' helper
Tux's lil' helper


Joined: 29 Sep 2004
Posts: 114
Location: Netherlands

PostPosted: Wed Jan 25, 2006 1:16 pm    Post subject: Reply with quote

/sbin/iptables -A INPUT -i $iface -p tcp -s $youralloweddnsentry --sport 1024: -d $ip --dport 22 -m state --state NEW -j ACCEPT
/sbin/iptables -A OUTPUT -o $iface -p tcp ! --syn -s $ip --sport 22 -d $youralloweddnsentry--dport 1024: -j ACCEPT

with $iface being the network device in question, $ip being the IP of that network device in question
$youralloweddnsentry for the hostname you want to connect from...

(written for a DROP the rest policy :> )
_________________
We are the keepers of the sacred words: Ni peng and Nee wom!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum