File tree 1 file changed +19
-3
lines changed
1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ on a bad authentication:
26
26
2018/04/26 18:15:54 [I] Failed authentication attempt for user from xxx.xxx.xxx.xxx
27
27
```
28
28
29
- So we set our filter in ` /etc/fail2ban/filter.d/gitea.conf ` :
29
+ Add our filter in ` /etc/fail2ban/filter.d/gitea.conf ` :
30
30
31
31
``` ini
32
32
# gitea.conf
@@ -35,12 +35,11 @@ failregex = .*Failed authentication attempt for .* from <HOST>
35
35
ignoreregex =
36
36
```
37
37
38
- And configure it in ` /etc/fail2ban/jail.d/jail.local ` :
38
+ Add our jail in ` /etc/fail2ban/jail.d/gitea.conf ` :
39
39
40
40
``` ini
41
41
[gitea]
42
42
enabled = true
43
- port = http,https
44
43
filter = gitea
45
44
logpath = /home/git/gitea/log/gitea.log
46
45
maxretry = 10
@@ -49,6 +48,23 @@ bantime = 900
49
48
action = iptables-allports
50
49
```
51
50
51
+ If you're using Docker, you'll also need to add an additional jail to handle the ** FORWARD**
52
+ chain in ** iptables** . Configure it in ` /etc/fail2ban/jail.d/gitea-docker.conf ` :
53
+
54
+ ``` ini
55
+ [gitea-docker]
56
+ enabled = true
57
+ filter = gitea
58
+ logpath = /home/git/gitea/log/gitea.log
59
+ maxretry = 10
60
+ findtime = 3600
61
+ bantime = 900
62
+ action = iptables-allports[chain =" FORWARD" ]
63
+ ```
64
+
65
+ Then simply run ` service fail2ban restart ` to apply your changes. You can check to see if
66
+ fail2ban has accepted your configuration using ` service fail2ban status ` .
67
+
52
68
Make sure and read up on fail2ban and configure it to your needs, this bans someone
53
69
for ** 15 minutes** (from all ports) when they fail authentication 10 times in an hour.
54
70
You can’t perform that action at this time.
0 commit comments