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 ?
Asked
Active
Viewed 1,130 times
0
seif elsherif
- 9
- 2
1 Answers
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