mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Hardening password checks
This commit is contained in:
parent
ffdae1dca1
commit
3fdee2975d
4 changed files with 6 additions and 4 deletions
|
@ -82,7 +82,7 @@ if [ -z "$salt" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generating hash
|
# Generating hash
|
||||||
hash=$($BIN/v-generate-password-hash $method $salt <<< $password)
|
hash=$($BIN/v-generate-password-hash $method $salt <<< "$password")
|
||||||
if [[ -z "$hash" ]]; then
|
if [[ -z "$hash" ]]; then
|
||||||
echo "Error: password missmatch"
|
echo "Error: password missmatch"
|
||||||
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
|
echo "$date $time $user $ip failed to login" >> $VESTA/log/auth.log
|
||||||
|
|
|
@ -273,7 +273,7 @@ is_object_value_exist() {
|
||||||
is_password_valid() {
|
is_password_valid() {
|
||||||
if [[ "$password" =~ ^/tmp/ ]]; then
|
if [[ "$password" =~ ^/tmp/ ]]; then
|
||||||
if [ -f "$password" ]; then
|
if [ -f "$password" ]; then
|
||||||
password=$(head -n1 $password)
|
password="$(head -n1 $password)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,15 @@ if (isset($_POST['user']) || isset($_POST['hash'])) {
|
||||||
fwrite($fp, $_POST['password']."\n");
|
fwrite($fp, $_POST['password']."\n");
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
$v_ip_addr = escapeshellarg($_SERVER["REMOTE_ADDR"]);
|
$v_ip_addr = escapeshellarg($_SERVER["REMOTE_ADDR"]);
|
||||||
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." '".$v_ip_addr."'", $output, $auth_code);
|
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".escapeshellarg($v_password)." '".$v_ip_addr."'", $output, $auth_code);
|
||||||
unlink($v_password);
|
unlink($v_password);
|
||||||
|
/* No hash auth for security reason
|
||||||
} else {
|
} else {
|
||||||
$key = '/usr/local/vesta/data/keys/' . basename($_POST['hash']);
|
$key = '/usr/local/vesta/data/keys/' . basename($_POST['hash']);
|
||||||
if (file_exists($key) && is_file($key)) {
|
if (file_exists($key) && is_file($key)) {
|
||||||
$auth_code = '0';
|
$auth_code = '0';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($auth_code != 0 ) {
|
if ($auth_code != 0 ) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ if (isset($_POST['user']) && isset($_POST['password'])) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
// Check user & password
|
// Check user & password
|
||||||
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".$v_password." ".escapeshellarg($_SERVER['REMOTE_ADDR']), $output, $return_var);
|
exec(VESTA_CMD ."v-check-user-password ".$v_user." ".escapeshellarg($v_password)." ".escapeshellarg($_SERVER['REMOTE_ADDR']), $output, $return_var);
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
// Remove tmp file
|
// Remove tmp file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue