diff options
| author | chris_bednarski <Chris.Bednarski@minfos.com.au> | 2023-08-26 18:51:38 +1000 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2023-11-19 12:17:13 -0500 |
| commit | 80e604761b4f43b9b79a4878fcae360b071a7c35 (patch) | |
| tree | 9ca40a1d60a2ef1a5a1a426382356ae8b7cf9868 /src/test | |
| parent | 6e974490eeabc9a3728aa2fb9ad07e8a5adf4fb6 (diff) | |
| download | wix-80e604761b4f43b9b79a4878fcae360b071a7c35.tar.gz wix-80e604761b4f43b9b79a4878fcae360b071a7c35.tar.bz2 wix-80e604761b4f43b9b79a4878fcae360b071a7c35.zip | |
change firewall extension table name to Wix5FirewallException
Diffstat (limited to 'src/test')
5 files changed, 299 insertions, 0 deletions
diff --git a/src/test/msi/TestData/FirewallExtensionTests/ProtocolRules/ProtocolRules.wixproj b/src/test/msi/TestData/FirewallExtensionTests/ProtocolRules/ProtocolRules.wixproj new file mode 100644 index 00000000..b1770b0f --- /dev/null +++ b/src/test/msi/TestData/FirewallExtensionTests/ProtocolRules/ProtocolRules.wixproj | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 2 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <UpgradeCode>{4D188568-1CCF-4EEE-BC27-17C3DCC83E58}</UpgradeCode> | ||
| 5 | <ProductComponentsRef>true</ProductComponentsRef> | ||
| 6 | </PropertyGroup> | ||
| 7 | <ItemGroup> | ||
| 8 | <Compile Include="..\..\Templates\Product.wxs" Link="Product.wxs" /> | ||
| 9 | </ItemGroup> | ||
| 10 | <ItemGroup> | ||
| 11 | <PackageReference Include="WixToolset.Firewall.wixext" /> | ||
| 12 | </ItemGroup> | ||
| 13 | </Project> \ No newline at end of file | ||
diff --git a/src/test/msi/TestData/FirewallExtensionTests/ProtocolRules/product.wxs b/src/test/msi/TestData/FirewallExtensionTests/ProtocolRules/product.wxs new file mode 100644 index 00000000..6a28ad0a --- /dev/null +++ b/src/test/msi/TestData/FirewallExtensionTests/ProtocolRules/product.wxs | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 2 | |||
| 3 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall"> | ||
| 4 | <Fragment> | ||
| 5 | <ComponentGroup Id="ProductComponents"> | ||
| 6 | <ComponentRef Id="FirewallComponent1"/> | ||
| 7 | </ComponentGroup> | ||
| 8 | </Fragment> | ||
| 9 | |||
| 10 | <Fragment> | ||
| 11 | <Component Id="FirewallComponent1" Guid="E465C8FE-5B81-4553-9CFC-E0CD96B9A36C" Directory="INSTALLFOLDER"> | ||
| 12 | <fw:FirewallException Id="FirewallException09" | ||
| 13 | Description="WiX Toolset firewall exception rule integration test - protocol TCP" | ||
| 14 | Name="WiXToolset401 Test - 0009" Protocol="tcp" Port="900" Scope="any" /> | ||
| 15 | <fw:FirewallException Id="FirewallException10" | ||
| 16 | Description="WiX Toolset firewall exception rule integration test - protocol UDP" | ||
| 17 | Name="WiXToolset401 Test - 0010" Protocol="udp" Port="1000" Scope="any" /> | ||
| 18 | <fw:FirewallException Id="FirewallException11" | ||
| 19 | Description="WiX Toolset firewall exception rule integration test - ports can only be specified if protocol is TCP or UDP" | ||
| 20 | Name="WiXToolset401 Test - 0011" Protocol="134" Program="test.exe" Scope="any" /> | ||
| 21 | </Component> | ||
| 22 | </Fragment> | ||
| 23 | </Wix> | ||
diff --git a/src/test/msi/TestData/FirewallExtensionTests/ScopeRules/ScopeRules.wixproj b/src/test/msi/TestData/FirewallExtensionTests/ScopeRules/ScopeRules.wixproj new file mode 100644 index 00000000..b1770b0f --- /dev/null +++ b/src/test/msi/TestData/FirewallExtensionTests/ScopeRules/ScopeRules.wixproj | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 2 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <PropertyGroup> | ||
| 4 | <UpgradeCode>{4D188568-1CCF-4EEE-BC27-17C3DCC83E58}</UpgradeCode> | ||
| 5 | <ProductComponentsRef>true</ProductComponentsRef> | ||
| 6 | </PropertyGroup> | ||
| 7 | <ItemGroup> | ||
| 8 | <Compile Include="..\..\Templates\Product.wxs" Link="Product.wxs" /> | ||
| 9 | </ItemGroup> | ||
| 10 | <ItemGroup> | ||
| 11 | <PackageReference Include="WixToolset.Firewall.wixext" /> | ||
| 12 | </ItemGroup> | ||
| 13 | </Project> \ No newline at end of file | ||
diff --git a/src/test/msi/TestData/FirewallExtensionTests/ScopeRules/product.wxs b/src/test/msi/TestData/FirewallExtensionTests/ScopeRules/product.wxs new file mode 100644 index 00000000..776c8675 --- /dev/null +++ b/src/test/msi/TestData/FirewallExtensionTests/ScopeRules/product.wxs | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
| 2 | |||
| 3 | |||
| 4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:fw="http://wixtoolset.org/schemas/v4/wxs/firewall"> | ||
| 5 | <Fragment> | ||
| 6 | <ComponentGroup Id="ProductComponents"> | ||
| 7 | <ComponentRef Id="FirewallComponent1"/> | ||
| 8 | </ComponentGroup> | ||
| 9 | </Fragment> | ||
| 10 | |||
| 11 | <Fragment> | ||
| 12 | <Component Id="FirewallComponent1" Guid="515AEDF0-A656-4006-8CE5-848ECCC680BD" Directory="INSTALLFOLDER"> | ||
| 13 | <fw:FirewallException Id="FirewallException12" | ||
| 14 | Description="WiX Toolset firewall exception rule integration test - scope any" | ||
| 15 | Name="WiXToolset401 Test - 0012" Scope="any" Port="1200" /> | ||
| 16 | <fw:FirewallException Id="FirewallException13" | ||
| 17 | Description="WiX Toolset firewall exception rule integration test - scope local subnet" | ||
| 18 | Name="WiXToolset401 Test - 0013" Scope="localSubnet" Port="1300" /> | ||
| 19 | <fw:FirewallException Id="FirewallException14" | ||
| 20 | Description="WiX Toolset firewall exception rule integration test - scope DNS" | ||
| 21 | Name="WiXToolset401 Test - 0014" Scope="DNS" Port="1400" /> | ||
| 22 | <fw:FirewallException Id="FirewallException15" | ||
| 23 | Description="WiX Toolset firewall exception rule integration test - scope DHCP" | ||
| 24 | Name="WiXToolset401 Test - 0015" Scope="DHCP" Port="1500" /> | ||
| 25 | <fw:FirewallException Id="FirewallException16" | ||
| 26 | Description="WiX Toolset firewall exception rule integration test - scope WINS" | ||
| 27 | Name="WiXToolset401 Test - 0016" Scope="WINS" Port="1600" /> | ||
| 28 | <fw:FirewallException Id="FirewallException17" | ||
| 29 | Description="WiX Toolset firewall exception rule integration test - scope default gateway" | ||
| 30 | Name="WiXToolset401 Test - 0017" Scope="defaultGateway" Port="1700" /> | ||
| 31 | </Component> | ||
| 32 | </Fragment> | ||
| 33 | </Wix> | ||
diff --git a/src/test/msi/WixToolsetTest.MsiE2E/FirewallExtensionTests.cs b/src/test/msi/WixToolsetTest.MsiE2E/FirewallExtensionTests.cs index 4106cd72..ce55aa14 100644 --- a/src/test/msi/WixToolsetTest.MsiE2E/FirewallExtensionTests.cs +++ b/src/test/msi/WixToolsetTest.MsiE2E/FirewallExtensionTests.cs | |||
| @@ -315,5 +315,222 @@ namespace WixToolsetTest.MsiE2E | |||
| 315 | var log2 = product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, "NORULENAME=1"); | 315 | var log2 = product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS, "NORULENAME=1"); |
| 316 | Assert.True(LogVerifier.MessageInLogFile(log2, "failed to remove firewall rule")); | 316 | Assert.True(LogVerifier.MessageInLogFile(log2, "failed to remove firewall rule")); |
| 317 | } | 317 | } |
| 318 | |||
| 319 | [RuntimeFact] | ||
| 320 | public void VarietyOfProtocolValuesCanBeUsed() | ||
| 321 | { | ||
| 322 | var product = this.CreatePackageInstaller("ProtocolRules"); | ||
| 323 | product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
| 324 | |||
| 325 | var expected1 = new RuleDetails("WiXToolset401 Test - 0009") | ||
| 326 | { | ||
| 327 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 328 | Description = "WiX Toolset firewall exception rule integration test - protocol TCP", | ||
| 329 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 330 | EdgeTraversal = false, | ||
| 331 | EdgeTraversalOptions = 0, | ||
| 332 | Enabled = true, | ||
| 333 | InterfaceTypes = "All", | ||
| 334 | LocalAddresses = "*", | ||
| 335 | Profiles = Int32.MaxValue, | ||
| 336 | Protocol = 6, | ||
| 337 | RemoteAddresses = "*", | ||
| 338 | SecureFlags = 0, | ||
| 339 | LocalPorts = "900", | ||
| 340 | RemotePorts = "*", | ||
| 341 | }; | ||
| 342 | |||
| 343 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0009", expected1); | ||
| 344 | |||
| 345 | |||
| 346 | var expected2 = new RuleDetails("WiXToolset401 Test - 0010") | ||
| 347 | { | ||
| 348 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 349 | Description = "WiX Toolset firewall exception rule integration test - protocol UDP", | ||
| 350 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 351 | EdgeTraversal = false, | ||
| 352 | EdgeTraversalOptions = 0, | ||
| 353 | Enabled = true, | ||
| 354 | InterfaceTypes = "All", | ||
| 355 | LocalAddresses = "*", | ||
| 356 | Profiles = Int32.MaxValue, | ||
| 357 | Protocol = 17, | ||
| 358 | RemoteAddresses = "*", | ||
| 359 | SecureFlags = 0, | ||
| 360 | LocalPorts = "1000", | ||
| 361 | RemotePorts = "*", | ||
| 362 | }; | ||
| 363 | |||
| 364 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0010", expected2); | ||
| 365 | |||
| 366 | |||
| 367 | var expected3 = new RuleDetails("WiXToolset401 Test - 0011") | ||
| 368 | { | ||
| 369 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 370 | ApplicationName = "test.exe", | ||
| 371 | Description = "WiX Toolset firewall exception rule integration test - ports can only be specified if protocol is TCP or UDP", | ||
| 372 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 373 | EdgeTraversal = true, | ||
| 374 | EdgeTraversalOptions = 1, | ||
| 375 | Enabled = true, | ||
| 376 | InterfaceTypes = "All", | ||
| 377 | LocalAddresses = "*", | ||
| 378 | Profiles = Int32.MaxValue, | ||
| 379 | Protocol = 134, | ||
| 380 | RemoteAddresses = "*", | ||
| 381 | SecureFlags = 0, | ||
| 382 | }; | ||
| 383 | |||
| 384 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0011", expected3); | ||
| 385 | |||
| 386 | product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
| 387 | |||
| 388 | // verify the firewall exceptions have been removed. | ||
| 389 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0009")); | ||
| 390 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0010")); | ||
| 391 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0011")); | ||
| 392 | } | ||
| 393 | |||
| 394 | [RuntimeFact] | ||
| 395 | public void FullSetOfScopeValuesCanBeUsed() | ||
| 396 | { | ||
| 397 | var product = this.CreatePackageInstaller("ScopeRules"); | ||
| 398 | product.InstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
| 399 | |||
| 400 | var expected1 = new RuleDetails("WiXToolset401 Test - 0012") | ||
| 401 | { | ||
| 402 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 403 | Description = "WiX Toolset firewall exception rule integration test - scope any", | ||
| 404 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 405 | EdgeTraversal = false, | ||
| 406 | EdgeTraversalOptions = 0, | ||
| 407 | Enabled = true, | ||
| 408 | InterfaceTypes = "All", | ||
| 409 | LocalAddresses = "*", | ||
| 410 | Profiles = Int32.MaxValue, | ||
| 411 | Protocol = 6, | ||
| 412 | RemoteAddresses = "*", | ||
| 413 | SecureFlags = 0, | ||
| 414 | LocalPorts = "1200", | ||
| 415 | RemotePorts = "*", | ||
| 416 | }; | ||
| 417 | |||
| 418 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0012", expected1); | ||
| 419 | |||
| 420 | |||
| 421 | var expected2 = new RuleDetails("WiXToolset401 Test - 0013") | ||
| 422 | { | ||
| 423 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 424 | Description = "WiX Toolset firewall exception rule integration test - scope local subnet", | ||
| 425 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 426 | EdgeTraversal = false, | ||
| 427 | EdgeTraversalOptions = 0, | ||
| 428 | Enabled = true, | ||
| 429 | InterfaceTypes = "All", | ||
| 430 | LocalAddresses = "*", | ||
| 431 | Profiles = Int32.MaxValue, | ||
| 432 | Protocol = 6, | ||
| 433 | RemoteAddresses = "LocalSubnet", | ||
| 434 | SecureFlags = 0, | ||
| 435 | LocalPorts = "1300", | ||
| 436 | RemotePorts = "*", | ||
| 437 | }; | ||
| 438 | |||
| 439 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0013", expected2); | ||
| 440 | |||
| 441 | |||
| 442 | var expected3 = new RuleDetails("WiXToolset401 Test - 0014") | ||
| 443 | { | ||
| 444 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 445 | Description = "WiX Toolset firewall exception rule integration test - scope DNS", | ||
| 446 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 447 | EdgeTraversal = false, | ||
| 448 | EdgeTraversalOptions = 0, | ||
| 449 | Enabled = true, | ||
| 450 | InterfaceTypes = "All", | ||
| 451 | LocalAddresses = "*", | ||
| 452 | Profiles = Int32.MaxValue, | ||
| 453 | Protocol = 6, | ||
| 454 | RemoteAddresses = "DNS", | ||
| 455 | SecureFlags = 0, | ||
| 456 | LocalPorts = "1400", | ||
| 457 | RemotePorts = "*", | ||
| 458 | }; | ||
| 459 | |||
| 460 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0014", expected3); | ||
| 461 | |||
| 462 | |||
| 463 | var expected4 = new RuleDetails("WiXToolset401 Test - 0015") | ||
| 464 | { | ||
| 465 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 466 | Description = "WiX Toolset firewall exception rule integration test - scope DHCP", | ||
| 467 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 468 | EdgeTraversal = false, | ||
| 469 | EdgeTraversalOptions = 0, | ||
| 470 | Enabled = true, | ||
| 471 | InterfaceTypes = "All", | ||
| 472 | LocalAddresses = "*", | ||
| 473 | Profiles = Int32.MaxValue, | ||
| 474 | Protocol = 6, | ||
| 475 | RemoteAddresses = "DHCP", | ||
| 476 | SecureFlags = 0, | ||
| 477 | LocalPorts = "1500", | ||
| 478 | RemotePorts = "*", | ||
| 479 | }; | ||
| 480 | |||
| 481 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0015", expected4); | ||
| 482 | |||
| 483 | |||
| 484 | var expected5 = new RuleDetails("WiXToolset401 Test - 0016") | ||
| 485 | { | ||
| 486 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 487 | Description = "WiX Toolset firewall exception rule integration test - scope WINS", | ||
| 488 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 489 | EdgeTraversal = false, | ||
| 490 | EdgeTraversalOptions = 0, | ||
| 491 | Enabled = true, | ||
| 492 | InterfaceTypes = "All", | ||
| 493 | LocalAddresses = "*", | ||
| 494 | Profiles = Int32.MaxValue, | ||
| 495 | Protocol = 6, | ||
| 496 | RemoteAddresses = "WINS", | ||
| 497 | SecureFlags = 0, | ||
| 498 | LocalPorts = "1600", | ||
| 499 | RemotePorts = "*", | ||
| 500 | }; | ||
| 501 | |||
| 502 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0016", expected5); | ||
| 503 | |||
| 504 | |||
| 505 | var expected6 = new RuleDetails("WiXToolset401 Test - 0017") | ||
| 506 | { | ||
| 507 | Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW, | ||
| 508 | Description = "WiX Toolset firewall exception rule integration test - scope default gateway", | ||
| 509 | Direction = NET_FW_RULE_DIRECTION_.NET_FW_RULE_DIR_IN, | ||
| 510 | EdgeTraversal = false, | ||
| 511 | EdgeTraversalOptions = 0, | ||
| 512 | Enabled = true, | ||
| 513 | InterfaceTypes = "All", | ||
| 514 | LocalAddresses = "*", | ||
| 515 | Profiles = Int32.MaxValue, | ||
| 516 | Protocol = 6, | ||
| 517 | RemoteAddresses = "DefaultGateway", | ||
| 518 | SecureFlags = 0, | ||
| 519 | LocalPorts = "1700", | ||
| 520 | RemotePorts = "*", | ||
| 521 | }; | ||
| 522 | |||
| 523 | Verifier.VerifyFirewallRule("WiXToolset401 Test - 0017", expected6); | ||
| 524 | |||
| 525 | product.UninstallProduct(MSIExec.MSIExecReturnCode.SUCCESS); | ||
| 526 | |||
| 527 | // verify the firewall exceptions have been removed. | ||
| 528 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0012")); | ||
| 529 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0013")); | ||
| 530 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0014")); | ||
| 531 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0015")); | ||
| 532 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0016")); | ||
| 533 | Assert.False(Verifier.FirewallRuleExists("WiXToolset401 Test - 0017")); | ||
| 534 | } | ||
| 318 | } | 535 | } |
| 319 | } | 536 | } |
