diff --git a/salt/common/tools/sbin/so-fleet-user-add b/salt/common/tools/sbin/so-fleet-user-add index 4b6af2825..5e2e91fe6 100755 --- a/salt/common/tools/sbin/so-fleet-user-add +++ b/salt/common/tools/sbin/so-fleet-user-add @@ -48,7 +48,7 @@ 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) if [[ $? -ne 0 ]]; then - echo "Failed to generate Fleet password hash." + echo "Failed to generate Fleet password hash" exit 2 fi @@ -56,9 +56,9 @@ MYSQL_OUTPUT=$(docker exec so-mysql mysql -u root --password=$MYSQL_PASS fleet - "INSERT INTO users (password,salt,username,email,admin,enabled) VALUES ('$FLEET_HASH','','$FLEET_USER','$FLEET_USER',1,1)" 2>&1) if [[ $? -eq 0 ]]; then - echo "Successfully added user to Fleet." + echo "Successfully added user to Fleet" else - echo "Unable to add user to Fleet; user might already exist." + echo "Unable to add user to Fleet; user might already exist" echo $resp exit 2 fi \ No newline at end of file diff --git a/salt/common/tools/sbin/so-fleet-user-enable b/salt/common/tools/sbin/so-fleet-user-enable index a632844bb..8271993fc 100755 --- a/salt/common/tools/sbin/so-fleet-user-enable +++ b/salt/common/tools/sbin/so-fleet-user-enable @@ -20,7 +20,7 @@ usage() { echo "Usage: $0 " echo "" - echo "Enables or disables a user in Fleet." + echo "Enables or disables a user in Fleet" exit 1 } @@ -50,9 +50,9 @@ MYSQL_OUTPUT=$(docker exec so-mysql mysql -u root --password=$MYSQL_PASS fleet - "UPDATE users SET enabled=$FLEET_STATUS WHERE username='$FLEET_USER'" 2>&1) if [[ $? -eq 0 ]]; then - echo "Successfully updated user in Fleet." + echo "Successfully updated user in Fleet" else - echo "Failed to update user in Fleet." + echo "Failed to update user in Fleet" echo $resp exit 2 fi \ No newline at end of file diff --git a/salt/common/tools/sbin/so-thehive-user-add b/salt/common/tools/sbin/so-thehive-user-add index c0e686805..6ddca526c 100755 --- a/salt/common/tools/sbin/so-thehive-user-add +++ b/salt/common/tools/sbin/so-thehive-user-add @@ -49,9 +49,9 @@ fi # 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\"}") if [[ "$resp" =~ \"status\":\"Ok\" ]]; then - echo "Successfully added user to TheHive." + echo "Successfully added user to TheHive" else - echo "Unable to add user to TheHive; user might already exist." + echo "Unable to add user to TheHive; user might already exist" echo $resp exit 2 fi diff --git a/salt/common/tools/sbin/so-thehive-user-enable b/salt/common/tools/sbin/so-thehive-user-enable index f439b93b8..94430b889 100755 --- a/salt/common/tools/sbin/so-thehive-user-enable +++ b/salt/common/tools/sbin/so-thehive-user-enable @@ -20,7 +20,7 @@ usage() { echo "Usage: $0 " echo "" - echo "Enables or disables a user in thehive." + echo "Enables or disables a user in TheHive." exit 1 } @@ -48,9 +48,9 @@ esac resp=$(curl -sk -XPATCH -H "Authorization: Bearer $THEHIVE_KEY" -H "Content-Type: application/json" "https://$THEHIVE_IP/thehive/api/user/${THEHIVE_USER}" -d "{\"status\":\"${THEHIVE_STATUS}\" }") if [[ "$resp" =~ \"status\":\"Locked\" || "$resp" =~ \"status\":\"Ok\" ]]; then - echo "Successfully updated user in thehive." + echo "Successfully updated user in TheHive" else - echo "Failed to update user in thehive." + echo "Failed to update user in TheHive" echo "$resp" exit 2 fi diff --git a/salt/common/tools/sbin/so-user b/salt/common/tools/sbin/so-user index 7b79fc93a..02046a3e5 100755 --- a/salt/common/tools/sbin/so-user +++ b/salt/common/tools/sbin/so-user @@ -10,7 +10,7 @@ . /usr/sbin/so-common -if [[ $# < 1 || $# > 2 ]]; then +if [[ $# -lt 1 || $# -gt 2 ]]; then echo "Usage: $0 [email]" echo "" echo " list: Lists all user email addresses currently defined in the identity system" @@ -22,7 +22,7 @@ if [[ $# < 1 || $# > 2 ]]; then echo " valemail: Validates that the given email address is acceptable for defining a new user; requires 'email' parameter" echo " valpass: Validates that a password is acceptable for defining a new user" echo "" - echo " Note that the password can be piped into stdin to avoid prompting for it." + echo " Note that the password can be piped into STDIN to avoid prompting for it" exit 1 fi