diff --git a/lib/Froxlor/Api/Commands/Ftps.php b/lib/Froxlor/Api/Commands/Ftps.php index 5a709756..76826087 100644 --- a/lib/Froxlor/Api/Commands/Ftps.php +++ b/lib/Froxlor/Api/Commands/Ftps.php @@ -172,7 +172,7 @@ class Ftps extends ApiCommand implements ResourceEntity Response::standardError('passwordshouldnotbeusername', '', true); } else { $path = FileDir::makeCorrectDir($customer['documentroot'] . '/' . $path); - $cryptPassword = Crypt::makeCryptPassword($password); + $cryptPassword = Crypt::makeCryptPassword($password, false, true); $stmt = Database::prepare("INSERT INTO `" . TABLE_FTP_USERS . "` (`customerid`, `username`, `description`, `password`, `homedir`, `login_enabled`, `uid`, `gid`, `shell`) @@ -441,7 +441,7 @@ class Ftps extends ApiCommand implements ResourceEntity if ($password == $result['username']) { Response::standardError('passwordshouldnotbeusername', '', true); } - $cryptPassword = Crypt::makeCryptPassword($password); + $cryptPassword = Crypt::makeCryptPassword($password, false, true); $stmt = Database::prepare("UPDATE `" . TABLE_FTP_USERS . "` SET `password` = :password diff --git a/lib/Froxlor/System/Crypt.php b/lib/Froxlor/System/Crypt.php index 3050d99a..e0f5330e 100644 --- a/lib/Froxlor/System/Crypt.php +++ b/lib/Froxlor/System/Crypt.php @@ -206,11 +206,10 @@ class Crypt * Password to be encrypted * @param bool $htpasswd * optional whether to generate a SHA1 password for directory protection + * @param bool $openssl + * optional generates $htpasswd like strings but for proftpd * - * @return string encrypted password - * @author Michal Wojcik - * @author Michael Kaufmann - * @author Froxlor team (2010-) + * @return string encrypted password) * * 0 - default crypt (depends on system configuration) * 1 - MD5 $1$ @@ -219,10 +218,10 @@ class Crypt * 4 - SHA-512 $6$ * */ - public static function makeCryptPassword($password, $htpasswd = false) + public static function makeCryptPassword($password, $htpasswd = false, $openssl = false) { - if ($htpasswd) { - return '{SHA}' . base64_encode(sha1($password, true)); + if ($htpasswd || $openssl) { + return '{SHA' . ($openssl ? '1' : '') . '}' . base64_encode(sha1($password, true)); } $algo = Settings::Get('system.passwordcryptfunc') !== null ? Settings::Get('system.passwordcryptfunc') : PASSWORD_DEFAULT; return password_hash($password, $algo); diff --git a/lib/configfiles/bionic.xml b/lib/configfiles/bionic.xml index 41ea3c20..acfd215d 100644 --- a/lib/configfiles/bionic.xml +++ b/lib/configfiles/bionic.xml @@ -4261,7 +4261,7 @@ SQLEngine on SQLAuthenticate on # # Use both an encrypted or plaintext password -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups* diff --git a/lib/configfiles/bookworm.xml b/lib/configfiles/bookworm.xml index e5df151b..7ab16336 100644 --- a/lib/configfiles/bookworm.xml +++ b/lib/configfiles/bookworm.xml @@ -2900,7 +2900,7 @@ SQLEngine on SQLAuthenticate on # # Use both an encrypted or plaintext password -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups* diff --git a/lib/configfiles/bullseye.xml b/lib/configfiles/bullseye.xml index a294c442..ba4b885a 100644 --- a/lib/configfiles/bullseye.xml +++ b/lib/configfiles/bullseye.xml @@ -4472,7 +4472,7 @@ SQLEngine on SQLAuthenticate on # # Use both an encrypted or plaintext password -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups* diff --git a/lib/configfiles/buster.xml b/lib/configfiles/buster.xml index 46f51a1c..3b6d50ca 100644 --- a/lib/configfiles/buster.xml +++ b/lib/configfiles/buster.xml @@ -4463,7 +4463,7 @@ SQLEngine on SQLAuthenticate on # # Use both an encrypted or plaintext password -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups* diff --git a/lib/configfiles/focal.xml b/lib/configfiles/focal.xml index 31b1ba4e..68a9da90 100644 --- a/lib/configfiles/focal.xml +++ b/lib/configfiles/focal.xml @@ -3678,7 +3678,7 @@ SQLEngine on SQLAuthenticate on # # Use both an encrypted or plaintext password -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups* diff --git a/lib/configfiles/gentoo.xml b/lib/configfiles/gentoo.xml index 094f021b..2e4c4069 100644 --- a/lib/configfiles/gentoo.xml +++ b/lib/configfiles/gentoo.xml @@ -3453,7 +3453,7 @@ AllowOverwrite on # SQL settings -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups* SQLConnectInfo @ SQLUserInfo ftp_users username password uid gid homedir shell diff --git a/lib/configfiles/jammy.xml b/lib/configfiles/jammy.xml index 04dd8e36..8c3d91ec 100644 --- a/lib/configfiles/jammy.xml +++ b/lib/configfiles/jammy.xml @@ -3678,7 +3678,7 @@ SQLEngine on SQLAuthenticate on # # Use both an encrypted or plaintext password -SQLAuthTypes Crypt +SQLAuthTypes Crypt OpenSSL SQLAuthenticate users* groups*