mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-05 15:57:23 +01:00
Merge branch 'master' of https://github.com/nstanke/mailinabox into munin
This commit is contained in:
22
tools/munin_update.sh
Normal file
22
tools/munin_update.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Grant admins access to munin
|
||||
|
||||
source setup/functions.sh # load our functions
|
||||
source /etc/mailinabox.conf # load global vars
|
||||
|
||||
db=$STORAGE_ROOT'/mail/users.sqlite'
|
||||
|
||||
users=`sqlite3 $db "SELECT email FROM users WHERE privileges = 'admin'"`;
|
||||
passwords=`sqlite3 $db "SELECT password FROM users WHERE privileges = 'admin'"`;
|
||||
|
||||
# Define the arrays
|
||||
users_array=(${users// / })
|
||||
passwords_array=(${passwords// / })
|
||||
|
||||
# clear htpasswd
|
||||
>/etc/nginx/htpasswd
|
||||
|
||||
# write user:password
|
||||
for i in "${!users_array[@]}"; do
|
||||
echo "${users_array[i]}:${passwords_array[i]:14}" >> /etc/nginx/htpasswd
|
||||
done
|
||||
Reference in New Issue
Block a user