falahati / WindowsFirewallHelper

A class library to manage the Windows Firewall as well as adding your program to the Windows Firewall Exception list.
MIT License
276 stars 72 forks source link

Firewall profile - block #43

Closed alizalevinger closed 3 years ago

alizalevinger commented 3 years ago

How can I block all connections but those that match an Allow rule? Seems likeprofile.DefaultInboundAction = FirewallAction.Block sets the firewall to block all connections, ignoring any allow rules. I'm looking for the option that matches Block (default) - the choice available in Windows Firewall With Advanced Security which blocks all connections except those that match an Allow rule?

falahati commented 3 years ago

profile.DefaultInboundAction is the right way to do so. Then you have to create an allow role for each acceptable action.