From: Joe Orton Date: Tue, 5 Mar 2024 13:10:50 +0000 (+0000) Subject: Merge r1862611, r1877693, r1878703, r1884207 from trunk: X-Git-Tag: 2.4.59-rc1-candidate~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72bef51a8d10804411259488f96013fd6bdb0d7d;p=thirdparty%2Fapache%2Fhttpd.git Merge r1862611, r1877693, r1878703, r1884207 from trunk: * support/htpasswd.c (usage): Document SHA-256/512 support. Windows : do not include ap_config_auto.h * support/htpasswd.c (usage): Fix typo. Fix misleading crypt vs hash terminology in ht* and dbmmanage tools. What the htpasswd, htdbm and dbmmanage tools do is hashing passwords, not encrypting them, so fix the terminology in manpages, docs, --help, comments and function names. Submitted by: Michele Preziuso , jorton, steffenal, ylavic Github: closes #408 Reviewed by: jorton, ylavic, jfclere git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1916129 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 091c529c1e8..6e19ca9e5bc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.59 + *) htpasswd, htdbm, dbmmanage: Update help&docs to refer to + "hashing", rather than "encrypting" passwords. + [Michele Preziuso ] + *) mod_ssl: Fix build with LibreSSL 2.0.7+. PR 64047. [Giovanni Bechis, Yann Ylavic] diff --git a/docs/man/dbmmanage.1 b/docs/man/dbmmanage.1 index 30452b987fa..43c342c340d 100644 --- a/docs/man/dbmmanage.1 +++ b/docs/man/dbmmanage.1 @@ -59,7 +59,7 @@ The filename of the DBM format file\&. Usually without the extension \fB\&.db\fR The user for which the operations are performed\&. The \fIusername\fR may not contain a colon (\fB:\fR)\&. .TP \fB\fIencpasswd\fR\fR -This is the already encrypted password to use for the \fBupdate\fR and \fBadd\fR commands\&. You may use a hyphen (\fB-\fR) if you want to get prompted for the password, but fill in the fields afterwards\&. Additionally when using the \fBupdate\fR command, a period (\fB\&.\fR) keeps the original password untouched\&. +This is the already hashed password to use for the \fBupdate\fR and \fBadd\fR commands\&. You may use a hyphen (\fB-\fR) if you want to get prompted for the password, but fill in the fields afterwards\&. Additionally when using the \fBupdate\fR command, a period (\fB\&.\fR) keeps the original password untouched\&. .TP \fB\fIgroup\fR\fR A group, which the user is member of\&. A groupname may not contain a colon (\fB:\fR)\&. You may use a hyphen (\fB-\fR) if you don't want to assign the user to a group, but fill in the comment field\&. Additionally when using the \fBupdate\fR command, a period (\fB\&.\fR) keeps the original groups untouched\&. @@ -72,13 +72,13 @@ This is the place for your opaque comments about the user, like realname, mailad .TP \fB-d\fR -crypt encryption (default, except on Win32, Netware) +crypt hashing (default, except on Win32, Netware) .TP \fB-m\fR -MD5 encryption (default on Win32, Netware) +MD5 hashing (default on Win32, Netware) .TP \fB-s\fR -SHA1 encryption +SHA1 hashing .TP \fB-p\fR plaintext (\fInot recommended\fR) @@ -88,7 +88,7 @@ plaintext (\fInot recommended\fR) .TP \fBadd\fR -Adds an entry for \fIusername\fR to \fIfilename\fR using the encrypted password \fIencpasswd\fR\&. dbmmanage passwords\&.dat add rbowen foKntnEF3KSXA +Adds an entry for \fIusername\fR to \fIfilename\fR using the hashed password \fIencpasswd\fR\&. dbmmanage passwords\&.dat add rbowen foKntnEF3KSXA .TP \fBadduser\fR Asks for a password and then adds an entry for \fIusername\fR to \fIfilename\fR\&. dbmmanage passwords\&.dat adduser krietz diff --git a/docs/man/htdbm.1 b/docs/man/htdbm.1 index 8c18c6e3ad2..231193bcdf5 100644 --- a/docs/man/htdbm.1 +++ b/docs/man/htdbm.1 @@ -74,19 +74,19 @@ Create the \fIpasswdfile\fR\&. If \fIpasswdfile\fR already exists, it is rewritt Display the results on standard output rather than updating a database\&. This option changes the syntax of the command line, since the \fIpasswdfile\fR argument (usually the first one) is omitted\&. It cannot be combined with the \fB-c\fR option\&. .TP \fB-m\fR -Use MD5 encryption for passwords\&. On Windows and Netware, this is the default\&. +Use MD5 hashing for passwords\&. On Windows and Netware, this is the default\&. .TP \fB-B\fR -Use bcrypt encryption for passwords\&. This is currently considered to be very secure\&. +Use bcrypt hashing for passwords\&. This is currently considered to be very secure\&. .TP \fB-C\fR -This flag is only allowed in combination with \fB-B\fR (bcrypt encryption)\&. It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31)\&. +This flag is only allowed in combination with \fB-B\fR (bcrypt hashing)\&. It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31)\&. .TP \fB-d\fR -Use \fBcrypt()\fR encryption for passwords\&. The default on all platforms but Windows and Netware\&. Though possibly supported by \fBhtdbm\fR on all platforms, it is not supported by the httpd server on Windows and Netware\&. This algorithm is \fBinsecure\fR by today's standards\&. +Use \fBcrypt()\fR hashing for passwords\&. The default on all platforms but Windows and Netware\&. Though possibly supported by \fBhtdbm\fR on all platforms, it is not supported by the httpd server on Windows and Netware\&. This algorithm is \fBinsecure\fR by today's standards\&. .TP \fB-s\fR -Use SHA encryption for passwords\&. Facilitates migration from/to Netscape servers using the LDAP Directory Interchange Format (ldif)\&. This algorithm is \fBinsecure\fR by today's standards\&. +Use SHA hashing for passwords\&. Facilitates migration from/to Netscape servers using the LDAP Directory Interchange Format (ldif)\&. This algorithm is \fBinsecure\fR by today's standards\&. .TP \fB-p\fR Use plaintext passwords\&. Though \fBhtdbm\fR will support creation on all platforms, the httpd daemon will only accept plain text passwords on Windows and Netware\&. @@ -110,7 +110,7 @@ The filename of the DBM format file\&. Usually without the extension \fB\&.db\fR The username to create or update in \fIpasswdfile\fR\&. If \fIusername\fR does not exist in this file, an entry is added\&. If it does exist, the password is changed\&. .TP \fB\fIpassword\fR\fR -The plaintext password to be encrypted and stored in the DBM file\&. Used only with the \fB-b\fR flag\&. +The plaintext password to be hashed and stored in the DBM file\&. Used only with the \fB-b\fR flag\&. .TP \fB-T\fIDBTYPE\fR\fR Type of DBM file (SDBM, GDBM, DB, or "default")\&. @@ -137,7 +137,7 @@ One can usually use the \fBfile\fR program supplied with most Unix systems to se .fi .PP -Adds or modifies the password for user \fBjsmith\fR\&. The user is prompted for the password\&. If executed on a Windows system, the password will be encrypted using the modified Apache MD5 algorithm; otherwise, the system's \fBcrypt()\fR routine will be used\&. If the file does not exist, \fBhtdbm\fR will do nothing except return an error\&. +Adds or modifies the password for user \fBjsmith\fR\&. The user is prompted for the password\&. If executed on a Windows system, the password will be hashed using the modified Apache MD5 algorithm; otherwise, the system's \fBcrypt()\fR routine will be used\&. If the file does not exist, \fBhtdbm\fR will do nothing except return an error\&. .nf @@ -163,13 +163,13 @@ Encrypts the password from the command line (\fBPwd4Steve\fR) using the MD5 algo Web password files such as those managed by \fBhtdbm\fR should \fInot\fR be within the Web server's URI space -- that is, they should not be fetchable with a browser\&. .PP -The use of the \fB-b\fR option is discouraged, since when it is used the unencrypted password appears on the command line\&. +The use of the \fB-b\fR option is discouraged, since when it is used the plaintext password appears on the command line\&. .PP When using the \fBcrypt()\fR algorithm, note that only the first 8 characters of the password are used to form the password\&. If the supplied password is longer, the extra characters will be silently discarded\&. .PP -The SHA encryption format does not use salting: for a given password, there is only one encrypted representation\&. The \fBcrypt()\fR and MD5 formats permute the representation by prepending a random salt string, to make dictionary attacks against the passwords more difficult\&. +The SHA hashing format does not use salting: for a given password, there is only one hashed representation\&. The \fBcrypt()\fR and MD5 formats permute the representation by prepending a random salt string, to make dictionary attacks against the passwords more difficult\&. .PP The SHA and \fBcrypt()\fR formats are insecure by today's standards\&. @@ -177,10 +177,10 @@ The SHA and \fBcrypt()\fR formats are insecure by today's standards\&. .SH "RESTRICTIONS" .PP -On the Windows platform, passwords encrypted with \fBhtdbm\fR are limited to no more than \fB255\fR characters in length\&. Longer passwords will be truncated to 255 characters\&. +On the Windows platform, passwords hashed with \fBhtdbm\fR are limited to no more than \fB255\fR characters in length\&. Longer passwords will be truncated to 255 characters\&. .PP -The MD5 algorithm used by \fBhtdbm\fR is specific to the Apache software; passwords encrypted using it will not be usable with other Web servers\&. +The MD5 algorithm used by \fBhtdbm\fR is specific to the Apache software; passwords hashed using it will not be usable with other Web servers\&. .PP Usernames are limited to \fB255\fR bytes and may not include the character \fB:\fR\&. diff --git a/docs/man/htpasswd.1 b/docs/man/htpasswd.1 index 2bf84054ff0..3f3c05dc898 100644 --- a/docs/man/htpasswd.1 +++ b/docs/man/htpasswd.1 @@ -45,10 +45,10 @@ htpasswd \- Manage user files for basic authentication \fBhtpasswd\fR is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users\&. If \fBhtpasswd\fR cannot access a file, such as not being able to write to the output file or not being able to read the file in order to update it, it returns an error status and makes no changes\&. .PP -Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by \fBhtpasswd\fR\&. This program can only manage usernames and passwords stored in a flat-file\&. It can encrypt and display password information for use in other types of data stores, though\&. To use a DBM database see dbmmanage or htdbm\&. +Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by \fBhtpasswd\fR\&. This program can only manage usernames and passwords stored in a flat-file\&. It can hash and display password information for use in other types of data stores, though\&. To use a DBM database see dbmmanage or htdbm\&. .PP -\fBhtpasswd\fR encrypts passwords using either bcrypt, a version of MD5 modified for Apache, SHA-1, or the system's \fBcrypt()\fR routine\&. SHA-2-based hashes (SHA-256 and SHA-512) are supported for \fBcrypt()\fR\&. Files managed by \fBhtpasswd\fR may contain a mixture of different encoding types of passwords; some user records may have bcrypt or MD5-encrypted passwords while others in the same file may have passwords encrypted with \fBcrypt()\fR\&. +\fBhtpasswd\fR hashes passwords using either bcrypt, a version of MD5 modified for Apache, SHA-1, or the system's \fBcrypt()\fR routine\&. SHA-2-based hashes (SHA-256 and SHA-512) are supported for \fBcrypt()\fR\&. Files managed by \fBhtpasswd\fR may contain a mixture of different encoding types of passwords; some user records may have bcrypt or MD5-hashed passwords while others in the same file may have passwords hashed with \fBcrypt()\fR\&. .PP This manual page only lists the command line arguments\&. For details of the directives necessary to configure user authentication in httpd see the Apache manual, which is part of the Apache distribution or can be found at http://httpd\&.apache\&.org/\&. @@ -71,7 +71,7 @@ Create the \fIpasswdfile\fR\&. If \fIpasswdfile\fR already exists, it is rewritt Display the results on standard output rather than updating a file\&. This is useful for generating password records acceptable to Apache for inclusion in non-text data stores\&. This option changes the syntax of the command line, since the \fIpasswdfile\fR argument (usually the first one) is omitted\&. It cannot be combined with the \fB-c\fR option\&. .TP \fB-m\fR -Use MD5 encryption for passwords\&. This is the default (since version 2\&.2\&.18)\&. +Use MD5 hashing for passwords\&. This is the default (since version 2\&.2\&.18)\&. .TP \fB-2\fR Use SHA-256 \fBcrypt()\fR based hashes for passwords\&. This is supported on most Unix platforms\&. @@ -80,19 +80,19 @@ Use SHA-256 \fBcrypt()\fR based hashes for passwords\&. This is supported on mos Use SHA-512 \fBcrypt()\fR based hashes for passwords\&. This is supported on most Unix platforms\&. .TP \fB-B\fR -Use bcrypt encryption for passwords\&. This is currently considered to be very secure\&. +Use bcrypt hashing for passwords\&. This is currently considered to be very secure\&. .TP \fB-C\fR -This flag is only allowed in combination with \fB-B\fR (bcrypt encryption)\&. It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 17)\&. +This flag is only allowed in combination with \fB-B\fR (bcrypt hashing)\&. It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 17)\&. .TP \fB-r\fR This flag is only allowed in combination with \fB-2\fR or \fB-5\fR\&. It sets the number of hash rounds used for the SHA-2 algorithms (higher is more secure but slower; the default is 5,000)\&. .TP \fB-d\fR -Use \fBcrypt()\fR encryption for passwords\&. This is not supported by the httpd server on Windows and Netware\&. This algorithm limits the password length to 8 characters\&. This algorithm is \fBinsecure\fR by today's standards\&. It used to be the default algorithm until version 2\&.2\&.17\&. +Use \fBcrypt()\fR hashing for passwords\&. This is not supported by the httpd server on Windows and Netware\&. This algorithm limits the password length to 8 characters\&. This algorithm is \fBinsecure\fR by today's standards\&. It used to be the default algorithm until version 2\&.2\&.17\&. .TP \fB-s\fR -Use SHA-1 (160-bit) encryption for passwords\&. Facilitates migration from/to Netscape servers using the LDAP Directory Interchange Format (ldif)\&. This algorithm is \fBinsecure\fR by today's standards\&. +Use SHA-1 (160-bit) hashing for passwords\&. Facilitates migration from/to Netscape servers using the LDAP Directory Interchange Format (ldif)\&. This algorithm is \fBinsecure\fR by today's standards\&. .TP \fB-p\fR Use plaintext passwords\&. Though \fBhtpasswd\fR will support creation on all platforms, the httpd daemon will only accept plain text passwords on Windows and Netware\&. @@ -110,7 +110,7 @@ Name of the file to contain the user name and password\&. If \fB-c\fR is given, The username to create or update in \fIpasswdfile\fR\&. If \fIusername\fR does not exist in this file, an entry is added\&. If it does exist, the password is changed\&. .TP \fB\fIpassword\fR\fR -The plaintext password to be encrypted and stored in the file\&. Only used with the \fB-b\fR flag\&. +The plaintext password to be hashed and stored in the file\&. Only used with the \fB-b\fR flag\&. .SH "EXIT STATUS" @@ -126,7 +126,7 @@ The plaintext password to be encrypted and stored in the file\&. Only used with .fi .PP -Adds or modifies the password for user \fBjsmith\fR\&. The user is prompted for the password\&. The password will be encrypted using the modified Apache MD5 algorithm\&. If the file does not exist, \fBhtpasswd\fR will do nothing except return an error\&. +Adds or modifies the password for user \fBjsmith\fR\&. The user is prompted for the password\&. The password will be hashed using the modified Apache MD5 algorithm\&. If the file does not exist, \fBhtpasswd\fR will do nothing except return an error\&. .nf @@ -155,13 +155,13 @@ Web password files such as those managed by \fBhtpasswd\fR should \fInot\fR be w This program is not safe as a setuid executable\&. Do \fInot\fR make it setuid\&. .PP -The use of the \fB-b\fR option is discouraged, since when it is used the unencrypted password appears on the command line\&. +The use of the \fB-b\fR option is discouraged, since when it is used the plaintext password appears on the command line\&. .PP When using the \fBcrypt()\fR algorithm, note that only the first 8 characters of the password are used to form the password\&. If the supplied password is longer, the extra characters will be silently discarded\&. .PP -The SHA-1 encryption format does not use salting: for a given password, there is only one encrypted representation\&. The \fBcrypt()\fR and MD5 formats permute the representation by prepending a random salt string, to make dictionary attacks against the passwords more difficult\&. +The SHA-1 hashing option does not use salting: for a given password, there is only one hashed representation\&. The \fBcrypt()\fR and MD5 formats permute the representation by prepending a random salt string, to make dictionary attacks against the passwords more difficult\&. .PP The SHA-1 and \fBcrypt()\fR formats are insecure by today's standards\&. @@ -172,10 +172,10 @@ The SHA-2-based \fBcrypt()\fR formats (SHA-256 and SHA-512) are supported on mos .SH "RESTRICTIONS" .PP -On the Windows platform, passwords encrypted with \fBhtpasswd\fR are limited to no more than \fB255\fR characters in length\&. Longer passwords will be truncated to 255 characters\&. +On the Windows platform, passwords hashed with \fBhtpasswd\fR are limited to no more than \fB255\fR characters in length\&. Longer passwords will be truncated to 255 characters\&. .PP -The MD5 algorithm used by \fBhtpasswd\fR is specific to the Apache software; passwords encrypted using it will not be usable with other Web servers\&. +The MD5 algorithm used by \fBhtpasswd\fR is specific to the Apache software; passwords hashed using it will not be usable with other Web servers\&. .PP Usernames are limited to \fB255\fR bytes and may not include the character \fB:\fR\&. diff --git a/docs/manual/programs/dbmmanage.xml b/docs/manual/programs/dbmmanage.xml index b40fbe0d9f5..86985512a01 100644 --- a/docs/manual/programs/dbmmanage.xml +++ b/docs/manual/programs/dbmmanage.xml @@ -73,7 +73,7 @@ may not contain a colon (:).
encpasswd
-
This is the already encrypted password to use for the +
This is the already hashed password to use for the update and add commands. You may use a hyphen (-) if you want to get prompted for the password, but fill in the fields afterwards. Additionally when using the update @@ -96,13 +96,13 @@
Encodings
-d
-
crypt encryption (default, except on Win32, Netware)
+
crypt hashing (default, except on Win32, Netware)
-m
-
MD5 encryption (default on Win32, Netware)
+
MD5 hashing (default on Win32, Netware)
-s
-
SHA1 encryption
+
SHA1 hashing
-p
plaintext (not recommended)
@@ -113,7 +113,7 @@
add
Adds an entry for username to filename using the - encrypted password encpasswd. + hashed password encpasswd. dbmmanage passwords.dat add rbowen foKntnEF3KSXA
diff --git a/docs/manual/programs/htdbm.xml b/docs/manual/programs/htdbm.xml index 79d08b6f842..d815a45b1b4 100644 --- a/docs/manual/programs/htdbm.xml +++ b/docs/manual/programs/htdbm.xml @@ -147,27 +147,27 @@ cannot be combined with the -c option.
-m
-
Use MD5 encryption for passwords. On Windows and Netware, this is +
Use MD5 hashing for passwords. On Windows and Netware, this is the default.
-B
-
Use bcrypt encryption for passwords. This is currently considered to +
Use bcrypt hashing for passwords. This is currently considered to be very secure.
-C
This flag is only allowed in combination with -B (bcrypt - encryption). It sets the computing time used for the bcrypt algorithm + hashing). It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 31).
-d
-
Use crypt() encryption for passwords. The default on all +
Use crypt() hashing for passwords. The default on all platforms but Windows and Netware. Though possibly supported by htdbm on all platforms, it is not supported by the httpd server on Windows and Netware. This algorithm is insecure by today's standards.
-s
-
Use SHA encryption for passwords. Facilitates migration from/to Netscape +
Use SHA hashing for passwords. Facilitates migration from/to Netscape servers using the LDAP Directory Interchange Format (ldif). This algorithm is insecure by today's standards.
@@ -207,7 +207,7 @@ does exist, the password is changed.
password
-
The plaintext password to be encrypted and stored in the DBM file. +
The plaintext password to be hashed and stored in the DBM file. Used only with the -b flag.
-TDBTYPE
@@ -253,7 +253,7 @@

Adds or modifies the password for user jsmith. The user is prompted for the password. If executed on a Windows system, the password - will be encrypted using the modified Apache MD5 algorithm; otherwise, the + will be hashed using the modified Apache MD5 algorithm; otherwise, the system's crypt() routine will be used. If the file does not exist, htdbm will do nothing except return an error.

@@ -280,14 +280,14 @@ not be fetchable with a browser.

The use of the -b option is discouraged, since when it is - used the unencrypted password appears on the command line.

+ used the plaintext password appears on the command line.

When using the crypt() algorithm, note that only the first 8 characters of the password are used to form the password. If the supplied password is longer, the extra characters will be silently discarded.

-

The SHA encryption format does not use salting: for a given password, - there is only one encrypted representation. The crypt() and +

The SHA hashing option does not use salting: for a given password, + there is only one hashed representation. The crypt() and MD5 formats permute the representation by prepending a random salt string, to make dictionary attacks against the passwords more difficult.

@@ -296,13 +296,13 @@
Restrictions -

On the Windows platform, passwords encrypted with +

On the Windows platform, passwords hashed with htdbm are limited to no more than 255 characters in length. Longer passwords will be truncated to 255 characters.

The MD5 algorithm used by htdbm is specific to the Apache - software; passwords encrypted using it will not be usable with other Web + software; passwords hashed using it will not be usable with other Web servers.

Usernames are limited to 255 bytes and may not include the diff --git a/docs/manual/programs/htpasswd.xml b/docs/manual/programs/htpasswd.xml index e148a17d357..f145382ce3d 100644 --- a/docs/manual/programs/htpasswd.xml +++ b/docs/manual/programs/htpasswd.xml @@ -35,7 +35,7 @@

Resources available from the Apache HTTP server can be restricted to just the users listed in the files created by htpasswd. This program can only manage usernames and passwords stored in a flat-file. It - can encrypt and display password information for use in other types of data + can hash and display password information for use in other types of data stores, though. To use a DBM database see dbmmanage or htdbm.

@@ -46,6 +46,14 @@ types of passwords; some user records may have bcrypt or MD5-encrypted passwords while others in the same file may have passwords encrypted with crypt().

+

htpasswd hashes passwords using either bcrypt, a + version of MD5 modified for Apache, SHA-1, or the system's + crypt() routine. SHA-2-based hashes (SHA-256 and + SHA-512) are supported for crypt(). Files managed by + htpasswd may contain a mixture of different encoding + types of passwords; some user records may have bcrypt or + MD5-hashed passwords while others in the same file may have + passwords hashed with crypt().

This manual page only lists the command line arguments. For details of the directives necessary to configure user authentication in @@ -127,29 +135,30 @@ distribution. one) is omitted. It cannot be combined with the -c option.

-m
-
Use MD5 encryption for passwords. This is the default (since version +
Use MD5 hashing for passwords. This is the default (since version 2.2.18).
-B
-
Use bcrypt encryption for passwords. This is currently considered to +
Use bcrypt hashing for passwords. This is currently considered to be very secure.
-C
This flag is only allowed in combination with -B (bcrypt - encryption). It sets the computing time used for the bcrypt algorithm + hashing). It sets the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 17).
-d
-
Use crypt() encryption for passwords. This is not +
Use crypt() hashing for passwords. This is not supported by the httpd server on Windows and Netware. This algorithm limits the password length to 8 characters. This algorithm is insecure by today's standards. It used to be the default algorithm until version 2.2.17.
-s
-
Use SHA encryption for passwords. Facilitates migration from/to Netscape - servers using the LDAP Directory Interchange Format (ldif). - This algorithm is insecure by today's standards.
+
Use SHA-1 (160-bit) hashing for passwords. Facilitates migration + from/to Netscape servers using the LDAP Directory Interchange + Format (ldif). This algorithm is insecure by + today's standards.
-p
Use plaintext passwords. Though htpasswd will support @@ -176,7 +185,7 @@ distribution. does exist, the password is changed.
password
-
The plaintext password to be encrypted and stored in the file. Only +
The plaintext password to be hashed and stored in the file. Only used with the -b flag.
@@ -201,7 +210,7 @@ distribution.

Adds or modifies the password for user jsmith. The user - is prompted for the password. The password will be encrypted using the + is prompted for the password. The password will be hashed using the modified Apache MD5 algorithm. If the file does not exist, htpasswd will do nothing except return an error.

@@ -232,29 +241,30 @@ distribution. setuid.

The use of the -b option is discouraged, since when it is - used the unencrypted password appears on the command line.

+ used the plaintext password appears on the command line.

When using the crypt() algorithm, note that only the first 8 characters of the password are used to form the password. If the supplied password is longer, the extra characters will be silently discarded.

-

The SHA encryption format does not use salting: for a given password, - there is only one encrypted representation. The crypt() and - MD5 formats permute the representation by prepending a random salt string, - to make dictionary attacks against the passwords more difficult.

+

The SHA-1 hashing format does not use salting: for a given + password, there is only one hashed representation. The + crypt() and MD5 formats permute the representation by + prepending a random salt string, to make dictionary attacks + against the passwords more difficult.

The SHA and crypt() formats are insecure by today's standards.

Restrictions -

On the Windows platform, passwords encrypted with +

On the Windows platform, passwords hashed with htpasswd are limited to no more than 255 characters in length. Longer passwords will be truncated to 255 characters.

The MD5 algorithm used by htpasswd is specific to the Apache - software; passwords encrypted using it will not be usable with other Web + software; passwords hashed using it will not be usable with other Web servers.

Usernames are limited to 255 bytes and may not include the diff --git a/support/dbmmanage.in b/support/dbmmanage.in index 2dd8c8679ba..881d2301adb 100644 --- a/support/dbmmanage.in +++ b/support/dbmmanage.in @@ -32,9 +32,9 @@ sub usage { die <adduser; } else { @@ -255,23 +255,23 @@ sub dbmc::update { } sub dbmc::add { - die "Can't use empty password!\n" unless $crypted_pwd; + die "Can't use empty password!\n" unless $hashed_pwd; unless($is_update) { die "Sorry, user `$key' already exists!\n" if $DB{$key}; } $groups = '' if $groups eq '-'; $comment = '' if $comment eq '-'; $groups .= ":" . $comment if $comment; - $crypted_pwd .= ":" . $groups if $groups; - $DB{$key} = $crypted_pwd; + $hashed_pwd .= ":" . $groups if $groups; + $DB{$key} = $hashed_pwd; my $action = $is_update ? "updated" : "added"; - print "User $key $action with password encrypted to $DB{$key} using $crypt_method\n"; + print "User $key $action with password hashed to $DB{$key} using $hash_method\n"; } sub dbmc::adduser { my $value = getpass "New password:"; die "They don't match, sorry.\n" unless getpass("Re-type new password:") eq $value; - $crypted_pwd = cryptpw $value; + $hashed_pwd = hashpw $value; dbmc->add; } @@ -289,23 +289,23 @@ sub dbmc::check { my $chkpass = (split /:/, $DB{$key}, 3)[0]; my $testpass = getpass(); if (substr($chkpass, 0, 6) eq '$apr1$') { - need_md5_crypt; - $crypt_method = "md5"; + need_md5_hash; + $hash_method = "md5"; } elsif (substr($chkpass, 0, 5) eq '{SHA}') { - need_sha1_crypt; - $crypt_method = "sha1"; + need_sha1_hash; + $hash_method = "sha1"; } elsif (length($chkpass) == 13 && $chkpass ne $testpass) { - $crypt_method = "crypt"; + $hash_method = "crypt"; } else { - $crypt_method = "plain"; + $hash_method = "plain"; } - print $crypt_method . (cryptpw($testpass, $chkpass) eq $chkpass - ? " password ok\n" : " password mismatch\n"); + print $hash_method . (hashpw($testpass, $chkpass) eq $chkpass + ? " password ok\n" : " password mismatch\n"); } sub dbmc::import { while(defined($_ = ) and chomp) { - ($key,$crypted_pwd,$groups,$comment) = split /:/, $_, 4; + ($key,$hashed_pwd,$groups,$comment) = split /:/, $_, 4; dbmc->add; } } diff --git a/support/htdbm.c b/support/htdbm.c index 40a3d232938..c2f8f3f01a7 100644 --- a/support/htdbm.c +++ b/support/htdbm.c @@ -290,13 +290,13 @@ static void htdbm_usage(void) " -n Don't update database; display results on stdout.\n" " -b Use the password from the command line rather than prompting for it.\n" " -i Read password from stdin without verification (for script usage).\n" - " -m Force MD5 encryption of the password (default).\n" - " -B Force BCRYPT encryption of the password (very secure).\n" + " -m Force MD5 hashing of the password (default).\n" + " -B Force BCRYPT hashing of the password (very secure).\n" " -C Set the computing time used for the bcrypt algorithm\n" " (higher is more secure but slower, default: %d, valid: 4 to 31).\n" - " -d Force CRYPT encryption of the password (8 chars max, insecure).\n" - " -s Force SHA encryption of the password (insecure).\n" - " -p Do not encrypt the password (plaintext, insecure).\n" + " -d Force CRYPT hashing of the password (8 chars max, insecure).\n" + " -s Force SHA hashing of the password (insecure).\n" + " -p Do not hash the password (plaintext, insecure).\n" " -T DBM Type (SDBM|GDBM|DB|default).\n" " -l Display usernames from database on stdout.\n" " -v Verify the username/password.\n" diff --git a/support/htpasswd.c b/support/htpasswd.c index 99d8c4416e1..c5765322be3 100644 --- a/support/htpasswd.c +++ b/support/htpasswd.c @@ -108,20 +108,22 @@ static void usage(void) " -b Use the password from the command line rather than prompting " "for it." NL " -i Read password from stdin without verification (for script usage)." NL - " -m Force MD5 encryption of the password (default)." NL - " -2 Force SHA-256 crypt() hash of the password (secure)." NL - " -5 Force SHA-512 crypt() hash of the password (secure)." NL - " -B Force bcrypt aencryption of the password (very secure)." NL + " -m Force MD5 hashing of the password (default)." NL + " -2 Force SHA-256 hashing of the password (secure)." NL + " -5 Force SHA-512 hashing of the password (secure)." NL + " -B Force bcrypt hashing of the password (very secure)." NL " -C Set the computing time used for the bcrypt algorithm" NL " (higher is more secure but slower, default: %d, valid: 4 to 17)." NL - " -d Force CRYPT encryption of the password (8 chars max, insecure)." NL - " -s Force SHA encryption of the password (insecure)." NL - " -p Do not encrypt the password (plaintext, insecure)." NL + " -r Set the number of rounds used for the SHA-256, SHA-512 algorithms" NL + " (higher is more secure but slower, default: 5000)." NL + " -d Force CRYPT hashing of the password (8 chars max, insecure)." NL + " -s Force SHA-1 hashing of the password (insecure)." NL + " -p Do not hash the password (plaintext, insecure)." NL " -D Delete the specified user." NL " -v Verify password for the specified user." NL "On other systems than Windows and NetWare the '-p' flag will " "probably not work." NL - "The SHA algorithm does not use a salt and is less secure than the " + "The SHA-1 algorithm does not use a salt and is less secure than the " "MD5 algorithm." NL, BCRYPT_DEFAULT_COST ); diff --git a/support/passwd_common.h b/support/passwd_common.h index f1b3cd7ec63..874c5e72277 100644 --- a/support/passwd_common.h +++ b/support/passwd_common.h @@ -28,7 +28,9 @@ #include "apu_version.h" #endif +#if !defined(WIN32) && !defined(NETWARE) #include "ap_config_auto.h" +#endif #define MAX_STRING_LEN 256