1
0
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:
Joshua Tauberer
2015-05-25 16:03:45 +00:00
3 changed files with 94 additions and 0 deletions

22
tools/munin_update.sh Normal file
View 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