瀏覽代碼

Backup and restore nginx password hashes

Bob Mottram 9 年之前
父節點
當前提交
b54314d4b0
共有 5 個檔案被更改,包括 19 行新增0 行删除
  1. 1
    0
      src/freedombone
  2. 4
    0
      src/freedombone-backup-local
  3. 4
    0
      src/freedombone-backup-remote
  4. 5
    0
      src/freedombone-restore-local
  5. 5
    0
      src/freedombone-restore-remote

+ 1
- 0
src/freedombone 查看文件

@@ -9266,6 +9266,7 @@ function install_search_engine {
9266 9266
 
9267 9267
     # an unprivileged user to run as
9268 9268
     useradd -d ${SEARCH_ENGINE_PATH}/searx/ -s /bin/false searx
9269
+    adduser searx debian-tor
9269 9270
 
9270 9271
     # daemon
9271 9272
     echo '[Unit]' > /etc/systemd/system/searx.service

+ 4
- 0
src/freedombone-backup-local 查看文件

@@ -451,6 +451,10 @@ function backup_configuration {
451 451
     if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
452 452
         cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig
453 453
     fi
454
+    # nginx password hashes
455
+    if [ -f /etc/nginx/.htpasswd ]; then
456
+        cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd
457
+    fi
454 458
     backup_directory_to_usb /root/tempbackupconfig config
455 459
 }
456 460
 

+ 4
- 0
src/freedombone-backup-remote 查看文件

@@ -172,6 +172,10 @@ function backup_configuration {
172 172
     if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
173 173
         cp -f $BACKUP_EXTRA_DIRECTORIES /root/tempbackupconfig
174 174
     fi
175
+    # nginx password hashes
176
+    if [ -f /etc/nginx/.htpasswd ]; then
177
+        cp -f /etc/nginx/.htpasswd /root/tempbackupconfig/htpasswd
178
+    fi
175 179
     backup_directory_to_friend /root/tempbackupconfig config
176 180
 }
177 181
 

+ 5
- 0
src/freedombone-restore-local 查看文件

@@ -295,6 +295,11 @@ function restore_configuration {
295 295
             fi
296 296
         fi
297 297
 
298
+        # restore nginx password hashes
299
+        if [ -f /root/tempconfig/root/htpasswd ]; then
300
+            cp -f /root/tempconfig/root/htpasswd /etc/nginx/.htpasswd
301
+        fi
302
+
298 303
         rm -rf /root/tempconfig
299 304
     fi
300 305
 }

+ 5
- 0
src/freedombone-restore-remote 查看文件

@@ -205,6 +205,11 @@ function restore_configuration {
205 205
             fi
206 206
         fi
207 207
 
208
+        # restore nginx password hashes
209
+        if [ -f /root/tempconfig/root/htpasswd ]; then
210
+            cp -f /root/tempconfig/root/htpasswd /etc/nginx/.htpasswd
211
+        fi
212
+
208 213
         rm -rf /root/tempconfig
209 214
     fi
210 215
 }