You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Docker 17.06 and higher through [docker/libnetwork#1675](https://github.com/docker/libnetwork/pull/1675),
137
-
you can add rules to a new table called `DOCKER-USER`, and these rules will be loaded before any rules Docker creates
138
-
automatically. This is useful to make `iptables` rules created by Fail2Ban persistent.
141
+
you can add rules to a new table called `DOCKER-USER`, and these rules will be
142
+
loaded before any rules Docker creates automatically. This is useful to make
143
+
`iptables` rules created by Fail2Ban persistent.
139
144
140
-
If you have an older version of Docker, you may just change the chain definition for your jail to `chain = FORWARD`.
141
-
This way, all Fail2Ban rules come before any Docker rules but these rules will now apply to ALL forwarded traffic.
145
+
If you have an older version of Docker, you may just change the chain
146
+
definition for your jail to `chain = FORWARD`. This way, all Fail2Ban rules
147
+
come before any Docker rules but these rules will now apply to ALL forwarded
148
+
traffic.
142
149
143
150
More info : https://docs.docker.com/network/iptables/
144
151
145
152
### `DOCKER-USER` and `INPUT` chains
146
153
147
-
If your Fail2Ban container is attached to `DOCKER-USER` chain instead of `INPUT`, the rules will be applied
148
-
**only to containers**. This means that any packets coming into the `INPUT` chain will bypass these rules that now
149
-
reside under the `FORWARD` chain.
154
+
If your Fail2Ban container is attached to `DOCKER-USER` chain instead of
155
+
`INPUT`, the rules will be applied **only to containers**. This means that any
156
+
packets coming into the `INPUT` chain will bypass these rules that now reside
157
+
under the `FORWARD` chain.
150
158
151
159
This is why the [sshd](examples/jails/sshd) jail contains a [`chain = INPUT`](examples/jails/sshd/jail.d/sshd.conf)
152
160
in its definition and [traefik](examples/jails/traefik) jail contains
@@ -166,64 +174,67 @@ And others using the `INPUT` chain:
166
174
167
175
### Use iptables tooling without nftables backend
168
176
169
-
As you may know, [nftables](https://wiki.nftables.org) is available as a modern replacement for the kernel's iptables
170
-
subsystem on Linux.
177
+
As you may know, [nftables](https://wiki.nftables.org) is available as a modern
178
+
replacement for the kernel's iptables subsystem on Linux.
171
179
172
-
This image still uses `iptables` to preserve backwards compatibility but
173
-
[an issue is opened](https://github.com/crazy-max/docker-fail2ban/issues/29)about its implementation.
180
+
This image still uses `iptables` to preserve backwards compatibility but[an issue is opened](https://github.com/crazy-max/docker-fail2ban/issues/29)
181
+
about its implementation.
174
182
175
-
If your system's `iptables` tooling uses the nftables backend, this will throw the error
176
-
`stderr: 'iptables: No chain/target/match by that name.'`. You need to switch the `iptables` tooling to 'legacy' mode
177
-
to avoid these problems. This is the case on at least Debian 10 (Buster), Ubuntu 19.04, Fedora 29 and newer releases
178
-
of these distributions by default. RHEL 8 does not support switching to legacy mode, and is therefore currently
179
-
incompatible with this image.
183
+
If your system's `iptables` tooling uses the nftables backend, this will throw
184
+
the error `stderr: 'iptables: No chain/target/match by that name.'`. You need
185
+
to switch the `iptables` tooling to 'legacy' mode to avoid these problems. This
186
+
is the case on at least Debian 10 (Buster), Ubuntu 19.04, Fedora 29 and newer
187
+
releases of these distributions by default. RHEL 8 does not support switching
188
+
to legacy mode, and is therefore currently incompatible with this image.
You can provide customizations in `/data/jail.d/*.local` files.
210
219
211
-
For example to change the default bantime for all jails, send an e-mail with whois report and relevant log lines
212
-
to the destemail:
220
+
For example to change the default bantime for all jails, send an e-mail with
221
+
whois report and relevant log lines to the destemail:
213
222
214
-
```
223
+
```text
215
224
[DEFAULT]
216
225
bantime = 1h
217
226
destemail = root@localhost
218
227
sender = root@$(hostname -f)
219
228
action = %(action_mwl)s
220
229
```
221
230
222
-
> :warning: If you want email to be sent after a ban, you have to configure SSMTP env vars
231
+
> **Warning**
232
+
>
233
+
> If you want email to be sent after a ban, you have to configure SSMTP env vars
223
234
224
235
FYI, here is the order *jail* configuration would be loaded:
225
236
226
-
```
237
+
```text
227
238
jail.conf
228
239
jail.d/*.conf (in alphabetical order)
229
240
jail.local
@@ -234,16 +245,20 @@ A sample configuration file is [available on the official repository](https://gi
234
245
235
246
### Custom jails, actions and filters
236
247
237
-
Custom jails, actions and filters can be added respectively in `/data/jail.d`, `/data/action.d` and `/data/filter.d`.
238
-
If you add an action/filter that already exists, it will be overriden.
248
+
Custom jails, actions and filters can be added respectively in `/data/jail.d`,
249
+
`/data/action.d` and `/data/filter.d`. If you add an action/filter that already
250
+
exists, it will be overriden.
239
251
240
-
> :warning: Container has to be restarted to propagate changes
252
+
> **Warning**
253
+
>
254
+
> Container has to be restarted to propagate changes
241
255
242
256
## Contributing
243
257
244
-
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You
245
-
can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) or by making
246
-
a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely!
258
+
Want to contribute? Awesome! The most basic way to show your support is to star
259
+
the project, or to raise issues. You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max)
260
+
or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this
261
+
journey continues indefinitely!
247
262
248
263
Thanks again for your support, it is much appreciated! :pray:
0 commit comments