From 96dc6fc4fbf8e1be49225edc092d41e79e6a4c0b Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 15 Jan 2019 13:56:56 +0100 Subject: [PATCH] disable admin user (security issue) --- scripts/upgrade | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 84f1e3f..ed66a8f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -48,6 +48,21 @@ if [ -z $final_path ]; then ynh_app_setting_set $app final_path $final_path fi +#================================================= +# Disable default admin for security issue +#================================================= +haveDefaultAdminEnabled=$(mysql -BN -u root -psMquHFoRof zabbix -e "SELECT count(id) from \`users_groups\` where userid=1 and usrgrpid=9") + +if [ "$haveDefaultAdminEnabled" -eq 1 ] ;then + echo "Disable default admin" + #disable default admin + lastid=$(mysql -u$db_user -p$db_pwd $db_name -BN -e "SELECT max(id) from \`users_groups\`") + lastid=$(($lastid + 1 )) + mysql -u$db_user -p$db_pwd $db_name -e "INSERT INTO \`users_groups\` (\`id\` , \`usrgrpid\`, \`userid\`) VALUES ($lastid ,9, 1);" +else + echo "default admin already disabled" +fi + #================================================= # CHECK THE PATH #=================================================