Skip to content

Commit ed78ab6

Browse files
committed
Remove support for MD5/SHA1/MySQL for password hashing
1 parent 1551b0c commit ed78ab6

21 files changed

+22
-964
lines changed

README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,8 @@ sample output of 'pure-ftpwho -v':
14461446
After an upload, any external program or shell script can be spawned with the
14471447
name of the newly uploaded file as an argument. You can use that feature to
14481448
automatically send a mail when a new file arrives. Or you can pass it to a
1449-
moderation system, an anti-virus, a MD5 signature generator or whatever you
1450-
decide can be done with a file.
1449+
moderation system, an anti-virus, a digest generator or whatever you decide
1450+
can be done with a file.
14511451

14521452
To support this, the server has to be configured --with-uploadscript at
14531453
compilation time. Upload scripts won't be spawned on unreadable directories.

README.LDAP

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,7 @@ userPassword: {scrypt}$7$C6..../....YzvCLmJDYJpH76BxlZB9fCpCEj2AbGQHoLiG9I/VRO1$
168168

169169

170170
'userPassword' is the password hashed with the system 'crypt' function,
171-
MD5, SHA, SMD5, SSHA, SCRYPT or ARGON2.
172-
173-
Do not use MD5, SHA, SMD5 or SSHA except if you really have to. Use {crypt}
174-
with the strongest algorithm supported by your implementation. Or better,
175-
use {scrypt} or {argon2}.
171+
SCRYPT or ARGON2.
176172

177173
Please note that a login can only contains common characters: A...Z, a...z,
178174
0...9, -, ., _, space, :, @ and ' . For paranoia purposes, other characters

README.MySQL

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,12 @@ You just have to have fields with the following info:
8787
- The user's login.
8888

8989
- The user's password, hashed using argon2 (argon2id or argon2i), scrypt or
90-
crypt(3). SHA1, MD5, and MySQL's password() format are supported for legacy
91-
reasons, but shouldn't be used any more. Pure-FTPd also accepts the "any"
92-
value for the MySQLCrypt field. With "any", all hash functions are
93-
sequentially tried.
94-
95-
* RECOMMENDATION: Do not use SHA1, MD5, or, obviously, plaintext. Unless your
96-
system provides a decent crypt() function, use a MySQL function to verify
97-
the hashed password or use argon2/scrypt.
90+
crypt(3). Pure-FTPd also accepts the "any" value for the MySQLCrypt field.
91+
With "any", all hash functions are sequentially tried.
92+
93+
* RECOMMENDATION: Do not use plaintext. Unless your system provides a decent
94+
crypt() function, use a MySQL function to verify the hashed password or use
95+
argon2/scrypt.
9896
9997
- The system uid to map the user to. This can be a numeric id or a user
10098
name, looked up at run-time.

README.PGSQL

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ You just have to have fields with the following info:
8282

8383
- The user's login.
8484
85-
- The user's password, hashed using argon2, scrypt or crypt(3). SHA1 and MD5
86-
are also supported for legacy reasons, but shouldn't be used any more.
85+
- The user's password, hashed using argon2, scrypt or crypt(3).
8786
Pure-FTPd also accepts the "any" value for the PGSQLCrypt field.
8887
With "any", all hash functions are sequentially tried.
8988

90-
* RECOMMENDATION: Do not use SHA1, MD5, or, obviously, plaintext. Unless your
91-
system provides a decent crypt() function, use a PostgreSQL function to verify
92-
the hashed password or use argon2/scrypt.
89+
* RECOMMENDATION: Do not use plaintext. Unless your system provides a
90+
decent crypt() function, use a PostgreSQL function to verify the hashed
91+
password or use argon2/scrypt.
9392

9493
- The system uid to map the user to. This can be a numeric id or a user
9594
name, looked up at run-time.

README.Virtual-Users

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ Fields can be left empty (exceptions: account, password, uid, gid, home
5353
directory) .
5454

5555
Passwords are compatible with the hashing function used in /etc/passwd or
56-
/etc/master.passwd . They are crypto hashed with blowfish, md5, multiple-des
57-
and simple des, in this order, according to what your system has support fort.
56+
/etc/master.passwd.
5857

5958

6059
------------------------ CREATING A NEW USER ------------------------

configure.ac

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,59 +1132,6 @@ AC_DEFINE(USE_BUILTIN_REALPATH)
11321132
],[AC_MSG_RESULT(no)
11331133
AC_DEFINE(USE_BUILTIN_REALPATH)])
11341134

1135-
AC_MSG_CHECKING(whether you already have a standard MD5 implementation)
1136-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1137-
#include <stdio.h>
1138-
#include <stdio.h>
1139-
#include <string.h>
1140-
#include <sys/types.h>
1141-
#include <md5.h>
1142-
1143-
int main(void)
1144-
{
1145-
MD5_CTX ctx;
1146-
char b[33];
1147-
1148-
MD5Init(&ctx);
1149-
MD5Update(&ctx, (const unsigned char *) "test", 4U);
1150-
MD5End(&ctx, b);
1151-
b[32] = 0;
1152-
1153-
return strcasecmp(b, "098f6bcd4621d373cade4e832627b4f6");
1154-
}
1155-
]])],[
1156-
AC_MSG_RESULT(yes)
1157-
AC_DEFINE(USE_SYSTEM_CRYPT_MD5,,[Define if you already have standard
1158-
MD5 functions])
1159-
],[AC_MSG_RESULT(no)
1160-
],[AC_MSG_RESULT(assuming no)])
1161-
1162-
AC_MSG_CHECKING(whether you already have a standard SHA1 implementation)
1163-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1164-
#include <stdio.h>
1165-
#include <string.h>
1166-
#include <sys/types.h>
1167-
#include <sha1.h>
1168-
1169-
int main(void)
1170-
{
1171-
SHA1_CTX ctx;
1172-
char b[41];
1173-
1174-
SHA1Init(&ctx);
1175-
SHA1Update(&ctx, (const unsigned char *) "test", 4U);
1176-
SHA1End(&ctx, b);
1177-
b[40] = 0;
1178-
1179-
return strcasecmp(b, "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3");
1180-
}
1181-
]])],[
1182-
AC_MSG_RESULT(yes)
1183-
AC_DEFINE(USE_SYSTEM_CRYPT_SHA1,,[Define if you already have standard
1184-
SHA1 functions])
1185-
],[AC_MSG_RESULT(no)
1186-
],[AC_MSG_RESULT(assuming no)])
1187-
11881135
AC_MSG_CHECKING([whether we are inside a Virtuozzo virtual host])
11891136
if test -d /proc/vz; then
11901137
AC_MSG_RESULT(yes)

pureftpd-mysql.conf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ MYSQLDatabase pureftpd
3838

3939

4040
# Mandatory : how passwords are stored
41-
# Valid values are : "cleartext", "argon2", "scrypt", "crypt", "sha1", "md5", "password" and "any"
42-
# ("password" = MySQL password() function, which is sha1(sha1(password)))
41+
# Valid values are : "cleartext", "argon2", "scrypt", "crypt", and "any"
4342

44-
MYSQLCrypt scrypt
43+
MYSQLCrypt argon2
4544

4645

4746
# In the following directives, parts of the strings are replaced at

pureftpd-pgsql.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ PGSQLDatabase pureftpd
3535

3636

3737
# Mandatory : how passwords are stored
38-
# Valid values are : "cleartext", "argon2", "scrypt", "crypt", "md5", "sha1" and "any"
38+
# Valid values are : "cleartext", "argon2", "scrypt", "crypt", and "any"
3939

40-
PGSQLCrypt scrypt
40+
PGSQLCrypt argon2
4141

4242

4343
# In the following directives, parts of the strings are replaced at

src/Makefile.am

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ libpureftpd_a_SOURCES = \
4040
caps.h \
4141
crypto.c \
4242
crypto.h \
43-
crypto-md5.c \
44-
crypto-md5.h \
45-
crypto-sha1.c \
46-
crypto-sha1.h \
4743
daemons.c \
4844
diraliases.h \
4945
diraliases.c \

0 commit comments

Comments
 (0)