mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-10 22:55:27 +01:00
Merge pull request #454 from rekup/fix/firewalld
fix firewalld protocol SUMMARY This PR resolves an issue where opening a port (e.g. 25/tcp) resulted in opening all ports for the specified protocol (e.g. tcp) Fixes #451 ISSUE TYPE Bugfix Pull Request COMPONENT NAME ansible.posix.firewalld ADDITIONAL INFORMATION Many thanks to @nerrehmit and every one else who helped troubleshooting this!
This commit is contained in:
commit
202609e425
2 changed files with 10 additions and 6 deletions
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bugfixes:
|
||||
- firewall - Fix issue where opening a specific port resulted in opening the whole protocol of the specified port
|
||||
|
|
@ -856,15 +856,16 @@ def main():
|
|||
zone = module.params['zone']
|
||||
target = module.params['target']
|
||||
|
||||
port = None
|
||||
if module.params['port'] is not None:
|
||||
if '/' in module.params['port']:
|
||||
port, protocol = module.params['port'].strip().split('/')
|
||||
port, port_protocol = module.params['port'].strip().split('/')
|
||||
else:
|
||||
protocol = None
|
||||
if not protocol:
|
||||
port_protocol = None
|
||||
if not port_protocol:
|
||||
module.fail_json(msg='improper port format (missing protocol?)')
|
||||
else:
|
||||
port = None
|
||||
port_protocol = None
|
||||
|
||||
port_forward_toaddr = ''
|
||||
port_forward = None
|
||||
|
|
@ -981,7 +982,7 @@ def main():
|
|||
|
||||
transaction = PortTransaction(
|
||||
module,
|
||||
action_args=(port, protocol, timeout),
|
||||
action_args=(port, port_protocol, timeout),
|
||||
zone=zone,
|
||||
desired_state=desired_state,
|
||||
permanent=permanent,
|
||||
|
|
@ -993,7 +994,7 @@ def main():
|
|||
if changed is True:
|
||||
msgs.append(
|
||||
"Changed port %s to %s" % (
|
||||
"%s/%s" % (port, protocol), desired_state
|
||||
"%s/%s" % (port, port_protocol), desired_state
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue