0

I tried use this command to block a domain iptables -I INPUT -p tcp -m string --string "Host: domain.com" --algo bm -j REJECT and it worked but, i want to Reject all but accept from specified domains is that possible ?

1 Answers1

1

Before allowing a certain domain, block all other traffic:

iptables -P INPUT DROP

(this will drop all connections, even the ssh you might be using, so watch out)

Then, allow the domains you want:

iptables -I INPUT -p tcp  -m string --string "Host: domain.com" --algo bm -j  ACCEPT
Bart De Vos
  • 18,171