Correct way to block all outgoing traffic and allow only one application

0

I am trying to block all traffic on a machine, except the outbound connection for an application with some ip's and ports. This is how I'm doing it but it's still blocked:

First, I turn on firewall and block all outbound connections for domain, private and public profile. After that, I run the follwing netsh commands in order to allow only the application traffic:

netsh advfirewall firewall add rule name="Allow_TCP_connection" program="%ProgramFiles% (x86)\Application\Application.exe" protocol=tcp remoteip=<ip> localport=<port1,port2> dir=out enable=yes action=allow profile=Private
netsh advfirewall firewall add rule name="Allow_UDP_connection" program="%ProgramFiles% (x86)\Application\Application.exe" protocol=udp remoteip=<ip> localport=<port1,port2> dir=out enable=yes action=allow profile=Private

mhd

Posted 2016-06-15T12:58:16.577

Reputation: 11

Answers

0

Unless you specifically want to do it from a script, I strongly suggest you use the create Firewall Rule assistant. From the firewall admin page in MMC, right click the folder for Outbound rule, then Add rule and follow the instructions.

Nathan.Eilisha Shiraini

Posted 2016-06-15T12:58:16.577

Reputation: 2 503

I also did this manually. Also after running the command I manually checked if the rules were created correctly – mhd – 2016-06-15T13:06:32.217