I have Ubuntu 16.04 LTS installed, I want to deny HTTP and HTTPS requests using ufw.

I enabled the ufw and set firewall rules using these commands ~>

sudo ufw deny http


 sudo ufw deny https

But When i open a website (http/https) in a browser (Google Chrome) they works fine, I want to block them.

How can i do that ?

  • 2
    For very obvious reasons, I have to ask: what are you trying to protect against? Sites can still use proxies, etc.; if you're trying to just block traffic that'd go outside your network there's a better approach by blacklisting outgoing traffic by default and only allow to internal network IPs. – Thomas Ward Aug 28 '17 at 19:12

You are blocking incoming connections. Use

sudo ufw deny out 80
sudo ufw deny out 443 

This will likely also block apt updates, so be careful.

| improve this answer | |
  • 2
    This will also block a ton of other things that you probably are trying to protect against as well. – Thomas Ward Aug 28 '17 at 19:11
  • This also won't protect against http or https served over other ports, which requires very little config in Apache iirc. If you're worried about data leaks, airgap the computer. – brndn2k Aug 28 '17 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.