Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 1 | ===================== |
| 2 | iptables salt formula |
| 3 | ===================== |
Filip Pytloun | ab43e7b | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 4 | |
Filip Pytloun | 6006256 | 2016-07-27 14:41:15 +0200 | [diff] [blame] | 5 | Iptables is used to set up, maintain, and inspect the tables of IPv4 packet |
| 6 | filter rules in the Linux kernel. Several different tables may be defined. |
| 7 | Each table contains a number of built-in chains and may also contain |
| 8 | user-defined chains. Each chain is a list of rules which can match a set of |
| 9 | packets. Each rule specifies what to do with a packet that matches. This is |
| 10 | called a `target`, which may be a jump to a user-defined chain in the same |
| 11 | table. |
Filip Pytloun | ab43e7b | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 12 | |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 13 | This version of a formula guarantees that manually added rules or rules which |
| 14 | has been added in runtime would be removed. |
| 15 | |
| 16 | In order to ensure architecture, proper epoch value should be specified. |
| 17 | Refer to an example. |
| 18 | |
Filip Pytloun | ab43e7b | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 19 | Sample pillars |
| 20 | ============== |
| 21 | |
Filip Pytloun | ab43e7b | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 22 | .. code-block:: yaml |
| 23 | |
Nitin Madhok | 574663a | 2017-03-28 10:08:26 -0400 | [diff] [blame] | 24 | parameters: |
Filip Pytloun | 6006256 | 2016-07-27 14:41:15 +0200 | [diff] [blame] | 25 | iptables: |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 26 | schema: |
| 27 | epoch: 1 |
Filip Pytloun | 6006256 | 2016-07-27 14:41:15 +0200 | [diff] [blame] | 28 | service: |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 29 | v4: |
| 30 | enabled: true |
Dzmitry Stremkouski | 1ca901c | 2018-11-05 13:20:52 +0100 | [diff] [blame] | 31 | persistent_config: /etc/iptables/rules.v4 |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 32 | modules: |
| 33 | - nf_conntrack_ftp |
| 34 | - nf_conntrack_pptp |
| 35 | v6: |
| 36 | enabled: false |
Dzmitry Stremkouski | 1ca901c | 2018-11-05 13:20:52 +0100 | [diff] [blame] | 37 | persistent_config: /etc/iptables/rules.v6 |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 38 | modules: |
| 39 | - nf_conntrack_ipv6 |
| 40 | defaults: |
| 41 | v4: |
| 42 | metadata_rules: false |
| 43 | policy: ACCEPT |
| 44 | ruleset: |
| 45 | action: ACCEPT |
| 46 | params: "" |
| 47 | rule: "" |
| 48 | v6: |
| 49 | metadata_rules: false |
| 50 | policy: DROP |
| 51 | ruleset: |
| 52 | action: ACCEPT |
| 53 | params: "" |
| 54 | rule: "" |
| 55 | tables: |
| 56 | v4: |
| 57 | filter: |
| 58 | chains: |
| 59 | INPUT: |
| 60 | ruleset: |
| 61 | 5: |
| 62 | action: log_drop |
| 63 | 10: |
| 64 | rule: -s 192.168.0.0/24 -p tcp |
| 65 | log_drop: |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 66 | ruleset: |
| 67 | 10: |
| 68 | action: LOG |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 69 | nat: |
| 70 | chains: |
Dzmitry Stremkouski | 1ca901c | 2018-11-05 13:20:52 +0100 | [diff] [blame] | 71 | OUTPUT: {} |
| 72 | PREROUTING: {} |
Dzmitry Stremkouski | e353ce3 | 2018-08-30 17:22:32 +0200 | [diff] [blame] | 73 | POSTROUTING: |
| 74 | policy: ACCEPT |
| 75 | ruleset: |
| 76 | 10: |
| 77 | rule: -s 192.168.0.0/24 -p tcp -o lo |
| 78 | action: SNAT |
| 79 | params: --to-source=127.0.0.1 |
Filip Pytloun | 6006256 | 2016-07-27 14:41:15 +0200 | [diff] [blame] | 80 | |
Dzmitry Stremkouski | 1a1e8c7 | 2018-03-07 00:51:45 +0100 | [diff] [blame] | 81 | |
Filip Pytloun | ab43e7b | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 82 | Read more |
| 83 | ========= |
| 84 | |
| 85 | * http://docs.saltstack.com/en/latest/ref/states/all/salt.states.iptables.html |
| 86 | * https://help.ubuntu.com/community/IptablesHowTo |
| 87 | * http://wiki.centos.org/HowTos/Network/IPTables |
Filip Pytloun | b817b35 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 88 | |
| 89 | Documentation and Bugs |
| 90 | ====================== |
| 91 | |
| 92 | To learn how to install and update salt-formulas, consult the documentation |
| 93 | available online at: |
| 94 | |
| 95 | http://salt-formulas.readthedocs.io/ |
| 96 | |
| 97 | In the unfortunate event that bugs are discovered, they should be reported to |
| 98 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 99 | formula: |
| 100 | |
| 101 | https://github.com/salt-formulas/salt-formula-iptables/issues |
| 102 | |
Filip Pytloun | b817b35 | 2017-02-02 13:02:03 +0100 | [diff] [blame] | 103 | |
| 104 | Developers wishing to work on the salt-formulas projects should always base |
| 105 | their work on master branch and submit pull request against specific formula. |
| 106 | |
| 107 | https://github.com/salt-formulas/salt-formula-iptables |
| 108 | |