saltstack/salt — pull request #3594 by toddejohnson (2013-02-05 18:07:30+00:00)
Title: Add iptables salt state module.

This adds a very basic salt state module for iptables. This at least provides a starting point. I also enhanced the iptables salt module to allow lookup of states by comment and execute saves without passing the file to save to.

To use on RHEL6 with the default iptables rules:

tcp-22:
iptables:
- append
- rule: -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
- require_in:
- iptables: /etc/sysconfig/iptables

/etc/sysconfig/iptables:
iptables:
- save

This provides:
* Flexibility to allow the user to specify the command for full complexity
* Uses comments to see if the rule has been added previously
* Only save once after the rules have been processed by using require_in

This should help solve issue https://github.com/saltstack/salt/issues/126