9
4
Restricting IMAP access
10
=======================
13
If you want to give POP3 access to everyone, but IMAP access only for some people, you have to use passdb which allows selecting this.
5
-----------------------
7
If you want to give POP3 access to everyone, but IMAP access only for some
8
people, you have to use passdb which allows selecting this.
20
Set PAM service name to '*', ie.:
13
Set PAM service name to '*', ie.:
22
15
---%<-------------------------------------------------------------------------
25
} ---%<-------------------------------------------------------------------------
27
That way PAM uses '/etc/pam.d/imap' for IMAP, and '/etc/pam.d/pop3' for POP3.
28
In '/etc/pam.d/imap' you could then use eg. pam_listfile.so module:
19
---%<-------------------------------------------------------------------------
21
That way PAM uses '/etc/pam.d/imap' for IMAP, and '/etc/pam.d/pop3' for POP3.
23
In '/etc/pam.d/imap' you could then use eg. the pam_listfile.so module:
30
25
---%<-------------------------------------------------------------------------
31
26
# allow IMAP access only for users in /etc/imapusers file
32
auth required pam_listfile.so item=user sense=allow file=/etc/imapusers onerr=fail ---%<-------------------------------------------------------------------------
27
auth required pam_listfile.so item=user sense=allow
28
file=/etc/imapusers onerr=fail
29
---%<-------------------------------------------------------------------------
40
You can use '%Ls' variable which expands to 'imap' or 'pop3' in 'password_query', eg:
42
---%<-------------------------------------------------------------------------
43
password_query = SELECT password FROM users WHERE userid = '%u' and (imap_allowed = true or '%Ls' = 'pop3') ---%<-------------------------------------------------------------------------
34
You can use the '%Ls' variable which expands to 'imap' or 'pop3' in
37
---%<-------------------------------------------------------------------------
38
password_query = SELECT password FROM users WHERE userid = '%u' and
39
(imap_allowed = true or '%Ls' = 'pop3')
40
---%<-------------------------------------------------------------------------
51
Just like with SQL, you can use '%Ls' in pass_filter, eg.:
53
---%<-------------------------------------------------------------------------
54
pass_filter = (&(objectClass=posixAccount)(uid=%u)(service=%Ls)) ---%<-------------------------------------------------------------------------
56
That would require setting both service=pop3 and service=imap attributes to the user objects.
45
Just like with SQL, you can use '%Ls' in pass_filter, eg.:
47
---%<-------------------------------------------------------------------------
48
pass_filter = (&(objectClass=posixAccount)(uid=%u)(service=%Ls))
49
---%<-------------------------------------------------------------------------
51
That would require setting both service=pop3 and service=imap attributes to the
63
You can create a deny passwd-file based on the service:
57
You can create a deny passwd-file based on the service:
65
59
---%<-------------------------------------------------------------------------
66
60
passdb passwd-file {
70
64
---%<-------------------------------------------------------------------------
72
This makes Dovecot look for '/etc/dovecot/deny.imap' and '/etc/dovecot/deny.pop3' files. If the user exists in it, the access is denied. The files don't need to have anything else than one username per line.
73
Note that this deny passdb must be before other passdbs. It also means that it can be used with any other passdb, not just with passwd-file passdbs.
66
This makes Dovecot look for '/etc/dovecot/deny.imap' and
67
'/etc/dovecot/deny.pop3' files. If the user exists in it, the access is denied.
68
The files don't need to have anything else than one username per line.
70
Note that this deny passdb must be before other passdbs. It also means that it
71
can be used with any other passdb, not just with passwd-file passdbs.
76
73
Restricting IP Access
80
It's possible to allow user to authenticate only from a specific IP or network. This is especially useful for master users. This can be done by returning >>allow_nets<< extra field in passdb.
81
(This file was created from the wiki on 2007-12-11 04:42)
76
It's possible to allow a user to authenticate only from a specific IP or
77
network. This is especially useful for master users. This can be done by
78
returning<allow_nets> [PasswordDatabase.ExtraFields.AllowNets.txt] extra field
81
(This file was created from the wiki on 2008-06-20 04:42)