chef-boneyard / windows_firewall

Chef cookbook to configure Windows Firewall
Apache License 2.0
6 stars 9 forks source link

windows_firewall_rule no longer handles comma lists for remote address flag correctly #37

Open Ryuzavi opened 5 years ago

Ryuzavi commented 5 years ago

Cookbook version

5.0.1

Chef-client version

14.0.202

Platform Details

Windows Server 2016

Scenario:

Define a Windows Firewall rule for mulitple remote addresses, e.g. 127.0.0.1 and 127.0.1.1.

Steps to Reproduce:

Before the 5.0.0 update we were able to define multiple remote addresses in a comma delimited list, e.g. '127.0.0.1,127.0.1.1'. This now fails with the below error.

This is essentially the same as this issue for the local port flag. The list is being passed in single quotes, which Windows \ Powershell doesn't expect so it fails. If you pass the list without the quotes the command works as expected, e.g. -RemoteAddress 127.0.0.1,127.0.1.1.

Expected Result:

Able to define Windows Firewall rules for remote address lists instead of duplicating them for each address individually.

Actual Result:

STDERR: New-NetFirewallRule : The address is invalid.  Addresses may be specified as IP addresses, ranges, or subnets.  Also, the following address keywords are allowed in certain places: LocalSubnet, DNS, DHCP, WINS, DefaultGateway, Internet, Intranet, IntranetRemoteAccess, PlayToDevice.  Keywords can be restricted to IPv4 or IPv6 by appending a 4 or 6.