Questions about add firewall exception in wix installer by firewall extension

荒凉一梦 提交于 2019-12-04 09:37:33

The existing wix FirewallException custom actions make use of the XP/Server2003 windows firewall API. In this API, setting a firewall exception for a particular executable implies that all ports and all protocols will be opened to the exception.

For reference, the XP/Server2003 firewall API interfaces. Notice that INetFwOpenPort has the ability to get/set the port, while INetFwAuthorizedApplication does not.

If you want to create a firewall exception on a program and explicitly limit the port, protocol, and domain you'll need to make use of the windows 'advanced' firewall API that came with Vista. Check out these references: Highlevel overview
Reference guide
Command-line reference guide

Sadly, nobody has yet implemented an AdvancedFirewallException extension for wix that makes use of these updated APIs. Maybe I'll run a kickstarter campaign to see if there interest in funding the development ;P

Try to use different Names for each FirewallExeption ID. This worked for me:

<File Id="sample.exe"
              Name="sample.exe"
              Source="..\TestFrame\bin\debug\sample.exe"
              Vital="yes"
              KeyPath='yes'>

          <fire:FirewallException Id="FirewallDomainSampleTcp"
                                  Name="Domain Sample TCP"
                                  Protocol="tcp"
                                  Port="8080"
                                  Scope="any"
                                  IgnoreFailure="yes"
                                  Profile="domain" />

          <fire:FirewallException Id="FirewallDomainSampleUdp"
                                  Name="Domain Sample UDP"
                                  Protocol="udp"
                                  Port="8080"
                                  Scope="any"
                                  IgnoreFailure="yes"
                                  Profile="domain" />

          <fire:FirewallException Id="FirewallPrivatSampleTcp"
                                  Name="Private Sample TCP"
                                  Protocol="tcp"
                                  Port="8080"
                                  Scope="any"
                                  IgnoreFailure="yes"
                                  Profile="private" />

          <fire:FirewallException Id="FirewallPrivateSampleUdp"
                                  Name="Private Sample UDP"
                                  Protocol="udp"
                                  Port="8080"
                                  Scope="any"
                                  IgnoreFailure="yes"
                                  Profile="private" />
        </File>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!