Skip to content

Commit dfb7512

Browse files
chrisbednarskibarnson
authored andcommitted
add firewall extension decompiler, make msi modifications work, add all attributes
1 parent 80e6047 commit dfb7512

35 files changed

+3356
-347
lines changed

src/ext/Firewall/ca/firewall.cpp

Lines changed: 783 additions & 197 deletions
Large diffs are not rendered by default.

src/ext/Firewall/test/WixToolsetTest.Firewall/FirewallExtensionFixture.cs

Lines changed: 457 additions & 28 deletions
Large diffs are not rendered by default.

src/ext/Firewall/test/WixToolsetTest.Firewall/TestData/UsingFirewall/PackageComponents.wxs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,51 @@
66
<Component>
77
<File Name="fw.exe" Source="example.txt">
88
<Shortcut Id="FwShortcut" Directory="INSTALLFOLDER" Name="Firewall" />
9-
<fw:FirewallException Id="ExampleFirewall" Description="An app-based firewall exception" Name="ExampleApp" Port="42">
9+
<fw:FirewallException Id="ExampleFirewall" Description="An app-based firewall exception" Name="ExampleApp" Port="42" OnUpdate="DoNothing" >
1010
<fw:RemoteAddress Value="*" />
1111
</fw:FirewallException>
1212
</File>
1313

14-
<fw:FirewallException Description="A port-based firewall exception" Name="ExamplePort" Port="42" Outbound="yes" Scope="localSubnet" />
14+
<fw:FirewallException Description="A port-based firewall exception" Name="ExamplePort" Port="42" Outbound="yes" Scope="localSubnet" OnUpdate="EnableOnly" />
1515
<fw:FirewallException Description="DNS scope firewall exception" Name="ExampleDNSScope" Port="356" Protocol="udp" Scope="DNS" />
1616
<fw:FirewallException Description="DHCP scope firewall exception" Name="ExampleDHCPScope" Program="test.exe" Protocol="211" Scope="DHCP" Profile="public" />
1717
<fw:FirewallException Description="WINS scope firewall exception" Name="ExampleWINSScope" Port="6573" Scope="WINS" Profile="domain"/>
1818
<fw:FirewallException Description="defaultGateway scope firewall exception" Name="ExampleDefaultGatewayScope" Port="4432" Scope="defaultGateway" Profile="private" />
19+
20+
<fw:FirewallException Description="Defer to user edge traversal" Name="defertouser" Program="fw.exe" EdgeTraversal="DeferToUser" />
21+
<fw:FirewallException Description="A port-based service exception" Name="ExampleService" Port="12000" Service="ftpsrv" Program="%windir%\system32\svchost.exe" >
22+
<fw:LocalAddress Value="DHCP"/>
23+
<fw:LocalAddress Value="WINS"/>
24+
</fw:FirewallException>
25+
26+
<fw:FirewallException Description="Interfaces with nested elements" Name="interface nested" Port="54671" >
27+
<fw:RemoteAddress Value="127.0.0.1"/>
28+
<fw:Interface Name="Wi-Fi" />
29+
<fw:Interface Name="Local Area Connection" />
30+
</fw:FirewallException>
31+
<fw:FirewallException Description="Interfaces with property" Name="interface property" Port="54671" Interface="[INTERFACE_PROPERTY]" />
32+
33+
<ServiceInstall Name="svc1" Type="ownProcess" Start="disabled" ErrorControl="ignore" >
34+
<fw:FirewallException Id="ServiceInstall.nested" IgnoreFailure="true" Description="A port-based firewall exception for a windows service" Name="ExampleNestedService" Port="3546-7890" Scope="localSubnet" >
35+
<fw:InterfaceType Value="Lan" />
36+
<fw:InterfaceType Value="Wireless" />
37+
</fw:FirewallException>
38+
</ServiceInstall>
39+
40+
<fw:FirewallException Description="Simple INetFwRule3 values" Name="INetFwRule3 values" Scope="any" LocalAppPackageId="S-1-15-2-1239072475-3687740317-1842961305-3395936705-4023953123-1525404051-2779347315" LocalUserAuthorizedList="O:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)" LocalUserOwner="S-1-5-21-1898747406-2352535518-1247798438-1914" RemoteMachineAuthorizedList="127.0.0.1" RemoteUserAuthorizedList="O:LSD:(A;;CC;;;S-1-5-84-0-0-0-0-0)" IPSecSecureFlags="NegotiateEncryption" />
41+
<fw:FirewallException Description="INetFwRule3 passed via properties" Name="INetFwRule3 properties" Scope="any" LocalAppPackageId="[PROP1]" LocalUserAuthorizedList="[PROP2]" LocalUserOwner="[PROP3]" RemoteMachineAuthorizedList="[PROP4]" RemoteUserAuthorizedList="[PROP5]" IPSecSecureFlags="[PROP6]" />
42+
43+
<fw:FirewallException Description="Simple rule with grouping" Name="GroupingExample1" Program="fw.exe" Grouping="@yourresources.dll,-1005" />
44+
<fw:FirewallException Description="Rule with grouping property" Name="GroupingExample2" Port="8732" Grouping="[GROUPING_PROP]" />
45+
46+
<fw:FirewallException Description="Simple ICMP rule" Name="ICMPExample1" Protocol="2" IcmpTypesAndCodes="4:*,9:*,12:*" />
47+
<fw:FirewallException Description="Rule with ICMP property" Name="ICMPExample2" Protocol="2" IcmpTypesAndCodes="[ICMP_PROP]" />
48+
49+
<fw:FirewallException Description="Simple rule with local scope" Name="LocalScopeExample1" Scope="any" LocalScope="localSubnet" />
50+
<fw:FirewallException Description="Rule with local scope property" Name="LocalScopeExample2" Scope="any" LocalScope="[LOCALSCOPE_PROP]" />
51+
52+
<fw:FirewallException Description="Simple rule with remote port" Name="RemotePortExample1" Scope="any" RemotePort="34560" />
53+
<fw:FirewallException Description="Rule with remote port property" Name="RemotePortExample2" Program="fw.exe" RemotePort="[REMOTEPORT_PROP]" />
1954
</Component>
2055
</ComponentGroup>
2156
</Fragment>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!--
2+
This file contains the declaration of all the localizable strings.
3+
-->
4+
<WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US">
5+
6+
<String Id="DowngradeError" Value="A newer version of [ProductName] is already installed." />
7+
<String Id="FeatureTitle" Value="MsiPackage" />
8+
9+
</WixLocalization>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2+
<Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="BB4E61B3-EBE5-4DE7-B3E0-8699B5901D2E">
3+
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
4+
5+
<Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
6+
<ComponentGroupRef Id="ProductComponents" />
7+
</Feature>
8+
</Package>
9+
10+
<Fragment>
11+
<StandardDirectory Id="ProgramFilesFolder">
12+
<Directory Id="INSTALLFOLDER" Name="MsiPackage" />
13+
</StandardDirectory>
14+
</Fragment>
15+
</Wix>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3+
xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall">
4+
<Fragment>
5+
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
6+
<Component Id="FirewallComponent" Guid="28DF3387-F30E-4DBE-90E2-D2C760CB4DD9">
7+
<fw:FirewallException
8+
Name="[NAME]"
9+
Port="[LOCALPORT]"
10+
Protocol="[PROTOCOL]"
11+
Program="[PROGRAM]"
12+
Profile="[PROFILE]"
13+
Description="[DESCRIPTION]"
14+
Scope="[REMOTESCOPE]"
15+
Action="[ACTION]"
16+
EdgeTraversal="[EDGETRAVERSAL]"
17+
Enabled="[ENABLED]"
18+
Grouping="[GROUPING]"
19+
IcmpTypesAndCodes="[ICMPTYPES]"
20+
Interface="[INTERFACE]"
21+
InterfaceType="[INTERFACETYPE]"
22+
LocalScope="[LOCALSCOPE]"
23+
RemotePort="[REMOTEPORT]"
24+
Service="[SERVICE]"
25+
LocalAppPackageId="[PACKAGEID]"
26+
LocalUserAuthorizedList="[LOCALUSERS]"
27+
LocalUserOwner="[LOCALOWNER]"
28+
RemoteMachineAuthorizedList="[REMOTEMACHINES]"
29+
RemoteUserAuthorizedList="[REMOTEUSERS]"
30+
IPSecSecureFlags="[SECUREFLAGS]"
31+
/>
32+
33+
<fw:FirewallException Name="Single Nested properties" >
34+
<fw:RemoteAddress Value="[REMOTEADDRESS]" />
35+
<fw:LocalAddress Value="[LOCALADDRESS]" />
36+
<fw:InterfaceType Value="[INTERFACETYPE]" />
37+
<fw:Interface Name="[INTERFACE]" />
38+
</fw:FirewallException>
39+
40+
<fw:FirewallException Name="Multiple Nested properties" >
41+
<fw:RemoteAddress Value="[REMOTEADDRESS1]" />
42+
<fw:RemoteAddress Value="[REMOTEADDRESS2]" />
43+
<fw:LocalAddress Value="[LOCALADDRESS1]" />
44+
<fw:LocalAddress Value="[LOCALADDRESS2]" />
45+
<fw:InterfaceType Value="[INTERFACETYPE1]" />
46+
<fw:InterfaceType Value="[INTERFACETYPE2]" />
47+
<fw:Interface Name="[INTERFACE1]" />
48+
<fw:Interface Name="[INTERFACE2]" />
49+
</fw:FirewallException>
50+
</Component>
51+
</ComponentGroup>
52+
</Fragment>
53+
</Wix>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is example.txt.

src/ext/Firewall/test/WixToolsetTest.Firewall/WixToolsetTest.Firewall.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<PropertyGroup>
66
<TargetFramework>net6.0</TargetFramework>
77
<IsWixTestProject>true</IsWixTestProject>
8+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
9+
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
810
</PropertyGroup>
911

1012
<ItemGroup>

0 commit comments

Comments
 (0)