diff --git a/src/freedombone-app-batman b/src/freedombone-app-batman index c402ba50..5ba0865f 100755 --- a/src/freedombone-app-batman +++ b/src/freedombone-app-batman @@ -41,10 +41,6 @@ function install_interactive_batman { APP_INSTALLED=1 } -function change_password_batman { - echo -n '' -} - function configure_firewall_for_batman { if [[ $(is_completed $FUNCNAME) == "1" ]]; then return diff --git a/src/freedombone-app-dlna b/src/freedombone-app-dlna index 60954feb..ba35e593 100755 --- a/src/freedombone-app-dlna +++ b/src/freedombone-app-dlna @@ -66,10 +66,6 @@ function install_interactive_dlna { APP_INSTALLED=1 } -function change_password_dlna { - echo -n '' -} - function reconfigure_dlna { echo '' } diff --git a/src/freedombone-app-dokuwiki b/src/freedombone-app-dokuwiki index a507a3e9..ad7e41a0 100755 --- a/src/freedombone-app-dokuwiki +++ b/src/freedombone-app-dokuwiki @@ -61,7 +61,8 @@ function install_interactive_dokuwiki { } function change_password_dokuwiki { - ${PROJECT_NAME}-pass -u $1 -a dokuwiki -p "$2" + echo -n '' + #${PROJECT_NAME}-pass -u $1 -a dokuwiki -p "$2" } function reconfigure_dokuwiki { diff --git a/src/freedombone-app-ghost b/src/freedombone-app-ghost index 8f243ac9..2a675221 100755 --- a/src/freedombone-app-ghost +++ b/src/freedombone-app-ghost @@ -106,15 +106,13 @@ function install_interactive_ghost { } function change_password_ghost { - set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME" - GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain") - GHOST_USERNAME="$1" GHOST_PASSWORD="$2" if [ ${#GHOST_PASSWORD} -lt 8 ]; then echo $'Ghost password is too short' return fi + #${PROJECT_NAME}-pass -u $GHOST_USERNAME -a ghost -p "$GHOST_PASSWORD" } function reconfigure_ghost { diff --git a/src/freedombone-app-gnusocial b/src/freedombone-app-gnusocial index 0fbec9f6..c5682fa5 100755 --- a/src/freedombone-app-gnusocial +++ b/src/freedombone-app-gnusocial @@ -189,7 +189,15 @@ function install_interactive_gnusocial { } function change_password_gnusocial { - ${PROJECT_NAME}-pass -u $1 -a gnusocial -p "$2" + curr_username="$1" + new_user_password="$2" + + read_config_param ${GNUSOCIAL_DOMAIN_NAME} + + cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs + ./scripts/setpassword "$curr_username" "$new_user_password" + + ${PROJECT_NAME}-pass -u "$curr_username" -a gnusocial -p "$new_user_password" } function gnusocial_create_database { diff --git a/src/freedombone-app-gogs b/src/freedombone-app-gogs index b6faa938..df76b26d 100755 --- a/src/freedombone-app-gogs +++ b/src/freedombone-app-gogs @@ -53,6 +53,11 @@ gogs_variables=(ONION_ONLY DDNS_PROVIDER ARCHITECTURE) +function change_password_gogs { + curr_username="$1" + new_user_password="$2" +} + function install_interactive_gogs { if [[ $ONION_ONLY != "no" ]]; then GIT_DOMAIN_NAME='gogs.local' @@ -84,10 +89,6 @@ function configure_interactive_gogs { systemctl restart gogs } -function change_password_gogs { - echo -n '' -} - function gogs_parameters { if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then CURR_ARCH=386 diff --git a/src/freedombone-app-htmly b/src/freedombone-app-htmly index c0d03375..14d22e27 100755 --- a/src/freedombone-app-htmly +++ b/src/freedombone-app-htmly @@ -179,7 +179,7 @@ function change_password_htmly { echo $'Htmly password is too short' return fi - ${PROJECT_NAME}-pass -u $HTMLY_USERNAME -a htmly -p "$HTMLY_PASSWORD" + ${PROJECT_NAME}-pass -u "$HTMLY_USERNAME" -a htmly -p "$HTMLY_PASSWORD" HTMLY_PASSWORD_HASH=$(${PROJECT_NAME}-sec --htmlyhash "$HTMLY_PASSWORD") if [ ${#HTMLY_PASSWORD_HASH} -lt 8 ]; then echo $'Htmly admin password could not be hashed' diff --git a/src/freedombone-app-hubzilla b/src/freedombone-app-hubzilla index 127b9c6b..01e8efcd 100755 --- a/src/freedombone-app-hubzilla +++ b/src/freedombone-app-hubzilla @@ -167,7 +167,14 @@ function install_interactive_hubzilla { } function change_password_hubzilla { - ${PROJECT_NAME}-pass -u $1 -a hubzilla -p "$2" + HUBZILLA_USERNAME="$1" + HUBZILLA_PASSWORD="$2" + if [ ${#HUBZILLA_PASSWORD} -lt 8 ]; then + echo $'Hubzilla password is too short' + return + fi + # TODO: This doesn't actually change the password + #${PROJECT_NAME}-pass -u $HUBZILLA_USERNAME -a hubzilla -p "$HUBZILLA_PASSWORD" } function hubzilla_create_database { diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs index c07b70fe..bad76311 100755 --- a/src/freedombone-app-ipfs +++ b/src/freedombone-app-ipfs @@ -53,10 +53,6 @@ function install_interactive_ipfs { APP_INSTALLED=1 } -function change_password_ipfs { - echo -n '' -} - function reconfigure_ipfs { echo -n '' } diff --git a/src/freedombone-app-irc b/src/freedombone-app-irc index c86cd013..1c18cc7f 100755 --- a/src/freedombone-app-irc +++ b/src/freedombone-app-irc @@ -172,6 +172,73 @@ function remove_user_irc { fi } +function irc_get_global_password { + echo $(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}') +} + +function irc_set_global_password_base { + NEW_IRC_PASSWORD="$1" + EXISTING_IRC_PASSWORD=$(irc_get_global_password) + 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 [[ $(is_valid_user "$IRC_USERNAME") == "1" ]]; 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 + done + + read_config_param DEFAULT_DOMAIN_NAME + read_config_param IRC_PORT + read_config_param MY_USERNAME + + stop_irc_bouncer + sleep 2 + + # change the hashes. There are multiple users, but since we're using a global + # password this doesn't matter + ZNC_SALT="$(dd if=/dev/urandom bs=16c count=1 | md5sum | awk -F ' ' '{print $1}' | cut -c1-20)" + new_user_hash=$(echo -n "${NEW_IRC_PASSWORD}${ZNC_SALT}" | sha256sum | awk -F ' ' '{print $1}') + sed -i "s|Hash = .*|Hash = ${new_user_hash}|g" /home/znc/.znc/configs/znc.conf + sed -i "s|Salt = .*|Salt = ${ZNC_SALT}|g" /home/znc/.znc/configs/znc.conf + + # change the server password + sed -i "s|Server = 127.0.0.1.*|Server = 127.0.0.1 ${IRC_PORT} ${NEW_IRC_PASSWORD}|g" /home/znc/.znc/configs/znc.conf + + # Update the password + ${PROJECT_NAME}-pass -u $MY_USERNAME -a irc -p "$NEW_IRC_PASSWORD" + + # matrix bridge to irc + if [ -f $INSTALL_DIR/matrix_irc_bridge/config.yaml ]; then + sed -i "s|password: .*|password: \"$NEW_IRC_PASSWORD\"|g" $INSTALL_DIR/matrix_irc_bridge/config.yaml + systemctl restart matrix_irc_bridge + fi + + write_config_param "IRC_PASSWORD" "$NEW_IRC_PASSWORD" + + # restart the daemon for the new password to take effect + systemctl restart ngircd + start_irc_bouncer +} + +function change_password_irc { + new_global_password="$2" + + # Change the password for all users + for d in /home/*/ ; do + USERNAME=$(echo "$d" | awk -F '/' '{print $3}') + if [[ $(is_valid_user "$USERNAME") == "1" ]]; then + ${PROJECT_NAME}-pass -u "$USERNAME" -a irc -p "$new_global_password" + fi + done + + irc_set_global_password_base "$new_global_password" +} + function add_user_irc_bouncer { new_username="$1" new_user_password="$2" @@ -180,12 +247,13 @@ function add_user_irc_bouncer { is_admin='false' fi - ${PROJECT_NAME}-pass -u $new_username -a irc -p "$new_user_password" if [[ $(is_valid_user "$new_username") == "0" ]]; then return fi + ${PROJECT_NAME}-pass -u $new_username -a irc -p "$new_user_password" + read_config_param IRC_PORT read_config_param DEFAULT_DOMAIN_NAME if [ ! $2 ]; then @@ -284,7 +352,7 @@ function add_user_irc { new_username="$1" new_user_password="$2" - IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}') + IRC_PASSWORD=$(irc_get_global_password) if [ ${#IRC_PASSWORD} -lt 2 ]; then IRC_PASSWORD= fi @@ -303,66 +371,22 @@ function run_client_irc { } function irc_show_password { - IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}') + IRC_PASSWORD=$(irc_get_global_password) dialog --title $"IRC Password" \ --msgbox "$IRC_PASSWORD" 6 40 } function irc_set_global_password { + EXISTING_IRC_PASSWORD=$(irc_get_global_password) dialog --title $"IRC Password" \ --clear \ --backtitle $"Freedombone Control Panel" \ - --passwordbox $"Password for all IRC users, or press Enter for no password" 10 60 2> $data + --passwordbox $"Password for all IRC users, or press Enter for no password" 10 60 "$EXISTING_IRC_PASSWORD" 2> $data 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 [[ $(is_valid_user "$IRC_USERNAME") == "1" ]]; 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 - done - - read_config_param DEFAULT_DOMAIN_NAME - read_config_param IRC_PORT - read_config_param MY_USERNAME - - stop_irc_bouncer - sleep 2 - - # change the hashes. There are multiple users, but since we're using a global - # password this doesn't matter - ZNC_SALT="$(dd if=/dev/urandom bs=16c count=1 | md5sum | awk -F ' ' '{print $1}' | cut -c1-20)" - new_user_hash=$(echo -n "${NEW_IRC_PASSWORD}${ZNC_SALT}" | sha256sum | awk -F ' ' '{print $1}') - sed -i "s|Hash = .*|Hash = ${new_user_hash}|g" /home/znc/.znc/configs/znc.conf - sed -i "s|Salt = .*|Salt = ${ZNC_SALT}|g" /home/znc/.znc/configs/znc.conf - - # change the server password - sed -i "s|Server = 127.0.0.1.*|Server = 127.0.0.1 ${IRC_PORT} ${NEW_IRC_PASSWORD}|g" /home/znc/.znc/configs/znc.conf - - # Update the password - ${PROJECT_NAME}-pass -u $MY_USERNAME -a irc -p "$NEW_IRC_PASSWORD" - - - if [ -f $INSTALL_DIR/matrix_irc_bridge/config.yaml ]; then - sed -i "s|password: .*|password: \"$NEW_IRC_PASSWORD\"|g" $INSTALL_DIR/matrix_irc_bridge/config.yaml - systemctl restart matrix_irc_bridge - fi - - write_config_param "IRC_PASSWORD" "$NEW_IRC_PASSWORD" - - # restart the daemon for the new password to take effect - systemctl restart ngircd - start_irc_bouncer - + irc_set_global_password_base "$NEW_IRC_PASSWORD" dialog --title $"IRC Password" \ --msgbox $"The IRC password was changed" 6 40 ;; diff --git a/src/freedombone-app-jitsi b/src/freedombone-app-jitsi index 1d55d32f..e66823ed 100755 --- a/src/freedombone-app-jitsi +++ b/src/freedombone-app-jitsi @@ -73,10 +73,6 @@ function jitsi_disable_google_spyware { fi } -function change_password_jitsi { - echo -n '' -} - function can_install_videobridge { check_architecture=$(uname -a) if [[ "$check_architecture" == *"amd64"* || "$check_architecture" == *"i386"* ]]; then diff --git a/src/freedombone-app-librevault b/src/freedombone-app-librevault index af66848a..e0cc4ff8 100755 --- a/src/freedombone-app-librevault +++ b/src/freedombone-app-librevault @@ -50,10 +50,6 @@ function install_interactive_librevault { APP_INSTALLED=1 } -function change_password_librevault { - echo -n '' -} - function reconfigure_librevault { echo -n '' # TODO diff --git a/src/freedombone-app-lychee b/src/freedombone-app-lychee index d0e9390f..486252ca 100755 --- a/src/freedombone-app-lychee +++ b/src/freedombone-app-lychee @@ -100,16 +100,14 @@ function install_interactive_lychee { } function change_password_lychee { - set_completion_param "lychee domain" "$LYCHEE_DOMAIN_NAME" - LYCHEE_DOMAIN_NAME=$(get_completion_param "lychee domain") - LYCHEE_USERNAME="$1" LYCHEE_PASSWORD="$2" if [ ${#LYCHEE_PASSWORD} -lt 8 ]; then echo $'Lychee password is too short' return fi - ${PROJECT_NAME}-pass -u $LYCHEE_USERNAME -a lychee -p "$LYCHEE_PASSWORD" + # TODO: This doesn't actually change the password + #${PROJECT_NAME}-pass -u $LYCHEE_USERNAME -a lychee -p "$LYCHEE_PASSWORD" } function reconfigure_lychee { diff --git a/src/freedombone-app-mailpile b/src/freedombone-app-mailpile index f5d4fbd9..f575b19a 100755 --- a/src/freedombone-app-mailpile +++ b/src/freedombone-app-mailpile @@ -73,7 +73,8 @@ function install_interactive_mailpile { } function change_password_mailpile { - ${PROJECT_NAME}-pass -u $1 -a mailpile -p "$2" + echo -n '' + #${PROJECT_NAME}-pass -u $1 -a mailpile -p "$2" } function reconfigure_mailpile { diff --git a/src/freedombone-app-mumble b/src/freedombone-app-mumble index a4c7da22..343be70c 100755 --- a/src/freedombone-app-mumble +++ b/src/freedombone-app-mumble @@ -54,7 +54,18 @@ function install_interactive_mumble { } function change_password_mumble { - ${PROJECT_NAME}-pass -u $1 -a mumble -p "$2" + new_mumble_password="$2" + + # Change the password for all users + for d in /home/*/ ; do + USERNAME=$(echo "$d" | awk -F '/' '{print $3}') + if [[ $(is_valid_user "$USERNAME") == "1" ]]; then + ${PROJECT_NAME}-pass -u "$USERNAME" -a mumble -p "$new_mumble_password" + fi + done + + sed -i "s|serverpassword=.*|serverpassword=$new_mumble_password|g" /etc/mumble-server.ini + systemctl restart mumble-server } function reconfigure_mumble { @@ -108,7 +119,7 @@ function restore_local_mumble { cp /etc/ssl/certs/mumble* /var/lib/mumble-server cp /etc/ssl/private/mumble* /var/lib/mumble-server chown -R mumble-server:mumble-server /var/lib/mumble-server - service mumble-server restart + systemctl restart mumble-server fi } @@ -150,7 +161,7 @@ function restore_remote_mumble { cp /etc/ssl/certs/mumble* /var/lib/mumble-server cp /etc/ssl/private/mumble* /var/lib/mumble-server chown -R mumble-server:mumble-server /var/lib/mumble-server - service mumble-server restart + systemctl restart mumble-server echo $"Restore of Mumble complete" fi } diff --git a/src/freedombone-app-pelican b/src/freedombone-app-pelican index 3539fab8..d5e519d0 100755 --- a/src/freedombone-app-pelican +++ b/src/freedombone-app-pelican @@ -49,10 +49,6 @@ function install_interactive_pelican { APP_INSTALLED=1 } -function change_password_pelican { - echo -n '' -} - function reconfigure_pelican { echo -n '' } diff --git a/src/freedombone-app-pihole b/src/freedombone-app-pihole index bce6c6a6..153c77f0 100755 --- a/src/freedombone-app-pihole +++ b/src/freedombone-app-pihole @@ -268,10 +268,6 @@ function install_interactive_pihole { APP_INSTALLED=1 } -function change_password_pihole { - echo -n '' -} - function reconfigure_pihole { echo -n '' } diff --git a/src/freedombone-app-postactiv b/src/freedombone-app-postactiv index c734b3d7..5164a970 100755 --- a/src/freedombone-app-postactiv +++ b/src/freedombone-app-postactiv @@ -146,7 +146,15 @@ function install_interactive_postactiv { } function change_password_postactiv { - echo -n '' + curr_username="$1" + new_user_password="$2" + + read_config_param ${POSTACTIV_DOMAIN_NAME} + + cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs + ./scripts/setpassword "$curr_username" "$new_user_password" + + ${PROJECT_NAME}-pass -u "$curr_username" -a postactiv -p "$new_user_password" } function postactiv_create_database { diff --git a/src/freedombone-app-rss b/src/freedombone-app-rss index 76998df1..7adf4025 100755 --- a/src/freedombone-app-rss +++ b/src/freedombone-app-rss @@ -60,7 +60,10 @@ function install_interactive_rss { } function change_password_rss { - ${PROJECT_NAME}-pass -u $1 -a rss -p "$2" + curr_username="$1" + new_user_password="$2" + + #${PROJECT_NAME}-pass -u "$curr_username" -a rss -p "$new_user_password" } function rss_create_database { diff --git a/src/freedombone-app-sip b/src/freedombone-app-sip index 2a08bb0d..d9f5e578 100755 --- a/src/freedombone-app-sip +++ b/src/freedombone-app-sip @@ -97,7 +97,10 @@ function install_interactive_sip { } function change_password_sip { - ${PROJECT_NAME}-pass -u $1 -a sip -p "$2" + curr_username="$1" + new_user_password="$2" + + #${PROJECT_NAME}-pass -u "$curr_username" -a sip -p "$new_user_password" } function reconfigure_sip { diff --git a/src/freedombone-app-synapse b/src/freedombone-app-synapse index 7be562db..24428c27 100755 --- a/src/freedombone-app-synapse +++ b/src/freedombone-app-synapse @@ -212,7 +212,10 @@ function install_interactive_synapse { } function change_password_synapse { - ${PROJECT_NAME}-pass -u $1 -a synapse -p "$2" + curr_username="$1" + new_user_password="$2" + + #${PROJECT_NAME}-pass -u "$curr_username" -a synapse -p "$new_user_password" } function reconfigure_synapse { diff --git a/src/freedombone-app-tahoelafs b/src/freedombone-app-tahoelafs index 234a05be..f41700d0 100755 --- a/src/freedombone-app-tahoelafs +++ b/src/freedombone-app-tahoelafs @@ -51,10 +51,6 @@ function install_interactive_tahoelafs { APP_INSTALLED=1 } -function change_password_tahoelafs { - echo -n '' -} - function reconfigure_tahoelafs { for d in /home/*/ ; do USERNAME=$(echo "$d" | awk -F '/' '{print $3}') diff --git a/src/freedombone-app-vpn b/src/freedombone-app-vpn index b9d3b17c..fd015bf3 100755 --- a/src/freedombone-app-vpn +++ b/src/freedombone-app-vpn @@ -37,10 +37,6 @@ function install_interactive_vpn { APP_INSTALLED=1 } -function change_password_vpn { - echo -n '' -} - function reconfigure_vpn { echo -n '' } diff --git a/src/freedombone-app-zeronet b/src/freedombone-app-zeronet index 8be8d7da..94e572eb 100755 --- a/src/freedombone-app-zeronet +++ b/src/freedombone-app-zeronet @@ -66,10 +66,6 @@ function install_interactive_zeronet { APP_INSTALLED=1 } -function change_password_zeronet { - echo -n '' -} - function reconfigure_zeronet { echo -n '' }