PDA

View Full Version : How do i ban/deny not IP, but a hostname partial match on Linux?



Fli
07-07-2017, 09:11 AM
Hello,

on Linux command line, i ban IP like this:

iptables -A INPUT -s IPhere -j DROP

or

iptables -A FORWARD -s IPhere -j DROP

i use FORWARD as my Linux server is an OpenVPN server proxy and INPUT was not working.

But how do i block some hostname? Example:

*.rdsnet.ro

Is there any effective way?

I added:

ALL: .rdsnet.ro
ALL: rdsnet.ro

into /etc/hosts.deny

but it does not block these, maybe because OpenVPN server is used to "relay" traffic to my client computer (Windows 10). I tried Comodo Internet Security on my openvpn client computer to ban the hostname but, i am doing something wrong as it do not work either.

I was thinking about ipset or Config server firewall, but CSF i am unsure if can ban hostnames, it do not seem like that. ipset says error "Cannot open session to kernel." i am on a OpenVZ VPS CentOS 6 Linux.