Skip to content

Commit 971e71a

Browse files
sirainencmouse
authored andcommitted
config/proxy/overview: Various fixes, cleanups, removals of obsolete warnings
1 parent 52eb0e5 commit 971e71a

File tree

1 file changed

+59
-71
lines changed

1 file changed

+59
-71
lines changed

docs/core/config/proxy/overview.md

Lines changed: 59 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,71 @@ dovecotlinks:
99
text: forwarding fields
1010
---
1111

12-
# Proxy passdb
12+
# Dovecot Proxying
1313

1414
Dovecot supports proxying IMAP, POP3, [[link,submission]], [[link,lmtp]],
15-
and [[link,managesieve]] connections to other hosts.
15+
[[link,managesieve]] and doveadm connections to other hosts.
1616

1717
The proxying can be done for all users, or only for some specific users. There
18-
are two ways to do the authentication:
18+
are two ways to do the authentication on the remote server:
1919

20-
1. Forward the password to the remote server. The proxy may or may not perform
21-
authentication itself. This requires that the client uses only cleartext
22-
authentication, or alternatively the proxy has access to users' passwords in
23-
cleartext.
20+
1. Forward the user-given password (or OAUTH token) to the remote server. This
21+
is done by returning `pass=%{password}` and `proxy_mech=%{mechanism}` extra
22+
fields.
2423

25-
2. Let Dovecot proxy perform the authentication and login to remote server
24+
* This doesn't work if any non-cleartext, non-token-based
25+
[[link,authentication_mechanisms, authentication mechanisms]] are used,
26+
because they prevent such password forwarding by design.
27+
* `proxy_mech` is needed only if both OAUTH and cleartext mechanisms
28+
are enabled.
29+
30+
1. Let Dovecot proxy perform the authentication and login to remote server
2631
using the proxy's [[link,auth_master_users]]. This allows client
2732
to use also non-cleartext authentication.
2833

29-
The proxy is configured pretty much the same way as [[link,auth_referral]],
30-
with the addition of `proxy` field.
34+
## Configuration
35+
36+
Proxying is enabled by the `proxy` or `proxy_maybe` extra field.
37+
Additionally, `host` is also a required field. See below for details on
38+
them and other optional extra fields.
39+
40+
In backends, set [[setting,login_trusted_networks]] to point to the proxies'
41+
IP addresses. This way you'll get the clients' actual IP addresses logged
42+
instead of the proxy's.
43+
44+
The destination servers don't need to be running Dovecot, but you should make
45+
sure that the Dovecot proxy doesn't advertise more capabilities than the
46+
destination server can handle. For IMAP you can do this by changing
47+
[[setting,imap_capability]]. For POP3 you'll have to modify Dovecot's sources
48+
for now (`src/pop3/capability.h`).
49+
50+
Dovecot IMAP proxy also automatically sends updated untagged CAPABILITY reply
51+
if it detects that the remote server has different capabilities than what it
52+
already advertised to the client, but some clients simply ignore the
53+
updated CAPABILITY reply.
3154

3255
## Fields
3356

3457
### `proxy`
3558

3659
Enables the proxying.
3760

38-
Either this or `proxy_maybe` is required.
61+
Either this or `proxy_maybe` is required to enable proxying.
3962

4063
### `proxy_maybe`
4164

42-
Enables the proxying.
65+
Enables optional proxying.
4366

44-
Either this or `proxy` is required.
67+
Either this or `proxy` is required to enable proxying.
4568

46-
`proxy_maybe` can be used to implement "automatic proxying". If the
69+
`proxy_maybe` can be used to implement "automatic proxying" to implement
70+
a mixed mode of running proxies and backends in the same servers. If the
4771
proxy destination matches the current connection, the user gets logged in
4872
normally instead of being proxied. If the same happens with `proxy`, the
4973
login fails with `Proxying loops` error.
5074

51-
* `proxy_maybe` with LMTP require.
52-
* `proxy_maybe` with `host=<dns name>` requires.
53-
* `auth_proxy_self` setting in `dovecot.conf` can be used to specify extra
54-
IPs that are also considered to be the proxy's own IPs.
75+
[[setting,auth_proxy_self]] can be used to specify extra IPs that are also
76+
considered to be the proxy's own IPs.
5577

5678
### `host=<s>`
5779

@@ -81,6 +103,7 @@ Tell client to use a different username when logging in.
81103
### `proxy_mech=<s>`
82104

83105
Tell client to use this SASL authentication mechanism when logging in.
106+
See [[setting,imapc_sasl_mechanisms]] for supported mechanisms
84107

85108
### `proxy_timeout=<time_msecs>`
86109

@@ -98,62 +121,31 @@ that hang otherwise.
98121

99122
### `proxy_not_trusted`
100123

101-
IMAP/POP3 proxying never sends the `ID/XCLIENT` command to remote.
124+
IMAP/POP3 proxying never sends the `ID/XCLIENT` command to remote. This can be
125+
used when proxying to remote servers that shouldn't see the clients' original
126+
IP addresses or other information.
102127

103128
## SSL
104129

105130
You can use SSL/TLS connection to destination server by returning:
106131

107-
* [[setting,ssl,yes]]
108-
109-
Use SSL and require a valid verified remote certificate.
110-
111-
::: warning
112-
Unless used carefully, this is an insecure setting!
113-
The only way to use this securely is to only use and allow your own private
114-
CA's certs; anything else is exploitable by a man-in-the-middle attack.
115-
:::
116-
117-
::: info
118-
Login processes don't currently use the [[setting,ssl_client_ca_dir]] setting
119-
for verifying the remote certificate, mainly because login processes can't
120-
really read the files chrooted. You can instead use
121-
[[setting,ssl_client_ca_file]].
122-
:::
123-
124-
::: warning
125-
doveadm proxying doesn't support SSL/TLS currently - any ssl/starttls
126-
extra field is ignored.
127-
:::
132+
* `ssl=yes`: Use SSL and require a valid verified remote certificate.
128133

129134
* `ssl=any-cert`: Use SSL, but don't require a valid remote certificate.
130135

131136
* `starttls=yes`: Use STARTTLS command instead of doing SSL handshake
132137
immediately after connected.
133138

134-
* `starttls=any-cert`: Combine starttls and `ssl=any-cert`.
139+
* `starttls=any-cert`: Combine `starttl` and `ssl=any-cert`.
140+
141+
::: info
142+
Login processes are chrooted, so [[setting,ssl_client_ca_dir]] setting
143+
doesn't work. You can instead use [[setting,ssl_client_ca_file]].
144+
:::
135145

136146
Additionally you can also tell Dovecot to send SSL client certificate to the
137147
remote server using [[setting,ssl_client_cert_file]] and
138-
[[setting,ssl_client_key_file]] settings in `dovecot.conf`.
139-
140-
Set [[setting,login_trusted_networks]] to point to the proxies in the
141-
backends. This way you'll get the clients' actual IP addresses logged instead
142-
of the proxy's.
143-
144-
The destination servers don't need to be running Dovecot, but you should make
145-
sure that the Dovecot proxy doesn't advertise more capabilities than the
146-
destination server can handle.
147-
148-
For IMAP you can do this by changing [[setting,imap_capability]].
149-
150-
For POP3 you'll have to modify Dovecot's sources for now
151-
(`src/pop3/capability.h`).
152-
153-
Dovecot also automatically sends updated untagged CAPABILITY reply if it
154-
detects that the remote server has different capabilities than what it
155-
already advertised to the client, but some clients simply ignore the
156-
updated CAPABILITY reply.
148+
[[setting,ssl_client_key_file]] settings.
157149

158150
## Source IPs
159151

@@ -175,8 +167,7 @@ To avoid reconnection load spikes when a backend server dies, you can tell
175167
proxy to spread the client disconnections over a longer time period (after the
176168
server side of the connection is already disconnected).
177169

178-
[[setting,login_proxy_max_disconnect_delay]] controls this (disabled by
179-
default).
170+
[[setting,login_proxy_max_disconnect_delay]] controls this.
180171

181172
## Forwarding Fields
182173

@@ -191,7 +182,7 @@ passdb extra fields, so they are visible in, e.g.,
191182
If the proxying continues, all these fields are further forwarded to the next
192183
hop again.
193184

194-
This feature requires that the sending host is in
185+
This feature requires that the sending host is in the destination's
195186
[[setting,login_trusted_networks]].
196187

197188
See [[link,forwarding_parameters]] for more details on how this is implemented
@@ -246,27 +237,24 @@ If you don't want proxy itself to do authentication, you can configure it to
246237
succeed with any given password. You can do this by returning an empty
247238
password and `nopassword` field.
248239

249-
## Master Password
240+
## Master Users
241+
242+
Note that this is different from master passwords.
250243

251244
This way of forwarding requires the destination server to support master user
252245
feature. The users will be normally authenticated in the proxy and the common
253246
proxy fields are returned, but you'll need to return two fields specially:
254247

255-
* `master=<s>`: This contains the master username (e.g. proxy). It's used as
248+
* `master=<s>`: This contains the master username (e.g. `proxy`). It's used as
256249
SASL authentication ID.
257250

258251
* Alternatively you could return `destuser=user*master` and set
259252
[[setting,auth_master_user_separator,*]].
260253

261-
* `pass=<s`>: This field contains the master user's password.
254+
* `pass=<s>`: This field contains the master user's password.
262255

263256
See [[link,auth_master_users]] for more information how to configure this.
264257

265-
## OAuth2 Forwarding
266-
267-
If you want to forward [[link,auth_oauth2]] tokens, return field
268-
`proxy_mech=%{mechanism}` as extra field.
269-
270258
## Examples
271259

272260
### Password Forwarding with Static DB

0 commit comments

Comments
 (0)