salt icon indicating copy to clipboard operation
salt copied to clipboard

iptables module: Append/Insert doesn't save

Open wschmrdrNS opened this issue 8 years ago • 4 comments

Description of Issue/Question

When running the IPTables state module, despite putting "save: True" in, after rebooting, the IPTables settings do not stay when running "iptables -L".

Setup

ip_drop_input: iptables.set_policy: - chain: INPUT - policy: DROP - save: True

ip_drop_output: iptables.set_policy: - chain: OUTPUT - policy: DROP - save: True

ip_drop_forward: iptables.set_policy: - chain: FORWARD - policy: DROP - save: True

ip_acc_lo_input: iptables.append: - chain: INPUT - jump: ACCEPT - in-interface: lo - save: True

ip_acc_lo_output: iptables.append: - chain: OUTPUT - jump: ACCEPT - out-interface: lo - save: True

ip_drop_lo_input: iptables.append: - chain: INPUT - jump: DROP - source: "127.0.0.0/8" - save: True

ip_acc_tcp_output: iptables.append: - chain: OUTPUT - jump: ACCEPT - proto: tcp - match: state - connstate: NEW,ESTABLISHED - save: True

ip_acc_udp_output: iptables.append: - chain: OUTPUT - jump: ACCEPT - proto: udp - match: state - connstate: NEW,ESTABLISHED - save: True

ip_acc_icmp_output: iptables.append: - chain: OUTPUT - jump: ACCEPT - proto: icmp - match: state - connstate: NEW,ESTABLISHED - save: True

ip_acc_tcp_input: iptables.append: - chain: INPUT - jump: ACCEPT - proto: tcp - match: state - connstate: ESTABLISHED - save: True

ip_acc_udp_input: iptables.append: - chain: INPUT - jump: ACCEPT - proto: udp - match: state - connstate: ESTABLISHED - save: True

ip_acc_icmp_input: iptables.append: - chain: INPUT - jump: ACCEPT - proto: icmp - match: state - connstate: ESTABLISHED - save: True

Steps to Reproduce Issue

Run SLS. Reboot the minion. Run "iptables -L".

Versions Report

Salt Version: Salt: 2017.7.3

Dependency Versions: cffi: 1.5.2 cherrypy: Not Installed dateutil: 2.4.2 docker-py: Not Installed gitdb: 0.6.4 gitpython: 1.0.1 ioflo: Not Installed Jinja2: 2.8 libgit2: 0.26.0 libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.3 msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: Not Installed pycparser: 2.14 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.26.3 Python: 2.7.12 (default, Dec 4 2017, 14:50:18) python-gnupg: 2.2.0 PyYAML: 3.11 PyZMQ: 15.2.0 RAET: Not Installed smmap: 0.9.0 timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4

System Versions: dist: Ubuntu 16.04 xenial locale: UTF-8 machine: x86_64 release: 4.4.0-109-generic system: Linux version: Ubuntu 16.04 xenial

wschmrdrNS avatar Feb 26 '18 18:02 wschmrdrNS

Do you have the iptables-persistent package installed?

This is required for Ubuntu to load saved iptables rules.

Daniel

gtmanfred avatar Feb 26 '18 18:02 gtmanfred

No I didn't; looks like that helped.

Is this something that could be included within the documentation, in case someone else comes across this as being an issue?

wschmrdrNS avatar Feb 26 '18 18:02 wschmrdrNS

Yeah, that seems reasonable, would you mind submitting a PR to add that information?

Probably another note like this one on the 2017.7 branch would be good.

https://github.com/saltstack/salt/blob/2017.7/salt/states/iptables.py#L186

https://docs.saltstack.com/en/latest/topics/development/contributing.html#merge-forward-process

Thanks, Daniel

gtmanfred avatar Feb 26 '18 18:02 gtmanfred

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

stale[bot] avatar Jun 11 '19 19:06 stale[bot]