# HG changeset patch # User Maxim Dounin # Date 1725070765 -10800 # Node ID aea3e104f11deba904f88166ddd1befe79621ec1 # Parent f7e9bd7de0f9a4fbb476b4a6217de3bb55cdaa7b Reworked auth_basic_user_file documentation. Some extra details about crypt(3) are provided, emphasizing modular crypt() usage and commonly available password hashing methods. Also, added some examples on how to use "openssl passwd" to generate password hashes, made it clear that {SSHA} passwords are not secure now, and added a note about passwords being validated on each request. diff -r f7e9bd7de0f9 -r aea3e104f11d xml/en/docs/http/ngx_http_auth_basic_module.xml --- a/xml/en/docs/http/ngx_http_auth_basic_module.xml Tue Aug 13 17:45:23 2024 +0300 +++ b/xml/en/docs/http/ngx_http_auth_basic_module.xml Sat Aug 31 05:19:25 2024 +0300 @@ -10,7 +10,7 @@ + rev="12">
@@ -89,18 +89,37 @@ -The following password types are supported: +Passwords are expected to be encrypted by the +crypt() function. +All password hashing methods as supported by the OS can be used. +In particular, the following crypt hashing methods are +commonly available: + -encrypted with the crypt function; can be generated using -the “htpasswd” utility from the Apache HTTP Server -distribution or the “openssl passwd” command; +MD5-based crypt method, $1$; + + + +SHA256-based crypt method, $5$; -hashed with the Apache variant of the MD5-based password algorithm (apr1); -can be generated with the same tools; +SHA512-based crypt method, $6$. + + + + + + +Additionally, the following cross-platform password types are supported: + + + + +hashed with the Apache variant of the MD5-based crypt +method ($apr1$); @@ -108,23 +127,36 @@ “{scheme}data” syntax (1.0.3+) as described in RFC 2307; -currently implemented schemes include PLAIN (an example one, -should not be used), SHA (1.3.13) (plain SHA-1 -hashing, should not be used) and SSHA (salted SHA-1 hashing, -used by some software packages, notably OpenLDAP and Dovecot). - -Support for SHA scheme was added only to aid -in migration from other web servers. -It should not be used for new passwords, since unsalted SHA-1 hashing -that it employs is vulnerable to -rainbow table -attacks. - +supported schemes are +PLAIN (an example one, should not be used), +SHA (1.3.13) (plain SHA-1 hashing, +insecure and should not be used), +and SSHA (salted SHA-1 hashing, +also insecure by today's standards). + +Password hashes for common hashing methods can be generated using +the “openssl passwd” command, for example: + + +$ openssl passwd -apr1 secret +$apr1$x/muFo1c$zwUN24M2TEq.6wg0AZacn0 + + +$ openssl passwd -6 secret +$6$FjZ1ss8ytcGmrGFY$1fopTJLuLUGCRlv2YcRPIsZk9uaD9NBOGcKsUay/BLV3RR1ol0ONS08oPTVqA4XBkZ44M7OL4K6NjP9xPKShP0 + + + + +Note that HTTP Basic Authentication implies password validation on each +request, and password hashing method should be choosen with this in mind. + +
diff -r f7e9bd7de0f9 -r aea3e104f11d xml/ru/docs/http/ngx_http_auth_basic_module.xml --- a/xml/ru/docs/http/ngx_http_auth_basic_module.xml Tue Aug 13 17:45:23 2024 +0300 +++ b/xml/ru/docs/http/ngx_http_auth_basic_module.xml Sat Aug 31 05:19:25 2024 +0300 @@ -10,7 +10,7 @@ + rev="12">
@@ -89,18 +89,35 @@ -Поддерживаются следующие типы паролей: +Пароли должны быть зашифрованы +функцией crypt(). +Доступны все методы хэширования паролей, поддерживаемые операционной системой. +В частности, распространены следующие методы хэширования: + -зашифрованные функцией crypt; могут быть созданы -с помощью утилиты “htpasswd” из дистрибутива HTTP-сервера -Apache или команды “openssl passwd”; +основанный на MD5 метод, $1$; + + + +основанный на SHA256 метод, $5$; -хэшированные с помощью алгоритма, основанного на MD5, по версии Apache (apr1); -могут быть созданы теми же инструментами; +основанный на SHA512 метод, $6$. + + + + + + +Кроме того, поддерживаются следующие кросс-платформенные типы паролей: + + + +хэшированные с помощью основанного на MD5 метода по версии Apache +($apr1$); @@ -111,20 +128,31 @@ в настоящий момент реализованы схемы PLAIN (в качестве примера, не следует применять), SHA (1.3.13) (простое SHA-1 хэширование, не следует применять) и SSHA (SHA-1 хэширование -с солью, используется в некоторых программах, в частности OpenLDAP -и Dovecot). - -Поддержка схемы SHA была добавлена лишь для облегчения -процесса миграции файлов паролей с других веб-серверов. -Её не следует применять для новых паролей, т.к. используемое при этом -SHA-1 хэширование без соли уязвимо к взлому при помощи -радужных таблиц. - +с солью, также небезопасно по современным стандартам). + +Хэши паролей для распространнённых методов хэширования могут быть сгенерированы +с помощью команды “openssl passwd”, например: + + +$ openssl passwd -apr1 secret +$apr1$x/muFo1c$zwUN24M2TEq.6wg0AZacn0 + + +$ openssl passwd -6 secret +$6$FjZ1ss8ytcGmrGFY$1fopTJLuLUGCRlv2YcRPIsZk9uaD9NBOGcKsUay/BLV3RR1ol0ONS08oPTVqA4XBkZ44M7OL4K6NjP9xPKShP0 + + + + +При выборе метода хэширования паролей следует учитывать, что +HTTP Basic Authentication подразумевает проверку пароля при каждом запросе. + +