Как заставить md5 поддерживаться с ftpasswd

1157
Rob L

Я использую xampp на Mac, пытаясь изменить пароль по умолчанию в proftpd.conf. Я считаю, что мне нужно использовать ftpasswd, чтобы получить новый хэш пароля и заменить старый в proftpd.conf.

Так я и сделал:

ftpasswd --hash 

И дважды набрал мой новый пароль. Но я получил предупреждение:

Вы запросили пароли MD5, но ваша система не поддерживает их. По умолчанию пароли DES.

Как я могу решить это, чтобы получить хэш MD5?

1
С какой стати вы бы использовали хеширование md5 вместо DES? Ramhound 10 лет назад 0
@Ramhound Как мне кажется, proftpd использует md5, не так ли? Я так думаю, потому что я использовал пароль по умолчанию 'xampp' с ** ftpasswd --hash **, результат отличается от хеша в proftpd.conf. Rob L 10 лет назад 0

1 ответ на вопрос

1
Castaglia

The ftpasswd utility that accompanies ProFTPD generates password hashes that are acceptable to the underlying C library's crypt(3) function. So it is not ProFTPD, per se, that is using MD5 password hashes (or DES, or anything else); it is ProFTPD using the crypt(3) function.

On other Unix/Linux flavors, the crypt(3) function can support different hashing algorithms (e.g. DES, MD5, Blowfish, even SHA-256/SHA-512), identified by the first parts of the generated hash. Thus a prefix of "$1$..." might indicate a DES hashed value, "$2$... for MD5, etc. However, not every Unix variant supports this syntax; it looks like the MacOSX crypt(3) function does not.

The ftpasswd calls crypt(3), and examines the returned hash value. If the --md5 command-line option was used (thus requesting MD5 hash values), and the returned hash value does not begin with "$2$...", then ftpasswd indicates that the platform does not support MD5 hashed passwords. Adding such support involves the C library and perhaps other fundamental libraries; it is thus not an easy task.

Alternatives including using a SQL database for your user database (via the mod_sql module); the mod_sql_passwd module of ProFTPD allows for quite a range of password hashing algorithms/functions.

Also, you probably should not be using a default password in your proftpd.conf; such things can all too easily leak out. I'd strongly recommend that you use something like mod_sql, or even a separate AuthUserFile, or something else.

Hope this helps!

Full disclaimer: I'm the author of ProFTPD, and the mod_sql_passwd module.