blob: 50242930f6c698366b02719470b38cabcdbfbda7 [file] [log] [blame]
Filip Pytlounab43e7b2015-10-06 16:28:32 +02001
2================
3iptables formula
4================
5
Filip Pytloun60062562016-07-27 14:41:15 +02006Iptables is used to set up, maintain, and inspect the tables of IPv4 packet
7filter rules in the Linux kernel. Several different tables may be defined.
8Each table contains a number of built-in chains and may also contain
9user-defined chains. Each chain is a list of rules which can match a set of
10packets. Each rule specifies what to do with a packet that matches. This is
11called a `target`, which may be a jump to a user-defined chain in the same
12table.
Filip Pytlounab43e7b2015-10-06 16:28:32 +020013
14Sample pillars
15==============
16
Filip Pytloun60062562016-07-27 14:41:15 +020017Most common rules - allow traffic on localhost, accept related,established and
18ping
Filip Pytlounab43e7b2015-10-06 16:28:32 +020019
20.. code-block:: yaml
21
Filip Pytloun60062562016-07-27 14:41:15 +020022 parametetrs:
23 iptables:
24 service:
Dennis van Dok3bee76d2017-02-07 15:22:23 +010025 enabled: True
Filip Pytlounab43e7b2015-10-06 16:28:32 +020026 chain:
27 INPUT:
Filip Pytloun60062562016-07-27 14:41:15 +020028 rules:
29 - in_interface: lo
Filip Pytlounab43e7b2015-10-06 16:28:32 +020030 jump: ACCEPT
Filip Pytloun60062562016-07-27 14:41:15 +020031 - connection_state: RELATED,ESTABLISHED
Filip Pytlounab43e7b2015-10-06 16:28:32 +020032 match: state
Filip Pytloun60062562016-07-27 14:41:15 +020033 jump: ACCEPT
34 - protocol: icmp
35 jump: ACCEPT
36
37Accept connections on port 22
38
39.. code-block:: yaml
40
41 parametetrs:
42 iptables:
43 service:
44 chain:
45 INPUT:
46 rules:
47 - destination_port: 22
Filip Pytlounab43e7b2015-10-06 16:28:32 +020048 protocol: tcp
Filip Pytloun60062562016-07-27 14:41:15 +020049 jump: ACCEPT
50
51Set drop policy on INPUT chain:
52
53.. code-block:: yaml
54
55 parametetrs:
56 iptables:
57 service:
58 chain:
59 INPUT:
60 policy: DROP
61
62Redirect privileged port 443 to 8081
63
64.. code-block:: yaml
65
66 parameters:
67 iptables:
68 service:
69 chain:
70 PREROUTING:
71 filter: nat
72 destination_port: 443
73 to_port: 8081
74 protocol: tcp
75 jump: REDIRECT
76
77Allow access from local network
78
79.. code-block:: yaml
80
81 parameters:
82 iptables:
83 service:
84 chain:
85 INPUT:
86 rules:
87 - protocol: tcp
88 destination_port: 22
89 source_network: 192.168.1.0/24
90 jump: ACCEPT
Filip Pytlounab43e7b2015-10-06 16:28:32 +020091
Dennis van Dok3bee76d2017-02-07 15:22:23 +010092IPv6 is supported as well
93
94.. code-block:: yaml
95
96 parameters:
97 iptables:
98 service:
99 enabled: True
100 ipv6: True
101 chain:
102 INPUT:
103 rules:
104 - protocol: tcp
105 family: ipv6
106 destination_port: 22
107 source_network: 2001:DB8::/32
108 jump: ACCEPT
109
Filip Pytlounab43e7b2015-10-06 16:28:32 +0200110Read more
111=========
112
113* http://docs.saltstack.com/en/latest/ref/states/all/salt.states.iptables.html
114* https://help.ubuntu.com/community/IptablesHowTo
115* http://wiki.centos.org/HowTos/Network/IPTables
Filip Pytlounb817b352017-02-02 13:02:03 +0100116
117Documentation and Bugs
118======================
119
120To learn how to install and update salt-formulas, consult the documentation
121available online at:
122
123 http://salt-formulas.readthedocs.io/
124
125In the unfortunate event that bugs are discovered, they should be reported to
126the appropriate issue tracker. Use Github issue tracker for specific salt
127formula:
128
129 https://github.com/salt-formulas/salt-formula-iptables/issues
130
131For feature requests, bug reports or blueprints affecting entire ecosystem,
132use Launchpad salt-formulas project:
133
134 https://launchpad.net/salt-formulas
135
136You can also join salt-formulas-users team and subscribe to mailing list:
137
138 https://launchpad.net/~salt-formulas-users
139
140Developers wishing to work on the salt-formulas projects should always base
141their work on master branch and submit pull request against specific formula.
142
143 https://github.com/salt-formulas/salt-formula-iptables
144
145Any questions or feedback is always welcome so feel free to join our IRC
146channel:
147
148 #salt-formulas @ irc.freenode.net