[Dovecot] password encryption
I have just come to the realization that password encryption using the crypt function in linux, ONLY USES THE FIRST 8 CHARS. I have written routines using crypt allowing 16+ chars, and find that anything past 8 is ignored. Wow.
Is there a way around this that can be used in dovecot, as well as encryption routines for an email front end? (not system users).
It's the integration with dovecot which is the most important.
On Fri, 2013-04-05 at 23:36 -0700, Jim Pazarena wrote:
I have just come to the realization that password encryption using the crypt function in linux, ONLY USES THE FIRST 8 CHARS. I have written routines using crypt allowing 16+ chars, and find that anything past 8 is ignored. Wow.
this was true in decades of old, but has not been the case for many, many, years - upgrade your system.
On 4/5/2013 11:36 PM, Jim Pazarena wrote:
I have just come to the realization that password encryption using the crypt function in linux, ONLY USES THE FIRST 8 CHARS. I have written routines using crypt allowing 16+ chars, and find that anything past 8 is ignored. Wow.
Is there a way around this that can be used in dovecot, as well as encryption routines for an email front end? (not system users).
It's the integration with dovecot which is the most important.
Dovecot supports *many* password hashing algorithms. Switch to SHA512 if you want good security. Generally the system figures out what hash a password is stored in, so you can mix and match. Set a default and all new passwords plus whenever a user changes their password, will generate a hash in the new format.
Dem
On 4/5/2013 11:36 PM, Jim Pazarena wrote:
I have just come to the realization that password encryption using the crypt function in linux, ONLY USES THE FIRST 8 CHARS. I have written routines using crypt allowing 16+ chars, and find that anything past 8 is ignored. Wow.
Is there a way around this that can be used in dovecot, as well as encryption routines for an email front end? (not system users).
Remember that most Linux distros offer a way to configure the default password salt/encryption scheme.
Look in /etc/login.defs or equivalent on your distro.
With any semi-recent glibc + contemporaneous toolchain, you'll see options like:
# # Only works if compiled with ENCRYPTMETHOD_SELECT defined: # If set to MD5 , MD5-based algorithm will be used for encrypting password # If set to SHA256, SHA256-based algorithm will be used for encrypting password # If set to SHA512, SHA512-based algorithm will be used for encrypting password # If set to DES, DES-based algorithm will be used for encrypting password (default) # Overrides the MD5_CRYPT_ENAB option # ENCRYPT_METHOD SHA512 # # Only works if ENCRYPT_METHOD is set to SHA256 or SHA512. # # Define the number of SHA rounds. # With a lot of rounds, it is more difficult to brute forcing the password. # But note also that it more CPU resources will be needed to authenticate # users. # SHA_CRYPT_MIN_ROUNDS 400000 SHA_CRYPT_MAX_ROUNDS 4000000
Tune the values on your system so the authentication delay isn't too bad.
I'm surprised your distro has defaulted to the ancient crypt(). Even slackware, not noted for being "bleeding edge" has defaulted to MD5 for a very very long time now.
Of course, if you've been running the same system or one where you migrated shadow files from old ones, you may still be using those ancient shadow password formats. (No system changes those in-place for you until you explicitly change the password with new login.defs defaults in effect.)
=R=
participants (4)
-
Jim Pazarena
-
Noel Butler
-
Professa Dementia
-
Robin