New script: Set Zabbix Auth Type

This commit is contained in:
Shihaam Abdul Rahman 2021-04-28 12:41:23 +05:00
parent 076bffa5a6
commit 46151e29ed
4 changed files with 69 additions and 0 deletions

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -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'";