The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

[FreeBSD] Как выключить DES в паролях? (security des crypt)

<< Предыдущая ИНДЕКС Поиск в статьях src Установить закладку Перейти на закладку Следующая >>
Ключевые слова: security, des, crypt,  (найти похожие документы)
_ RU.UNIX.BSD (2:5077/15.22) _____________________________________ RU.UNIX.BSD _ From : Max Khon 2:5000/79 09 Jul 99 18:29:00 Subj : [FreeBSD] Как выключить DES в паролях? ________________________________________________________________________________ hi, there! 06 Jul 99 21:36, Eugene Perevyazko wrote to All: > Как можно заставить FreeBSD (3.2) сохранять новые пароли в MD5 при > установленной поддержке DES? Везде описывается только обратная > проблема... ----- FOO begins ----- From Fri Jul 9 18:31:14 1999 Date: Tue, 6 Jul 1999 22:30:21 +0930 (CST) From: Kris Kennaway <> To: security@FreeBSD.ORG Subject: Improved libcrypt ready for testing I've just finished polishing off a replacement crypt library, based on some earlier work by Brandon Gillespie, which provides the following features: * Support for MD5, SHA-1, DES (two forms), and Blowfish password (a la OpenBSD) * Password crypt format defined by login capabilities Two new login capabilities are added: localcipher - which password hash algorithm do we use for this login class? localcipherrounds - how many encryption rounds should we use (for algorithms which support it, namely New-DES and Blowfish). The 'New-DES' algorithm has actually been present in the code forever, but commented out. In contrast to the 'traditional' DES password format, NewDES passwords have 4 bytes of encoded salt (instead of 2), with no maximum password length (instead of an 8-character limit). It can also accept a definable number of encryption rounds, so is somewhat 'future-proof'. The SHA-1 algorithm is directly analogous to the FreeBSD-standard MD5 algorithm. The Blowfish algorithm is ported from OpenBSD, and also supports a customizable number of encryption rounds (from 2^4 up to 2^31). Using login.conf, you could (for example) set your root password to be a 2^12 round Blowfish password (which takes ~35 seconds to crypt() on my P120), your regular user passwords to be SHA-1, and a subset (say, users who you want to share password entries with a Sun machine) as Old-DES format. I've changed the default password format (i.e., in the absence of an overriding login class) to SHA-1 for new passwords; this is fairly arbitrary but based on the general feeling that SHA-1 is a 'stronger' algorithm than MD5. In order to accomodate multiple algorithms better, the crypted passwords have the format $token$hash$password where "token" is a string, not a numerical identifier (i.e., '1' for current MD5 passwords, and "2a" for openbsd blowfish passwords). Using a numeric identifier is non-portable across vendors without an assigning authority, and there's the possibility of collision should another vendor choose the same number as us for a different algorithm (of course, they could still choose an incompatible algorithm using MD5, etc, but this is less likely). (Cisco seem to use either our (old) MD5 algorithm for their routers, or one with the same form) The 'oldmd5' and 'openbsd' localcipher values will produce passwords in the traditional format, and 'md5' and 'blowfish' produce the new "$MD5"/"$Blowfish$" tokens. 'des', 'newdes', and 'sha1' are the other possible values. The source itself is split between the "exportable" ciphers and the restricted ones under secure/ - in contrast to the previous version, the library is only built from under /usr/src/lib/libcrypt, which pulls in the extra files from /usr/src/secure/lib/libcrypt if it exists. This means no duplication of code between the two directories. In order to support blowfish passwords, the blowfish encryption/decryption code from openbsd has been included - this probably should be broken out into its own library, perhaps combined with the DES routines into a libcrypto. The new library (and changes to passwd(1)) is available at and should be extracted over the top of your /usr/src tree (since the changes are so large it's not worthwhile providing diffs). I'd appreciate it if people could test this and see how it goes (back up your current libcrypt* first!!) - I've tested it myself fairly thoroughly, but there may be some bootstrap or backwards-compatability issues, and I haven't yet tested it on an existing OpenBSD password file. I'd also like to hear any feedback about the code itself. Thanks to Brandon Gillespie (who committed the original code on which this version is based) and Mark Murray for their help. Kris ----- "Never criticize anybody until you have walked a mile in their shoes, because by that time you will be a mile away and have their shoes." -- Unknown To Unsubscribe: send mail to with "unsubscribe freebsd-security" in the body of the message ----- FOO ends ----- а если без этого, то /usr/src/usr/bin/passwd/local_passwd.c подпатчить можно (уже с полгода с этим живу): ----- local_passwd.c.diff begins ----- *** ./local_passwd.c.orig Tue Feb 2 16:03:19 1999 --- ./local_passwd.c Tue Feb 2 16:03:54 1999 *************** getnewpasswd(pw, nis) *** 165,170 **** --- 165,171 ---- #else /* Make a good size salt for algoritms that can use it. */ gettimeofday(&tv,0); + #if 0 if (strncmp(pw->pw_passwd, "$1$", 3)) { /* DES Salt */ to64(&salt[0], random(), 3); *************** getnewpasswd(pw, nis) *** 173,184 **** --- 174,188 ---- salt[8] = '\0'; } else { + #endif /* MD5 Salt */ strncpy(&salt[0], "$1$", 3); to64(&salt[3], random(), 3); to64(&salt[6], tv.tv_usec, 3); salt[8] = '\0'; + #if 0 } + #endif #endif return (crypt(buf, salt)); } ----- local_passwd.c.diff ends ----- /fjoe --- Msged/BSD TE 06 (pre) * Origin: UTSL (2:5000/79@fidonet)

<< Предыдущая ИНДЕКС Поиск в статьях src Установить закладку Перейти на закладку Следующая >>

 Добавить комментарий

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру