From 0105c36e9b2d07e6f0f4afb31220dcee91d20f09 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 5 Apr 2016 15:13:47 +0100 Subject: [PATCH] Also change IRC password for users --- src/freedombone-controlpanel | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index 7ce01b7a..b2da36d1 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -646,11 +646,26 @@ function irc_set_global_password { sel=$? case $sel in 0) + EXISTING_IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}') NEW_IRC_PASSWORD=$(<$data) sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf + + # replace the password for all users + for d in /home/*/ ; do + IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}') + if [[ $IRC_USERNAME != "git" && $IRC_USERNAME != "mirrors" ]]; then + if [ -f /home/$IRC_USERNAME/.irssi/config ]; then + sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/$IRC_USERNAME/.irssi/config + chown -R $IRC_USERNAME:$IRC_USERNAME /home/$IRC_USERNAME/.irssi + fi + fi + fi + + # restart the daemon for the new password to take effect + systemctl restart ngircd + dialog --title $"IRC Password" \ --msgbox $"The IRC password was changed" 6 40 - systemctl restart ngircd ;; esac }