~ubuntu-branches/ubuntu/wily/dovecot/wily-proposed

« back to all changes in this revision

Viewing changes to doc/wiki/Authentication.RestrictAccess.txt

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-08-02 14:00:15 UTC
  • mto: (1.11.1 upstream) (4.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20080802140015-zbmjsgoodeyc9z4s
Tags: upstream-1.1.2
ImportĀ upstreamĀ versionĀ 1.1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
1
Restricting Access
4
2
==================
5
3
 
6
 
 
7
 
 
8
 
 
9
4
Restricting IMAP access
10
 
=======================
11
 
 
12
 
 
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. 
14
 
 
 
5
-----------------------
 
6
 
 
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.
15
9
 
16
10
PAM
17
 
===
18
 
 
19
 
 
20
 
Set PAM service name to '*', ie.: 
 
11
---
 
12
 
 
13
Set PAM service name to '*', ie.:
21
14
 
22
15
---%<-------------------------------------------------------------------------
23
16
passdb pam {
24
17
  args = *
25
 
} ---%<-------------------------------------------------------------------------
26
 
 
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: 
 
18
}
 
19
---%<-------------------------------------------------------------------------
 
20
 
 
21
That way PAM uses '/etc/pam.d/imap' for IMAP, and '/etc/pam.d/pop3' for POP3.
 
22
 
 
23
In '/etc/pam.d/imap' you could then use eg. the pam_listfile.so module:
29
24
 
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 ---%<-------------------------------------------------------------------------
33
 
 
34
 
 
 
27
auth    required        pam_listfile.so item=user sense=allow
 
28
file=/etc/imapusers onerr=fail
 
29
---%<-------------------------------------------------------------------------
35
30
 
36
31
SQL
37
 
===
38
 
 
39
 
 
40
 
You can use '%Ls' variable which expands to 'imap' or 'pop3' in 'password_query', eg: 
41
 
 
42
 
---%<-------------------------------------------------------------------------
43
 
password_query = SELECT password FROM users WHERE userid = '%u' and (imap_allowed = true or '%Ls' = 'pop3') ---%<-------------------------------------------------------------------------
44
 
 
45
 
 
 
32
---
 
33
 
 
34
You can use the '%Ls' variable which expands to 'imap' or 'pop3' in
 
35
'password_query', eg:
 
36
 
 
37
---%<-------------------------------------------------------------------------
 
38
password_query = SELECT password FROM users WHERE userid = '%u' and
 
39
(imap_allowed = true or '%Ls' = 'pop3')
 
40
---%<-------------------------------------------------------------------------
46
41
 
47
42
LDAP
48
 
====
49
 
 
50
 
 
51
 
Just like with SQL, you can use '%Ls' in pass_filter, eg.: 
52
 
 
53
 
---%<-------------------------------------------------------------------------
54
 
pass_filter = (&(objectClass=posixAccount)(uid=%u)(service=%Ls)) ---%<-------------------------------------------------------------------------
55
 
 
56
 
That would require setting both service=pop3 and service=imap attributes to the user objects. 
57
 
 
 
43
----
 
44
 
 
45
Just like with SQL, you can use '%Ls' in pass_filter, eg.:
 
46
 
 
47
---%<-------------------------------------------------------------------------
 
48
pass_filter = (&(objectClass=posixAccount)(uid=%u)(service=%Ls))
 
49
---%<-------------------------------------------------------------------------
 
50
 
 
51
That would require setting both service=pop3 and service=imap attributes to the
 
52
user objects.
58
53
 
59
54
passwd-file
60
 
===========
61
 
 
62
 
 
63
 
You can create a deny passwd-file based on the service: 
 
55
-----------
 
56
 
 
57
You can create a deny passwd-file based on the service:
64
58
 
65
59
---%<-------------------------------------------------------------------------
66
60
passdb passwd-file {
69
63
}
70
64
---%<-------------------------------------------------------------------------
71
65
 
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.
74
69
 
 
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.
75
72
 
76
73
Restricting IP Access
77
 
=====================
78
 
 
79
 
 
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)
 
74
---------------------
 
75
 
 
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
 
79
in passdb.
 
80
 
 
81
(This file was created from the wiki on 2008-06-20 04:42)