0

I need to block all outgoing traffic to a domain with all its subdomains.

I tried to do something like this:

sudo ufw deny out from any to *.domain.com

but of course it doesn't work because it needs an IP number.

How can I do this?

terdon
  • 104,119
user3021729
  • 151
  • 2
  • 5

1 Answers1

1

You can do this more reliably with hosts.deny in just a few seconds:

  1. Open Terminal (if it’s not already open)
  2. Edit hosts.deny as root:
    sudo vi /etc/hosts.deny
    
  3. At the bottom of the file, add:
    ALL : .domain.com
    
  4. Save the file

The preceding dot in .domain.com is important. Do not forget it