From b54314d4b06883484251799c625281987812f578 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 6 Mar 2016 16:21:00 +0000 Subject: [PATCH] Backup and restore nginx password hashes --- src/freedombone | 1 + src/freedombone-backup-local | 4 ++++ src/freedombone-backup-remote | 4 ++++ src/freedombone-restore-local | 5 +++++ src/freedombone-restore-remote | 5 +++++ 5 files changed, 19 insertions(+) diff --git a/src/freedombone b/src/freedombone index e4d0a06b..2c234b7b 100755 --- a/src/freedombone +++ b/src/freedombone @@ -9266,6 +9266,7 @@ function install_search_engine { # an unprivileged user to run as useradd -d ${SEARCH_ENGINE_PATH}/searx/ -s /bin/false searx + adduser searx debian-tor # daemon echo '[Unit]' > /etc/systemd/system/searx.service diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index 1b00cc98..b77c74b6 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -451,6 +451,10 @@ function backup_configuration { if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig fi + # nginx password hashes + if [ -f /etc/nginx/.htpasswd ]; then + cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd + fi backup_directory_to_usb /root/tempbackupconfig config } diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 23f0e2ba..a66235ab 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -172,6 +172,10 @@ function backup_configuration { if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig fi + # nginx password hashes + if [ -f /etc/nginx/.htpasswd ]; then + cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd + fi backup_directory_to_friend /root/tempbackupconfig config } diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index 2e3cfc0e..4b1f92f3 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -295,6 +295,11 @@ function restore_configuration { fi fi + # restore nginx password hashes + if [ -f /root/tempconfig/root/htpasswd ]; then + cp -f /root/tempconfig/root/htpasswd /etc/nginx/.htpasswd + fi + rm -rf /root/tempconfig fi } diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote index 66d6877f..79bd47fb 100755 --- a/src/freedombone-restore-remote +++ b/src/freedombone-restore-remote @@ -205,6 +205,11 @@ function restore_configuration { fi fi + # restore nginx password hashes + if [ -f /root/tempconfig/root/htpasswd ]; then + cp -f /root/tempconfig/root/htpasswd /etc/nginx/.htpasswd + fi + rm -rf /root/tempconfig fi }