diff --git a/zabbix-authention-type-cli/README.md b/zabbix-authention-type-cli/README.md new file mode 100644 index 0000000..c28a264 --- /dev/null +++ b/zabbix-authention-type-cli/README.md @@ -0,0 +1,9 @@ + + +# Set Zabbix Authentication Type from CLI + +If you're locked out of Zabbix account due to reasons like LDAP server unreachable or forgot to set "Zabbix Super Admin" to LDAP admin user +you can used this script to switch back to "Internal" authention method and login with local zabbix admin account + + + diff --git a/zabbix-authention-type-cli/demo.png b/zabbix-authention-type-cli/demo.png new file mode 100644 index 0000000..f6510e9 Binary files /dev/null and b/zabbix-authention-type-cli/demo.png differ diff --git a/zabbix-authention-type-cli/locked-out.png b/zabbix-authention-type-cli/locked-out.png new file mode 100644 index 0000000..9911165 Binary files /dev/null and b/zabbix-authention-type-cli/locked-out.png differ diff --git a/zabbix-authention-type-cli/set-zabbix-auth-type.sh b/zabbix-authention-type-cli/set-zabbix-auth-type.sh new file mode 100644 index 0000000..5d74922 --- /dev/null +++ b/zabbix-authention-type-cli/set-zabbix-auth-type.sh @@ -0,0 +1,60 @@ +#!/bin/bash +read -p "Database Host [localhost]: " DB_HOST +read -p "Database Port [3306]: " DB_PORT +read -p "Database Name [zabbix]: " DB_NAME +read -p "Database User [zabbix]: " DB_USER +read -s -p "Database Password [zabbix]: " DB_PASS + +if [ "$DB_HOST" = "" ] +then + DB_HOST=localhost +else + : +fi +if [ "$DB_PORT" = "" ] +then + DB_PORT=3306 +else + : +fi +if [ "$DB_NAME" = "" ] +then + DB_NAME=zabbix +else + : +fi +if [ "$DB_USER" = "" ] +then + DB_USER=zabbix +else + : +fi +if [ "$DB_PASS" = "" ] +then + DB_PASS=zabbix +else + : +fi + +echo "" +echo "" +echo "Select Authention Type" +echo "0 - Internal" +echo "1 - LDAP" +read -p "Please Input: " AUTHTYPE +echo "" +if [ "$AUTHTYPE" = "0" ] + then + : +elif [ "$AUTHTYPE" = "1" ] + then + : +else + echo "There was an error" + exit +fi + +mysql -u ${DB_USER} -p${DB_PASS} \ + -h ${DB_HOST} -P ${DB_PORT} \ + -D ${DB_NAME} \ + --execute="update zabbix.config set authentication_type='${AUTHTYPE}' where configid='1'";