|
@@ -15,7 +15,7 @@
|
15
|
15
|
# License
|
16
|
16
|
# =======
|
17
|
17
|
#
|
18
|
|
-# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
|
|
18
|
+# Copyright (C) 2016-2017 Bob Mottram <bob@freedombone.net>
|
19
|
19
|
#
|
20
|
20
|
# This program is free software: you can redistribute it and/or modify
|
21
|
21
|
# it under the terms of the GNU Affero General Public License as published by
|
|
@@ -58,40 +58,6 @@ tahoelafs_variables=(ONION_ONLY
|
58
|
58
|
TAHOELAFS_SHARES_HAPPY
|
59
|
59
|
TAHOELAFS_SHARES_TOTAL)
|
60
|
60
|
|
61
|
|
-function add_user_tahoelafs {
|
62
|
|
- if [[ $(app_is_installed tahoelafs) == "0" ]]; then
|
63
|
|
- echo '0'
|
64
|
|
- return
|
65
|
|
- fi
|
66
|
|
-
|
67
|
|
- new_username="$1"
|
68
|
|
- new_user_password="$2"
|
69
|
|
- ${PROJECT_NAME}-pass -u $new_username -a tahoelafs -p "$new_user_password"
|
70
|
|
- if grep "${new_username}:" /etc/nginx/.htpasswd-tahoelafs; then
|
71
|
|
- sed -i '/${new_username}:/d' /etc/nginx/.htpasswd-tahoelafs
|
72
|
|
- fi
|
73
|
|
- echo "${new_user_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${new_username}
|
74
|
|
- echo '0'
|
75
|
|
-}
|
76
|
|
-
|
77
|
|
-function remove_user_tahoelafs {
|
78
|
|
- remove_username="$1"
|
79
|
|
- ${PROJECT_NAME}-pass -u $remove_username --rmapp tahoelafs
|
80
|
|
- if grep "${remove_username}:" /etc/nginx/.htpasswd-tahoelafs; then
|
81
|
|
- sed -i '/${remove_username}:/d' /etc/nginx/.htpasswd-tahoelafs
|
82
|
|
- fi
|
83
|
|
-}
|
84
|
|
-
|
85
|
|
-function change_password_tahoelafs {
|
86
|
|
- change_username="$1"
|
87
|
|
- change_password="$2"
|
88
|
|
- ${PROJECT_NAME}-pass -u $change_username -a tahoelafs -p "$change_password"
|
89
|
|
- if grep "${change_username}:" /etc/nginx/.htpasswd-tahoelafs; then
|
90
|
|
- sed -i '/tahoe-${change_username}:/d' /etc/nginx/.htpasswd-tahoelafs
|
91
|
|
- fi
|
92
|
|
- echo "${change_password}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${change_username}
|
93
|
|
-}
|
94
|
|
-
|
95
|
61
|
function add_tahoelafs_storage_node_interactive {
|
96
|
62
|
data=$(tempfile 2>/dev/null)
|
97
|
63
|
trap "rm -f $data" 0 1 2 5 15
|
|
@@ -384,9 +350,6 @@ function remove_tahoelafs {
|
384
|
350
|
rm -rf /home/tahoelafs
|
385
|
351
|
fi
|
386
|
352
|
remove_app tahoelafs
|
387
|
|
- if [ -f /etc/nginx/.htpasswd-tahoelafs ]; then
|
388
|
|
- shred -zu /etc/nginx/.htpasswd-tahoelafs
|
389
|
|
- fi
|
390
|
353
|
systemctl reload tor
|
391
|
354
|
}
|
392
|
355
|
|
|
@@ -603,8 +566,6 @@ function create_tahoelafs_web {
|
603
|
566
|
echo " root /var/www/tahoelafs/htdocs;" >> $tahoelafs_nginx_site
|
604
|
567
|
echo '' >> $tahoelafs_nginx_site
|
605
|
568
|
echo ' location / {' >> $tahoelafs_nginx_site
|
606
|
|
- echo " # auth_basic \"${TAHOELAFS_LOGIN_TEXT}\";" >> $tahoelafs_nginx_site
|
607
|
|
- echo ' # auth_basic_user_file /etc/nginx/.htpasswd-tahoelafs;' >> $tahoelafs_nginx_site
|
608
|
569
|
function_check nginx_limits
|
609
|
570
|
nginx_limits tahoelafs '15m'
|
610
|
571
|
echo ' rewrite /(.*) /$1 break;' >> $tahoelafs_nginx_site
|
|
@@ -617,16 +578,6 @@ function create_tahoelafs_web {
|
617
|
578
|
echo ' }' >> $tahoelafs_nginx_site
|
618
|
579
|
echo '}' >> $tahoelafs_nginx_site
|
619
|
580
|
|
620
|
|
- TAHOELAFS_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
621
|
|
- ${PROJECT_NAME}-pass -u $MY_USERNAME -a tahoelafs -p "$TAHOELAFS_ADMIN_PASSWORD"
|
622
|
|
- if [ ! -f /etc/nginx/.htpasswd-tahoelafs ]; then
|
623
|
|
- touch /etc/nginx/.htpasswd-tahoelafs
|
624
|
|
- fi
|
625
|
|
- if grep "${MY_USERNAME}:" /etc/nginx/.htpasswd-tahoelafs; then
|
626
|
|
- sed -i '/${MY_USERNAME}:/d' /etc/nginx/.htpasswd-tahoelafs
|
627
|
|
- fi
|
628
|
|
- echo "${TAHOELAFS_ADMIN_PASSWORD}" | htpasswd -i -s /etc/nginx/.htpasswd-tahoelafs ${MY_USERNAME}
|
629
|
|
-
|
630
|
581
|
function_check nginx_ensite
|
631
|
582
|
nginx_ensite tahoelafs
|
632
|
583
|
systemctl reload nginx
|