~ubuntu-branches/ubuntu/utopic/dovecot/utopic-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-01-08 09:35:49 UTC
  • mfrom: (4.1.35 sid)
  • Revision ID: package-import@ubuntu.com-20140108093549-i72o93pux8p0dlaf
Tags: 1:2.2.9-1ubuntu1
* Merge from Debian unstable, remaining changes:
  + Add mail-stack-delivery package:
    - Update d/rules
    - d/control: convert existing dovecot-postfix package to a dummy
      package and add new mail-stack-delivery package.
    - Update maintainer scripts.
    - Rename d/dovecot-postfix.* to debian/mail-stack-delivery.*
    - d/mail-stack-delivery.preinst: Move previously installed backups and
      config files to a new package namespace.
    - d/mail-stack-delivery.prerm: Added to handle downgrades.
  + Use Snakeoil SSL certificates by default:
    - d/control: Depend on ssl-cert.
    - d/dovecot-core.postinst: Relax grep for SSL_* a bit.
  + Add autopkgtest to debian/tests/*.
  + Add ufw integration:
    - d/dovecot-core.ufw.profile: new ufw profile.
    - d/rules: install profile in dovecot-core.
    - d/control: dovecot-core - suggest ufw.
  + d/dovecot-core.dirs: Added usr/share/doc/dovecot-core
  + Add apport hook:
    - d/rules, d/source_dovecot.py
  + Add upstart job:
    - d/rules, d/dovecot-core.dovecot.upstart, d/control,
      d/dovecot-core.dirs, dovecot-imapd.{postrm, postinst, prerm},
      d/dovecot-pop3d.{postinst, postrm, prerm}.
      d/mail-stack-deliver.postinst: Convert init script to upstart.
  + Use the autotools-dev dh addon to update config.guess/config.sub for
    arm64.
* Dropped changes, included in Debian:
  - Update Dovecot name to reflect distribution in login greeting.
  - Update Drac plugin for >= 2.0.0 support.
* d/control: Drop dovecot-postfix package as its no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
================
3
3
 
4
4
Password scheme means the format in which the password is stored in <password
5
 
databases> [PasswordDatabase.txt]. The most commonly used password schemes are:
6
 
 
7
 
 * *PLAIN*: Password is in plaintext.
8
 
 * *CRYPT*: Traditional DES-crypted password in '/etc/passwd' (e.g. "pass" =
9
 
   'vpvKh.SaNbR6s')
10
 
    * Dovecot uses libc's 'crypt()' function, which means that CRYPT is usually
11
 
      able to recognize MD5-CRYPT and possibly also other password schemes. 
12
 
      Please see the notes below regarding glibc's 'crypt()' and SHA-256/512
13
 
      support.
14
 
    * The traditional DES-crypt scheme only uses the first 8 characters of the
15
 
      password, the rest are ignored.  Other schemes may have other password
16
 
      length limitations (if they limit the password length at all).
17
 
 * *MD5-CRYPT*: MD5 based salted password hash nowadays commonly used in
18
 
   '/etc/shadow'. (e.g. "pass" = '$1$ozdpg0V0$0fb643pVsPtHVPX8mCZYW/')
19
 
    * *MD5*: Alias for MD5-CRYPT. Dovecot versions earlier than v1.0.rc16 need
20
 
      to use this instead of MD5-CRYPT. This name is deprecated because
21
 
      MD5-CRYPT isn't an actual MD5 hash.
22
 
 * *PLAIN-MD5*: An actual MD5 hash of the password. (e.g. "pass" =
23
 
   '1a1dc91c907325c69271ddf0c944bc72')
 
5
databases> [PasswordDatabase.txt]. The main reason for choosing a scheme other
 
6
than *PLAIN* is to prevent someone with access to the password database (such
 
7
as a hacker) from stealing users' passwords and using them to access other
 
8
services.
 
9
 
 
10
What scheme to use?
 
11
-------------------
 
12
 
 
13
You should choose the strongest crypt scheme that's supported by your system.
 
14
From strongest to weakest:
 
15
 
 
16
 * *BLF-CRYPT*: This is the Blowfish crypt (bcrypt) scheme. It is generally
 
17
   considered to be very secure. The encrypted password will start with '$2a$'
 
18
   (Note: bcrypt is not available on most Linux distributions)
 
19
 * *SHA512-CRYPT*: A strong scheme. The encrypted password will start with
 
20
   '$6$'
 
21
 * *SHA256-CRYPT*: A strong scheme. The encrypted password will start with
 
22
   '$5$'
 
23
 * *MD5-CRYPT*: A weak but common scheme often used in '/etc/shadow'. The
 
24
   encrypted password will start with '$1$'
 
25
 
 
26
Note that the above schemes are implemented by the libc's 'crypt()' function.
 
27
Using them is especially useful when sharing the same passwords with other
 
28
software, because most of them support using 'crypt()' to verify the password.
 
29
However, not all libcs (especially older ones) implement all of the above
 
30
schemes. See below for other password schemes that are implemented by Dovecot
 
31
internally (instead of libc).
 
32
 
 
33
A few articles about why choosing a good password scheme is important:
 
34
 
 
35
 * How To Safely Store A Password
 
36
   [http://codahale.com/how-to-safely-store-a-password/]
 
37
 * Speed Hashing [http://www.codinghorror.com/blog/2012/04/speed-hashing.html]
 
38
 
 
39
It's not possible to easily switch from one password scheme to another. The
 
40
only practical way to do this is to wait until user logs in and change the
 
41
password during the login. <This HOWTO> [HowTo.ConvertPasswordSchemes.txt]
 
42
shows one way to do this.
 
43
 
 
44
Generating encrypted passwords
 
45
------------------------------
 
46
 
 
47
You can generate passwords for a particular scheme easily with "doveadm pw"
 
48
utility. For example:
 
49
 
 
50
---%<-------------------------------------------------------------------------
 
51
doveadm pw -s SHA512-CRYPT
 
52
---%<-------------------------------------------------------------------------
 
53
 
 
54
Default password schemes
 
55
------------------------
24
56
 
25
57
Password databases have a default password scheme:
26
58
 
41
73
The password scheme can be overridden for each password by prefixing it with
42
74
{SCHEME}, for example:'{PLAIN}pass'.
43
75
 
44
 
You can generate passwords for wanted scheme easily with "doveadm pw" utility.
45
 
For example:
46
 
 
47
 
---%<-------------------------------------------------------------------------
48
 
doveadm pw -s ssha256
49
 
---%<-------------------------------------------------------------------------
50
 
 
51
 
It's not possible to easily switch from one password scheme to another. The
52
 
only practical way to do this is to wait until user logs in and change the
53
 
password during the login. <This HOWTO> [HowTo.ConvertPasswordSchemes.txt]
54
 
shows one way to do this.
55
 
 
56
 
What scheme to use?
57
 
-------------------
58
 
 
59
 
With most installations it doesn't really matter what scheme you're using. If
60
 
you already have users with existing passwords, it's easiest to just keep using
61
 
the same scheme. Otherwise just pick something strong enough, for example
62
 
SSHA256.
63
 
 
64
 
The main idea behind storing passwords in non-plaintext scheme is that if an
65
 
attacker gets access to your server, he can't easily just get all users'
66
 
passwords and start using them. With stronger schemes it takes more time to
67
 
crack the passwords.
68
 
 
69
76
Non-plaintext authentication mechanisms
70
77
---------------------------------------
71
78
 
75
82
 
76
83
The problem with non-plaintext auth mechanisms is that the password must be
77
84
stored either in plaintext, or using a mechanism-specific scheme that's
78
 
incompatible with all other non-plaintext mechanisms. For example if you're
79
 
going to use CRAM-MD5 authentication, the password needs to be stored in either
80
 
PLAIN or CRAM-MD5 scheme. If you want to allow both CRAM-MD5 and DIGEST-MD5,
81
 
the password must be stored in plaintext.
 
85
incompatible with all other non-plaintext mechanisms. In addition, the
 
86
mechanism-specific schemes often offer very little protection. This isn't a
 
87
limitation of Dovecot, it's a requirement for the algorithms to even work.
 
88
 
 
89
For example if you're going to use CRAM-MD5 authentication, the password needs
 
90
to be stored in either PLAIN or CRAM-MD5 scheme. If you want to allow both
 
91
CRAM-MD5 and DIGEST-MD5, the password must be stored in plaintext.
82
92
 
83
93
In future it's possible that Dovecot could support multiple passwords in
84
94
different schemes for a single user.
85
95
 
86
 
Supported schemes
87
 
-----------------
88
 
 
89
 
*PLAIN*, *CRYPT* and *MD5-CRYPT* schemes were explained above.
90
 
 
91
 
Non-plaintext mechanism specific schemes:
92
 
 
93
96
 * *LANMAN*: DES-based encryption. Used sometimes with NTLM mechanism.
94
97
 * *NTLM*: MD4 sum of the password stored in hex. Used with NTLM mechanism.
95
98
 * *RPA*: Used with RPA mechanism.
97
100
 * *DIGEST-MD5*: Used with <DIGEST-MD5 mechanism>
98
101
   [Authentication.Mechanisms.DigestMD5.txt]. The username is included in the
99
102
   hash, so it's not possible to use the hash for different usernames.
 
103
 * *SCRAM-SHA-1*: Used with SCRAM-SHA-1 mechanism. (v2.2+)
 
104
 
 
105
Other supported password schemes
 
106
--------------------------------
 
107
 
 
108
Strong schemes and mechanism-specific schemes are listed above.
 
109
 
 
110
 * *PLAIN*: Password is in plaintext.
 
111
 * *CRYPT*: Traditional DES-crypted password in '/etc/passwd' (e.g. "pass" =
 
112
   'vpvKh.SaNbR6s')
 
113
    * Dovecot uses libc's 'crypt()' function, which means that CRYPT is usually
 
114
      able to recognize MD5-CRYPT and possibly also other password schemes. See
 
115
      all of the *-CRYPT schemes at the top of this page.
 
116
    * The traditional DES-crypt scheme only uses the first 8 characters of the
 
117
      password, the rest are ignored.  Other schemes may have other password
 
118
      length limitations (if they limit the password length at all).
100
119
 
101
120
MD5 based schemes:
102
121
 
119
138
password hash is base64 or hex encoded, so both can be used.'doveadm pw' anyway
120
139
generates the passwords using the encoding mentioned above.
121
140
 
122
 
SHA256 and SHA512 in libc
123
 
-------------------------
124
 
 
125
 
glibc v2.7+ supports SHA256 and SHA512 based password schemes. The passwords
126
 
look like:
127
 
 
128
 
 * SHA256: $5$salt$data
129
 
 * SHA512: $6$salt$data
130
 
 
131
 
These passwords are completely different than what Dovecot generates. They use
132
 
multiple rounds of SHA, so they're also safer against brute forcing (but also
133
 
requiring more CPU from your server). You can use these simply by using CRYPT
134
 
scheme, assuming your libc can handle these kinds of passwords.
135
 
 
136
 
One way to generate this type of password hash is via the mkpasswd command
137
 
included in the whois package. For example:'mkpasswd -m sha-512'
138
 
 
139
 
This is especially useful for sharing the same password file with other
140
 
software. It can be used with Apache's basic authentication in lieu of the much
141
 
less secure htpasswd as the check is passed through to the system's crypt(3)
142
 
library.
143
 
 
144
141
Encoding
145
142
--------
146
143
 
200
197
not all password schemes provided by dovecotpw are supported. Have a look at
201
198
the module VBoxAdm::DovecotPW for more details.
202
199
 
203
 
(This file was created from the wiki on 2012-04-23 04:42)
 
200
(This file was created from the wiki on 2013-11-24 04:42)