From 2f7c0c34e6cf7df9d07b9790270fcfacae198c5f Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Wed, 23 Sep 2020 10:09:21 -0400 Subject: [PATCH] Support backslashes in SOC passwords --- salt/common/tools/sbin/so-cortex-user-add | 2 +- salt/common/tools/sbin/so-fleet-user-add | 2 +- salt/common/tools/sbin/so-thehive-user-add | 2 +- salt/common/tools/sbin/so-user | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/salt/common/tools/sbin/so-cortex-user-add b/salt/common/tools/sbin/so-cortex-user-add index dbb5b9716..728ad25f1 100755 --- a/salt/common/tools/sbin/so-cortex-user-add +++ b/salt/common/tools/sbin/so-cortex-user-add @@ -40,7 +40,7 @@ test -t 0 if [[ $? == 0 ]]; then echo "Enter new password:" fi -read -s CORTEX_PASS +read -rs CORTEX_PASS # Create new user in Cortex resp=$(curl -sk -XPOST -H "Authorization: Bearer $CORTEX_KEY" -H "Content-Type: application/json" "https://$CORTEX_IP/cortex/api/user" -d "{\"name\": \"$CORTEX_USER\",\"roles\": [\"read\",\"analyze\",\"orgadmin\"],\"organization\": \"$CORTEX_ORG_NAME\",\"login\": \"$CORTEX_USER\",\"password\" : \"$CORTEX_PASS\" }") diff --git a/salt/common/tools/sbin/so-fleet-user-add b/salt/common/tools/sbin/so-fleet-user-add index 5560b0522..265020091 100755 --- a/salt/common/tools/sbin/so-fleet-user-add +++ b/salt/common/tools/sbin/so-fleet-user-add @@ -39,7 +39,7 @@ test -t 0 if [[ $? == 0 ]]; then echo "Enter new password:" fi -read -s FLEET_PASS +read -rs FLEET_PASS 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 diff --git a/salt/common/tools/sbin/so-thehive-user-add b/salt/common/tools/sbin/so-thehive-user-add index fc7a56f63..3a94d8803 100755 --- a/salt/common/tools/sbin/so-thehive-user-add +++ b/salt/common/tools/sbin/so-thehive-user-add @@ -39,7 +39,7 @@ test -t 0 if [[ $? == 0 ]]; then echo "Enter new password:" fi -read -s THEHIVE_PASS +read -rs THEHIVE_PASS # Create new user in TheHive resp=$(curl -sk -XPOST -H "Authorization: Bearer $THEHIVE_KEY" -H "Content-Type: application/json" "https://$THEHIVE_IP/thehive/api/user" -d "{\"login\" : \"$THEHIVE_USER\",\"name\" : \"$THEHIVE_USER\",\"roles\" : [\"read\",\"alert\",\"write\",\"admin\"],\"preferences\" : \"{}\",\"password\" : \"$THEHIVE_PASS\"}") diff --git a/salt/common/tools/sbin/so-user b/salt/common/tools/sbin/so-user index 2bc97c36a..7b79fc93a 100755 --- a/salt/common/tools/sbin/so-user +++ b/salt/common/tools/sbin/so-user @@ -96,7 +96,7 @@ function updatePassword() { if [[ $? == 0 ]]; then echo "Enter new password:" fi - read -s password + read -rs password validatePassword "$password" fi