Commit graph

15 commits

Author SHA1 Message Date
Trond Hindenes
2be4e15a0a bugfix code error in win_firewall 2016-06-23 08:45:29 +02:00
Andrea Scarpino
9392943915 win_firewall_rule: strictmode fixes (#2432)
I set the default values to `netsh advfirewall firewall add rule` defaults.
2016-06-20 17:35:27 -04:00
Dreamcat4
9bc12dc9dd win-firewall-rule: temp disable strict-mode for the time being 2016-04-20 21:44:29 +01:00
Andrea Scarpino
38cb5c6130 The enable parameter is a boolean, then convert to a boolean. (#1607)
At the moment, this only works when 'enable' is equals to 'yes' or 'no'.

While I'm on it, I also fixed a typo in the example and added a required
parameter.
2016-04-12 14:07:32 +02:00
Andrea Scarpino
a1f53f3a43 Fix issue #1406 about win_firewall_rule
I changed the logic here to always use 'netsh ... show rule' keywords as keys for $fwsettings map. While the translation (e.g. Enabled -> enable) is performed when invoking 'netsh ... add rule' command.

I tested rule creation and rule creation when the rule was already existing on Windows Server 2012.
2016-02-18 17:59:23 +01:00
tcr
263774ea7d Fix #1512 add missing property in win_firewall_rule 2016-01-18 15:27:36 +01:00
Brian Coca
641a347d96 fix error with misArg not being declared
also fixed test to work on empty string or not for error reporting
2015-12-15 09:17:48 -05:00
Dreamcat4
ece9c2b43a fix: Add 'enable:' flag for enabling existing rules which are disabled by default.
This is a very much needed flag. To turn on/off existing firewall rules. And like the recent fix of the 'Profile' key, the netsh cmd prints 'Enabled' in the textual output. (at least on win10 it does). So again a similar small code added for the necessary exception handling when the difference check happens.

Please merge / push upstream like the other fixes. Many thanks. This is the last fix I have put together for this patch set. So I will raise my PR now.

But if you want to fix more bugs, it seems there may be others. In terms of the control code. Sometimes it will delete a rule under 'force' condition (when found difference) - but instead it is supposed to just modify the existing rule. Some weird behaviour regarding that. The other problem is that ansible does not return the error text printed by 'netsh' cmd verbatim... but it should as that makes debugging these errors a *lot* easier.
2015-10-06 14:03:27 +01:00
Dreamcat4
469d22df97 fix: The names of firewall profiles are different on win10 & win2008r2
Hi again. This commit removes a small portion of your script's own internal error checking. In specific: for the value of the profile: key. This is essential to avoid errors on other verisons of the windows operating system which are not win2008r2 (your version).

For example: on win10 (and most likely win8x too), the names of the profiles don't include the values 'current' and 'all'. But instead the values are 'Public' 'Private' 'Domain' and 'Any. But in addition, there are also certain combinatorial values, such as profile=Public,Private etc. Which is too many to error check yourself.

Yet removing the error checking here should not cause any ill effects however: since the netsh advfirewall ... cmds themselves to add / remove / modify actually to their own error checking of the profile=value. So when the cmd is run, it will error out itself with an appropriate / informative error msg. No harm done.

Therefore please remove the highlighed portions from your own script. It is essential for interoperability with win10 and win8x. Many thanks.
2015-10-05 21:53:11 +01:00
Dreamcat4
6c5a4a14ef fix: win10 - Add exception handling for 'Profiles:' textual output key name mismatch.
In win10 (and pribably win8x also):

The output of 'show rule' key includes the line "Profiles:<TAB>Public,Private".
Yet your script expects the key name printed out to be "Profile:<TAB>value".

This commit added the necessary exception handling to avoid flagging 'different=true' under the false circumstance. The key name to SET a firewall rule is still "profile=" and not "profiles=".

There is coming up another commit to fix the value handling for win10/win8. Which is another (different) error with the profile: key.
2015-10-05 21:36:24 +01:00
Dreamcat4
2654789af7 fix: fw rule names must always be quoted, to permit spaces ' ' and brackets '()'
Without this fix, the 'netsh' command gets name=Firewall Rule Name instead of name="Firewall Rule Name". Thus causing all sorts of havoc. Basic shell quoting rules seems to apply to Windows Powershell too. This is very much needed as many of windows 10's default firewall rules contain spaces and brackets () characters.
2015-10-05 21:10:59 +01:00
TimothyVandenbrande
2d6303b368 upon request, added the license 2015-09-23 09:35:17 +02:00
Timothy Vandenbrande
d87da2ba2d renamed profile var 2015-07-02 09:19:08 +02:00
Timothy Vandenbrande
97d8273558 windows default to current instead of all 2015-06-30 08:49:47 +02:00
Timothy Vandenbrande
2a0df8ec04 renamed the module 2015-06-30 08:42:42 +02:00
Renamed from windows/win_fw.ps1 (Browse further)