Add support to create custom API users

This commit is contained in:
Manuel Gutierrez
2020-10-22 14:32:18 +02:00
parent 3086096c19
commit fe1b3d147e
3 changed files with 78 additions and 4 deletions
@@ -75,8 +75,26 @@ function_wazuh_migration(){
fi
}
function_create_custom_user() {
if [[ ! -z $API_USERNAME ]] && [[ ! -z $API_PASSWORD ]]; then
cat << EOF > /var/ossec/api/configuration/admin.json
{
"username": "$API_USERNAME",
"password": "$API_PASSWORD"
}
EOF
# insert user into API database
/var/ossec/framework/python/bin/python3 /var/ossec/framework/scripts/create_user.py
fi
}
# Migrate data from /wazuh-migration volume
function_wazuh_migration
# create API custom user
function_create_custom_user
# Start Wazuh
/var/ossec/bin/ossec-control start