mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Consolidate password validation messaging
This commit is contained in:
@@ -99,6 +99,15 @@ check_password() {
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_password_and_exit() {
|
||||||
|
local password=$1
|
||||||
|
if ! check_password "$password"; then
|
||||||
|
echo "Password is invalid. Do not include single quotes, double quotes, dollar signs, and backslashes in the password."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
check_elastic_license() {
|
check_elastic_license() {
|
||||||
|
|
||||||
[ -n "$TESTING" ] && return
|
[ -n "$TESTING" ] && return
|
||||||
|
|||||||
@@ -41,10 +41,7 @@ if [[ $? == 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
read -rs FLEET_PASS
|
read -rs FLEET_PASS
|
||||||
|
|
||||||
if ! check_password "$FLEET_PASS"; then
|
check_password_and_exit "$FLEET_PASS"
|
||||||
echo "Password is invalid. Please exclude single quotes, double quotes, dollar signs, and backslashes from the password."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
FLEET_HASH=$(docker exec so-soctopus python -c "import bcrypt; print(bcrypt.hashpw('$FLEET_PASS'.encode('utf-8'), bcrypt.gensalt()).decode('utf-8'));" 2>&1)
|
FLEET_HASH=$(docker exec so-soctopus python -c "import bcrypt; print(bcrypt.hashpw('$FLEET_PASS'.encode('utf-8'), bcrypt.gensalt()).decode('utf-8'));" 2>&1)
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
|
|||||||
@@ -41,10 +41,7 @@ if [[ $? == 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
read -rs THEHIVE_PASS
|
read -rs THEHIVE_PASS
|
||||||
|
|
||||||
if ! check_password "$THEHIVE_PASS"; then
|
check_password_and_exit "$THEHIVE_PASS"
|
||||||
echo "Password is invalid. Please exclude single quotes, double quotes, dollar signs, and backslashes from the password."
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create new user in TheHive
|
# Create new user in TheHive
|
||||||
resp=$(curl -sk -XPOST -H "Authorization: Bearer $THEHIVE_KEY" -H "Content-Type: application/json" -L "https://$THEHVIE_API_URL/user" -d "{\"login\" : \"$THEHIVE_USER\",\"name\" : \"$THEHIVE_USER\",\"roles\" : [\"read\",\"alert\",\"write\",\"admin\"],\"preferences\" : \"{}\",\"password\" : \"$THEHIVE_PASS\"}")
|
resp=$(curl -sk -XPOST -H "Authorization: Bearer $THEHIVE_KEY" -H "Content-Type: application/json" -L "https://$THEHVIE_API_URL/user" -d "{\"login\" : \"$THEHIVE_USER\",\"name\" : \"$THEHIVE_USER\",\"roles\" : [\"read\",\"alert\",\"write\",\"admin\"],\"preferences\" : \"{}\",\"password\" : \"$THEHIVE_PASS\"}")
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ function validatePassword() {
|
|||||||
if [[ $len -lt 6 ]]; then
|
if [[ $len -lt 6 ]]; then
|
||||||
echo "Password does not meet the minimum requirements"
|
echo "Password does not meet the minimum requirements"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
check_password_and_exit "$password"
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateEmail() {
|
function validateEmail() {
|
||||||
|
|||||||
Reference in New Issue
Block a user