You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ID: domain_firewall_state
Function: lgpo.set
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\state.py", line 2440, in call
ret = self.states[cdata["full"]](
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 159, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 1245, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as
ret = _func_or_method(*args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 1296, in wrapper
return f(*args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\states\win_lgpo.py", line 422, in set_
current_policy[class_map[p_class]][p_name] = __salt__[
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 159, in __call__
ret = self.loader.run(run_func, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 1245, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\loader\lazy.py", line 1260, in _run_as
ret = _func_or_method(*args, **kwargs)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\modules\win_lgpo.py", line 9758, in get_policy
return _get_policy_info_setting(policy_definition)
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\modules\win_lgpo.py", line 8940, in _get_policy_info_setting
value = _get_netsh_value(
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\modules\win_lgpo.py", line 5703, in _get_netsh_value
settings = salt.utils.win_lgpo_netsh.get_all_settings(
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\utils\win_lgpo_netsh.py", line 324, in get_all_settings
"Inbound": _get_inbound_text(
File "C:\Program Files\Salt Project\Salt\Lib\site-packages\salt\utils\win_lgpo_netsh.py", line 133, in _get_inbound_text
return settings[rule][action]
KeyError: 1
Important is, that on this minion, the GPO AllowInboundRules is set to True (1):
But _get_inbound_text expects AllowInboundRules to be either False (0) or NotConfigured (2). Though it treats NotConfigured like how True should be treated, if I understand the logic correctly.
The "Inbound connections" setting is a combination of 2 parameters:
- AllowInboundRules
- DefaultInboundAction
The settings are as follows:
Rules Action
2 2 AllowInbound
2 4 BlockInbound
0 4 BlockInboundAlways
2 0 NotConfigured
"""
settings= {
0: {
4: "BlockInboundAlways",
},
2: {
0: "NotConfigured",
2: "AllowInbound",
4: "BlockInbound",
},
}
returnsettings[rule][action]
While it would be simple add that case to _get_inbound_text, it is probably necessary to consider _get_inbound_settings as well, which is used for applying changes:
Description
After updating a windows minion update to 3006.9, a lgpo.set state lead to a KeyError exception.
This is related to #344a3d8 (Use Powershell instead of netsh for firewall settings).
Example:
Important is, that on this minion, the GPO
AllowInboundRules
is set toTrue (1)
:But
_get_inbound_text
expectsAllowInboundRules
to be eitherFalse (0)
orNotConfigured (2)
. Though it treatsNotConfigured
like howTrue
should be treated, if I understand the logic correctly.salt/salt/utils/win_lgpo_netsh.py
Lines 108 to 133 in 9e82700
While it would be simple add that case to
_get_inbound_text
, it is probably necessary to consider_get_inbound_settings
as well, which is used for applying changes:salt/salt/utils/win_lgpo_netsh.py
Lines 136 to 143 in 9e82700
It is probably not desirable to simple overwrite
AllowInboundRules
fromTrue
toNotConfigured
or vice versa...@twangboy As the mentioned commit is from you, do you have any idea how to solve this properly?
Would be great if it can be fixed in 3006.10.
Setup
Versions Report
salt --versions-report
The text was updated successfully, but these errors were encountered: