saltstack / saltstack/salt

[BUG] win_firewall.add_rule localport parameter needs to be optional

Open
#60,603 0 comments 0 reactions 2 assignees View on GitHub

@xeacott is already working on this.

Since Jul 22, 2021.

bug Confirmed State-Module Windows
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
trying to set a win_firewall state with protocol: any, localport: any:

attempt 1

allow_myservice:
  win_firewall.add_rule:
    - name: myservice
    - dir: in
    - protocol: any
    - remoteip: "192.168.100.100"
    - action: allow

result 1
error about localport parameter being required
this seems to be a requirement just in salt, but the underlying netsh command accepts protocol: any, without the localport parameter

attempt 2

allow_myservice:
  win_firewall.add_rule:
    - name: myservice
    - dir: in
    - protocol: any
    - localport: 0-65535
    - remoteip: "192.168.100.100"
    - action: allow

result 2
error about localport parameter only being allowed if the protocol is TCP or UDP

attempt 3

allow_myservice:
  win_firewall.add_rule:
    - name: myservice
    - dir: in
    - localport: any
    - remoteip: "192.168.100.100"
    - action: allow

result 3
by omitting protocol, it sets protocol to TCP

localport parameter requirement also causes issues when you want to allow just a protocol like icmpv4.

Setup
3003.1 saltmaster/saltminion

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.