Skip to content

Commit 1f55c4f

Browse files
committed
config/auth: Move anvil penalty page content to include files
1 parent 997f704 commit 1f55c4f

File tree

5 files changed

+95
-37
lines changed

5 files changed

+95
-37
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
- First auth failure reply will be delayed for 2 seconds (this happens
2+
even without auth penalty)
3+
4+
- `AUTH_PENALTY_INIT_SECS` in `src/auth/auth-penalty.h`
5+
6+
- The delay will be doubled for 4 -> 8 seconds, and then the upper
7+
limit of 15 seconds is reached.
8+
9+
- `AUTH_PENALTY_MAX_SECS` and `AUTH_PENALTY_MAX_PENALTY` in
10+
`src/auth/auth-penalty.h`
11+
12+
- If the IP is in [[setting,login_trusted_networks]] (e.g. webmail), skip any
13+
authentication penalties
14+
15+
- If the username+password combination is the same as one of the last
16+
10 login attempts, skip increasing authentication penalty.
17+
18+
- `CHECKSUM_VALUE_PTR_COUNT` in `src/anvil/penalty.c`
19+
20+
- The idea is that if a user has simply configured the password
21+
wrong, it shouldn't keep increasing the delay.
22+
23+
- The username+password is tracked as the CRC32 of them, so there is
24+
a small possibility of hash collisions
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Dovecot anvil process tracks authentication penalties for different IPs
2+
to slow down brute force login attempts. The penalty is increased after failed
3+
logins until a maximum value, unless [[link,passdb_extra_field_nodelay]] is
4+
used. The penalty is applied for the IP before passdb lookups are done, so
5+
the delay might exist even with `nodelay` if it is not used for all
6+
authentication attempts for the IP.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- It is still possible to do multiple auth lookups from the same IP in
2+
parallel.
3+
4+
- For IPv6 it currently blocks the entire /48 block, which may or may
5+
not be what is wanted.
6+
7+
- `PENALTY_IPV6_MASK_BITS` in `auth-penalty.c`
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Dovecot anvil process tracks authentication penalties for different IPs
2+
to slow down brute force login attempts. The penalty is increased after failed
3+
logins until a maximum value, unless [[link,passdb_extra_field_nodelay]] is
4+
used. The penalty is applied for the IP before passdb lookups are done, so
5+
the delay might exist even with `nodelay` if it is not used for all
6+
authentication attempts for the IP.
7+
8+
## Algorithm
9+
10+
- First auth failure reply will be delayed for 2 seconds (this happens
11+
even without auth penalty)
12+
13+
- `AUTH_PENALTY_INIT_SECS` in `src/auth/auth-penalty.h`
14+
15+
- The delay will be doubled for 4 -> 8 seconds, and then the upper
16+
limit of 15 seconds is reached.
17+
18+
- `AUTH_PENALTY_MAX_SECS` and `AUTH_PENALTY_MAX_PENALTY` in
19+
`src/auth/auth-penalty.h`
20+
21+
- If the IP is in [[setting,login_trusted_networks]] (e.g. webmail), skip any
22+
authentication penalties
23+
24+
- If the username+password combination is the same as one of the last
25+
10 login attempts, skip increasing authentication penalty.
26+
27+
- `CHECKSUM_VALUE_PTR_COUNT` in `src/anvil/penalty.c`
28+
29+
- The idea is that if a user has simply configured the password
30+
wrong, it shouldn't keep increasing the delay.
31+
32+
- The username+password is tracked as the CRC32 of them, so there is
33+
a small possibility of hash collisions
34+
35+
## Problems
36+
37+
- It is still possible to do multiple auth lookups from the same IP in
38+
parallel.
39+
40+
- For IPv6 it currently blocks the entire /48 block, which may or may
41+
not be what is wanted.
42+
43+
- `PENALTY_IPV6_MASK_BITS` in `auth-penalty.c`
44+
45+
## Disabling
46+
47+
Authentication penalty tracking can be disabled completely with:
48+
49+
```[dovecot.conf]
50+
service anvil {
51+
unix_listener anvil-auth-penalty {
52+
mode = 0
53+
}
54+
}
55+
```

docs/core/config/auth/penalty.md

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,15 @@ dovecotlinks:
77

88
# Authentication Penalty
99

10-
Dovecot anvil process tracks authentication penalties for different IPs
11-
to slow down brute force login attempts. The penalty is increased after failed
12-
logins until a maximum value, unless [[link,passdb_extra_field_nodelay]] is
13-
used. The penalty is applied for the IP before passdb lookups are done, so
14-
the delay might exist even with `nodelay` if it is not used for all
15-
authentication attempts for the IP.
10+
<!-- @include: include/anvil-overview.inc -->
1611

1712
## Algorithm
1813

19-
- First auth failure reply will be delayed for 2 seconds (this happens
20-
even without auth penalty)
21-
22-
- `AUTH_PENALTY_INIT_SECS` in `src/auth/auth-penalty.h`
23-
24-
- The delay will be doubled for 4 -> 8 seconds, and then the upper
25-
limit of 15 seconds is reached.
26-
27-
- `AUTH_PENALTY_MAX_SECS` and `AUTH_PENALTY_MAX_PENALTY` in
28-
`src/auth/auth-penalty.h`
29-
30-
- If the IP is in [[setting,login_trusted_networks]] (e.g. webmail), skip any
31-
authentication penalties
32-
33-
- If the username+password combination is the same as one of the last
34-
10 login attempts, skip increasing authentication penalty.
35-
36-
- `CHECKSUM_VALUE_PTR_COUNT` in `src/anvil/penalty.c`
37-
38-
- The idea is that if a user has simply configured the password
39-
wrong, it shouldn't keep increasing the delay.
40-
41-
- The username+password is tracked as the CRC32 of them, so there is
42-
a small possibility of hash collisions
14+
<!-- @include: include/anvil-algorithm.inc -->
4315

4416
## Problems
4517

46-
- It is still possible to do multiple auth lookups from the same IP in
47-
parallel.
48-
49-
- For IPv6 it currently blocks the entire /48 block, which may or may
50-
not be what is wanted.
51-
52-
- `PENALTY_IPV6_MASK_BITS` in `auth-penalty.c`
18+
<!-- @include: include/anvil-problems.inc -->
5319

5420
## Disabling
5521

0 commit comments

Comments
 (0)