Browse Source

Changing app passwords

Bob Mottram 8 years ago
parent
commit
b4971017c2

+ 0
- 4
src/freedombone-app-batman View File

@@ -41,10 +41,6 @@ function install_interactive_batman {
41 41
     APP_INSTALLED=1
42 42
 }
43 43
 
44
-function change_password_batman {
45
-    echo -n ''
46
-}
47
-
48 44
 function configure_firewall_for_batman {
49 45
     if [[ $(is_completed $FUNCNAME) == "1" ]]; then
50 46
         return

+ 0
- 4
src/freedombone-app-dlna View File

@@ -66,10 +66,6 @@ function install_interactive_dlna {
66 66
     APP_INSTALLED=1
67 67
 }
68 68
 
69
-function change_password_dlna {
70
-    echo -n ''
71
-}
72
-
73 69
 function reconfigure_dlna {
74 70
     echo ''
75 71
 }

+ 2
- 1
src/freedombone-app-dokuwiki View File

@@ -61,7 +61,8 @@ function install_interactive_dokuwiki {
61 61
 }
62 62
 
63 63
 function change_password_dokuwiki {
64
-    ${PROJECT_NAME}-pass -u $1 -a dokuwiki -p "$2"
64
+    echo -n ''
65
+    #${PROJECT_NAME}-pass -u $1 -a dokuwiki -p "$2"
65 66
 }
66 67
 
67 68
 function reconfigure_dokuwiki {

+ 1
- 3
src/freedombone-app-ghost View File

@@ -106,15 +106,13 @@ function install_interactive_ghost {
106 106
 }
107 107
 
108 108
 function change_password_ghost {
109
-    set_completion_param "ghost domain" "$GHOST_DOMAIN_NAME"
110
-    GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
111
-
112 109
     GHOST_USERNAME="$1"
113 110
     GHOST_PASSWORD="$2"
114 111
     if [ ${#GHOST_PASSWORD} -lt 8 ]; then
115 112
         echo $'Ghost password is too short'
116 113
         return
117 114
     fi
115
+    #${PROJECT_NAME}-pass -u $GHOST_USERNAME -a ghost -p "$GHOST_PASSWORD"
118 116
 }
119 117
 
120 118
 function reconfigure_ghost {

+ 9
- 1
src/freedombone-app-gnusocial View File

@@ -189,7 +189,15 @@ function install_interactive_gnusocial {
189 189
 }
190 190
 
191 191
 function change_password_gnusocial {
192
-    ${PROJECT_NAME}-pass -u $1 -a gnusocial -p "$2"
192
+    curr_username="$1"
193
+    new_user_password="$2"
194
+
195
+    read_config_param ${GNUSOCIAL_DOMAIN_NAME}
196
+
197
+    cd /var/www/${GNUSOCIAL_DOMAIN_NAME}/htdocs
198
+    ./scripts/setpassword "$curr_username" "$new_user_password"
199
+
200
+    ${PROJECT_NAME}-pass -u "$curr_username" -a gnusocial -p "$new_user_password"
193 201
 }
194 202
 
195 203
 function gnusocial_create_database {

+ 5
- 4
src/freedombone-app-gogs View File

@@ -53,6 +53,11 @@ gogs_variables=(ONION_ONLY
53 53
                 DDNS_PROVIDER
54 54
                 ARCHITECTURE)
55 55
 
56
+function change_password_gogs {
57
+    curr_username="$1"
58
+    new_user_password="$2"
59
+}
60
+
56 61
 function install_interactive_gogs {
57 62
     if [[ $ONION_ONLY != "no" ]]; then
58 63
         GIT_DOMAIN_NAME='gogs.local'
@@ -84,10 +89,6 @@ function configure_interactive_gogs {
84 89
     systemctl restart gogs
85 90
 }
86 91
 
87
-function change_password_gogs {
88
-    echo -n ''
89
-}
90
-
91 92
 function gogs_parameters {
92 93
     if [[ ${ARCHITECTURE} == *"386" || ${ARCHITECTURE} == *"686" ]]; then
93 94
         CURR_ARCH=386

+ 1
- 1
src/freedombone-app-htmly View File

@@ -179,7 +179,7 @@ function change_password_htmly {
179 179
         echo $'Htmly password is too short'
180 180
         return
181 181
     fi
182
-    ${PROJECT_NAME}-pass -u $HTMLY_USERNAME -a htmly -p "$HTMLY_PASSWORD"
182
+    ${PROJECT_NAME}-pass -u "$HTMLY_USERNAME" -a htmly -p "$HTMLY_PASSWORD"
183 183
     HTMLY_PASSWORD_HASH=$(${PROJECT_NAME}-sec --htmlyhash "$HTMLY_PASSWORD")
184 184
     if [ ${#HTMLY_PASSWORD_HASH} -lt 8 ]; then
185 185
         echo $'Htmly admin password could not be hashed'

+ 8
- 1
src/freedombone-app-hubzilla View File

@@ -167,7 +167,14 @@ function install_interactive_hubzilla {
167 167
 }
168 168
 
169 169
 function change_password_hubzilla {
170
-    ${PROJECT_NAME}-pass -u $1 -a hubzilla -p "$2"
170
+    HUBZILLA_USERNAME="$1"
171
+    HUBZILLA_PASSWORD="$2"
172
+    if [ ${#HUBZILLA_PASSWORD} -lt 8 ]; then
173
+        echo $'Hubzilla password is too short'
174
+        return
175
+    fi
176
+    # TODO: This doesn't actually change the password
177
+    #${PROJECT_NAME}-pass -u $HUBZILLA_USERNAME -a hubzilla -p "$HUBZILLA_PASSWORD"
171 178
 }
172 179
 
173 180
 function hubzilla_create_database {

+ 0
- 4
src/freedombone-app-ipfs View File

@@ -53,10 +53,6 @@ function install_interactive_ipfs {
53 53
     APP_INSTALLED=1
54 54
 }
55 55
 
56
-function change_password_ipfs {
57
-    echo -n ''
58
-}
59
-
60 56
 function reconfigure_ipfs {
61 57
     echo -n ''
62 58
 }

+ 74
- 50
src/freedombone-app-irc View File

@@ -172,6 +172,73 @@ function remove_user_irc {
172 172
     fi
173 173
 }
174 174
 
175
+function irc_get_global_password {
176
+    echo $(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
177
+}
178
+
179
+function irc_set_global_password_base {
180
+    NEW_IRC_PASSWORD="$1"
181
+    EXISTING_IRC_PASSWORD=$(irc_get_global_password)
182
+    sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
183
+
184
+    # replace the password for all users
185
+    for d in /home/*/ ; do
186
+        IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
187
+        if [[ $(is_valid_user "$IRC_USERNAME") == "1" ]]; then
188
+            if [ -f /home/${IRC_USERNAME}/.irssi/config ]; then
189
+                sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/${IRC_USERNAME}/.irssi/config
190
+                chown -R ${IRC_USERNAME}:${IRC_USERNAME} /home/${IRC_USERNAME}/.irssi
191
+            fi
192
+        fi
193
+    done
194
+
195
+    read_config_param DEFAULT_DOMAIN_NAME
196
+    read_config_param IRC_PORT
197
+    read_config_param MY_USERNAME
198
+
199
+    stop_irc_bouncer
200
+    sleep 2
201
+
202
+    # change the hashes. There are multiple users, but since we're using a global
203
+    # password this doesn't matter
204
+    ZNC_SALT="$(dd if=/dev/urandom bs=16c count=1 | md5sum | awk -F ' ' '{print $1}' | cut -c1-20)"
205
+    new_user_hash=$(echo -n "${NEW_IRC_PASSWORD}${ZNC_SALT}" | sha256sum | awk -F ' ' '{print $1}')
206
+    sed -i "s|Hash = .*|Hash = ${new_user_hash}|g" /home/znc/.znc/configs/znc.conf
207
+    sed -i "s|Salt = .*|Salt = ${ZNC_SALT}|g" /home/znc/.znc/configs/znc.conf
208
+
209
+    # change the server password
210
+    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
211
+
212
+    # Update the password
213
+    ${PROJECT_NAME}-pass -u $MY_USERNAME -a irc -p "$NEW_IRC_PASSWORD"
214
+
215
+    # matrix bridge to irc
216
+    if [ -f $INSTALL_DIR/matrix_irc_bridge/config.yaml ]; then
217
+        sed -i "s|password: .*|password: \"$NEW_IRC_PASSWORD\"|g" $INSTALL_DIR/matrix_irc_bridge/config.yaml
218
+        systemctl restart matrix_irc_bridge
219
+    fi
220
+
221
+    write_config_param "IRC_PASSWORD" "$NEW_IRC_PASSWORD"
222
+
223
+    # restart the daemon for the new password to take effect
224
+    systemctl restart ngircd
225
+    start_irc_bouncer
226
+}
227
+
228
+function change_password_irc {
229
+    new_global_password="$2"
230
+
231
+    # Change the password for all users
232
+    for d in /home/*/ ; do
233
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
234
+        if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
235
+            ${PROJECT_NAME}-pass -u "$USERNAME" -a irc -p "$new_global_password"
236
+        fi
237
+    done
238
+
239
+    irc_set_global_password_base "$new_global_password"
240
+}
241
+
175 242
 function add_user_irc_bouncer {
176 243
     new_username="$1"
177 244
     new_user_password="$2"
@@ -180,12 +247,13 @@ function add_user_irc_bouncer {
180 247
         is_admin='false'
181 248
     fi
182 249
 
183
-    ${PROJECT_NAME}-pass -u $new_username -a irc -p "$new_user_password"
184 250
 
185 251
     if [[ $(is_valid_user "$new_username") == "0" ]]; then
186 252
         return
187 253
     fi
188 254
 
255
+    ${PROJECT_NAME}-pass -u $new_username -a irc -p "$new_user_password"
256
+
189 257
     read_config_param IRC_PORT
190 258
     read_config_param DEFAULT_DOMAIN_NAME
191 259
     if [ ! $2 ]; then
@@ -284,7 +352,7 @@ function add_user_irc {
284 352
     new_username="$1"
285 353
     new_user_password="$2"
286 354
 
287
-    IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
355
+    IRC_PASSWORD=$(irc_get_global_password)
288 356
     if [ ${#IRC_PASSWORD} -lt 2 ]; then
289 357
         IRC_PASSWORD=
290 358
     fi
@@ -303,66 +371,22 @@ function run_client_irc {
303 371
 }
304 372
 
305 373
 function irc_show_password {
306
-    IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
374
+    IRC_PASSWORD=$(irc_get_global_password)
307 375
     dialog --title $"IRC Password" \
308 376
            --msgbox "$IRC_PASSWORD" 6 40
309 377
 }
310 378
 
311 379
 function irc_set_global_password {
380
+    EXISTING_IRC_PASSWORD=$(irc_get_global_password)
312 381
     dialog --title $"IRC Password" \
313 382
            --clear \
314 383
            --backtitle $"Freedombone Control Panel" \
315
-           --passwordbox $"Password for all IRC users, or press Enter for no password" 10 60 2> $data
384
+           --passwordbox $"Password for all IRC users, or press Enter for no password" 10 60 "$EXISTING_IRC_PASSWORD" 2> $data
316 385
     sel=$?
317 386
     case $sel in
318 387
         0)
319
-            EXISTING_IRC_PASSWORD=$(cat /etc/ngircd/ngircd.conf | grep "Password =" | head -n 1 | awk -F '=' '{print $2}')
320 388
             NEW_IRC_PASSWORD=$(<$data)
321
-            sed -i "0,/RE/s/Password =.*/Password =$NEW_IRC_PASSWORD/" /etc/ngircd/ngircd.conf
322
-
323
-            # replace the password for all users
324
-            for d in /home/*/ ; do
325
-                IRC_USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
326
-                if [[ $(is_valid_user "$IRC_USERNAME") == "1" ]]; then
327
-                    if [ -f /home/${IRC_USERNAME}/.irssi/config ]; then
328
-                        sed -i "s|$EXISTING_IRC_PASSWORD|$NEW_IRC_PASSWORD|g" /home/${IRC_USERNAME}/.irssi/config
329
-                        chown -R ${IRC_USERNAME}:${IRC_USERNAME} /home/${IRC_USERNAME}/.irssi
330
-                    fi
331
-                fi
332
-            done
333
-
334
-            read_config_param DEFAULT_DOMAIN_NAME
335
-            read_config_param IRC_PORT
336
-            read_config_param MY_USERNAME
337
-
338
-            stop_irc_bouncer
339
-            sleep 2
340
-
341
-            # change the hashes. There are multiple users, but since we're using a global
342
-            # password this doesn't matter
343
-            ZNC_SALT="$(dd if=/dev/urandom bs=16c count=1 | md5sum | awk -F ' ' '{print $1}' | cut -c1-20)"
344
-            new_user_hash=$(echo -n "${NEW_IRC_PASSWORD}${ZNC_SALT}" | sha256sum | awk -F ' ' '{print $1}')
345
-            sed -i "s|Hash = .*|Hash = ${new_user_hash}|g" /home/znc/.znc/configs/znc.conf
346
-            sed -i "s|Salt = .*|Salt = ${ZNC_SALT}|g" /home/znc/.znc/configs/znc.conf
347
-
348
-            # change the server password
349
-            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
350
-
351
-            # Update the password
352
-            ${PROJECT_NAME}-pass -u $MY_USERNAME -a irc -p "$NEW_IRC_PASSWORD"
353
-
354
-
355
-            if [ -f $INSTALL_DIR/matrix_irc_bridge/config.yaml ]; then
356
-                sed -i "s|password: .*|password: \"$NEW_IRC_PASSWORD\"|g" $INSTALL_DIR/matrix_irc_bridge/config.yaml
357
-                systemctl restart matrix_irc_bridge
358
-            fi
359
-
360
-            write_config_param "IRC_PASSWORD" "$NEW_IRC_PASSWORD"
361
-
362
-            # restart the daemon for the new password to take effect
363
-            systemctl restart ngircd
364
-            start_irc_bouncer
365
-
389
+            irc_set_global_password_base "$NEW_IRC_PASSWORD"
366 390
             dialog --title $"IRC Password" \
367 391
                    --msgbox $"The IRC password was changed" 6 40
368 392
             ;;

+ 0
- 4
src/freedombone-app-jitsi View File

@@ -73,10 +73,6 @@ function jitsi_disable_google_spyware {
73 73
     fi
74 74
 }
75 75
 
76
-function change_password_jitsi {
77
-    echo -n ''
78
-}
79
-
80 76
 function can_install_videobridge {
81 77
     check_architecture=$(uname -a)
82 78
     if [[ "$check_architecture" == *"amd64"* || "$check_architecture" == *"i386"* ]]; then

+ 0
- 4
src/freedombone-app-librevault View File

@@ -50,10 +50,6 @@ function install_interactive_librevault {
50 50
     APP_INSTALLED=1
51 51
 }
52 52
 
53
-function change_password_librevault {
54
-    echo -n ''
55
-}
56
-
57 53
 function reconfigure_librevault {
58 54
     echo -n ''
59 55
     # TODO

+ 2
- 4
src/freedombone-app-lychee View File

@@ -100,16 +100,14 @@ function install_interactive_lychee {
100 100
 }
101 101
 
102 102
 function change_password_lychee {
103
-    set_completion_param "lychee domain" "$LYCHEE_DOMAIN_NAME"
104
-    LYCHEE_DOMAIN_NAME=$(get_completion_param "lychee domain")
105
-
106 103
     LYCHEE_USERNAME="$1"
107 104
     LYCHEE_PASSWORD="$2"
108 105
     if [ ${#LYCHEE_PASSWORD} -lt 8 ]; then
109 106
         echo $'Lychee password is too short'
110 107
         return
111 108
     fi
112
-    ${PROJECT_NAME}-pass -u $LYCHEE_USERNAME -a lychee -p "$LYCHEE_PASSWORD"
109
+    # TODO: This doesn't actually change the password
110
+    #${PROJECT_NAME}-pass -u $LYCHEE_USERNAME -a lychee -p "$LYCHEE_PASSWORD"
113 111
 }
114 112
 
115 113
 function reconfigure_lychee {

+ 2
- 1
src/freedombone-app-mailpile View File

@@ -73,7 +73,8 @@ function install_interactive_mailpile {
73 73
 }
74 74
 
75 75
 function change_password_mailpile {
76
-    ${PROJECT_NAME}-pass -u $1 -a mailpile -p "$2"
76
+    echo -n ''
77
+    #${PROJECT_NAME}-pass -u $1 -a mailpile -p "$2"
77 78
 }
78 79
 
79 80
 function reconfigure_mailpile {

+ 14
- 3
src/freedombone-app-mumble View File

@@ -54,7 +54,18 @@ function install_interactive_mumble {
54 54
 }
55 55
 
56 56
 function change_password_mumble {
57
-    ${PROJECT_NAME}-pass -u $1 -a mumble -p "$2"
57
+    new_mumble_password="$2"
58
+
59
+    # Change the password for all users
60
+    for d in /home/*/ ; do
61
+        USERNAME=$(echo "$d" | awk -F '/' '{print $3}')
62
+        if [[ $(is_valid_user "$USERNAME") == "1" ]]; then
63
+            ${PROJECT_NAME}-pass -u "$USERNAME" -a mumble -p "$new_mumble_password"
64
+        fi
65
+    done
66
+
67
+    sed -i "s|serverpassword=.*|serverpassword=$new_mumble_password|g" /etc/mumble-server.ini
68
+    systemctl restart mumble-server
58 69
 }
59 70
 
60 71
 function reconfigure_mumble {
@@ -108,7 +119,7 @@ function restore_local_mumble {
108 119
         cp /etc/ssl/certs/mumble* /var/lib/mumble-server
109 120
         cp /etc/ssl/private/mumble* /var/lib/mumble-server
110 121
         chown -R mumble-server:mumble-server /var/lib/mumble-server
111
-        service mumble-server restart
122
+        systemctl restart mumble-server
112 123
     fi
113 124
 }
114 125
 
@@ -150,7 +161,7 @@ function restore_remote_mumble {
150 161
         cp /etc/ssl/certs/mumble* /var/lib/mumble-server
151 162
         cp /etc/ssl/private/mumble* /var/lib/mumble-server
152 163
         chown -R mumble-server:mumble-server /var/lib/mumble-server
153
-        service mumble-server restart
164
+        systemctl restart mumble-server
154 165
         echo $"Restore of Mumble complete"
155 166
     fi
156 167
 }

+ 0
- 4
src/freedombone-app-pelican View File

@@ -49,10 +49,6 @@ function install_interactive_pelican {
49 49
     APP_INSTALLED=1
50 50
 }
51 51
 
52
-function change_password_pelican {
53
-    echo -n ''
54
-}
55
-
56 52
 function reconfigure_pelican {
57 53
     echo -n ''
58 54
 }

+ 0
- 4
src/freedombone-app-pihole View File

@@ -268,10 +268,6 @@ function install_interactive_pihole {
268 268
     APP_INSTALLED=1
269 269
 }
270 270
 
271
-function change_password_pihole {
272
-    echo -n ''
273
-}
274
-
275 271
 function reconfigure_pihole {
276 272
     echo -n ''
277 273
 }

+ 9
- 1
src/freedombone-app-postactiv View File

@@ -146,7 +146,15 @@ function install_interactive_postactiv {
146 146
 }
147 147
 
148 148
 function change_password_postactiv {
149
-    echo -n ''
149
+    curr_username="$1"
150
+    new_user_password="$2"
151
+
152
+    read_config_param ${POSTACTIV_DOMAIN_NAME}
153
+
154
+    cd /var/www/${POSTACTIV_DOMAIN_NAME}/htdocs
155
+    ./scripts/setpassword "$curr_username" "$new_user_password"
156
+
157
+    ${PROJECT_NAME}-pass -u "$curr_username" -a postactiv -p "$new_user_password"
150 158
 }
151 159
 
152 160
 function postactiv_create_database {

+ 4
- 1
src/freedombone-app-rss View File

@@ -60,7 +60,10 @@ function install_interactive_rss {
60 60
 }
61 61
 
62 62
 function change_password_rss {
63
-    ${PROJECT_NAME}-pass -u $1 -a rss -p "$2"
63
+    curr_username="$1"
64
+    new_user_password="$2"
65
+
66
+    #${PROJECT_NAME}-pass -u "$curr_username" -a rss -p "$new_user_password"
64 67
 }
65 68
 
66 69
 function rss_create_database {

+ 4
- 1
src/freedombone-app-sip View File

@@ -97,7 +97,10 @@ function install_interactive_sip {
97 97
 }
98 98
 
99 99
 function change_password_sip {
100
-    ${PROJECT_NAME}-pass -u $1 -a sip -p "$2"
100
+    curr_username="$1"
101
+    new_user_password="$2"
102
+
103
+    #${PROJECT_NAME}-pass -u "$curr_username" -a sip -p "$new_user_password"
101 104
 }
102 105
 
103 106
 function reconfigure_sip {

+ 4
- 1
src/freedombone-app-synapse View File

@@ -212,7 +212,10 @@ function install_interactive_synapse {
212 212
 }
213 213
 
214 214
 function change_password_synapse {
215
-    ${PROJECT_NAME}-pass -u $1 -a synapse -p "$2"
215
+    curr_username="$1"
216
+    new_user_password="$2"
217
+
218
+    #${PROJECT_NAME}-pass -u "$curr_username" -a synapse -p "$new_user_password"
216 219
 }
217 220
 
218 221
 function reconfigure_synapse {

+ 0
- 4
src/freedombone-app-tahoelafs View File

@@ -51,10 +51,6 @@ function install_interactive_tahoelafs {
51 51
     APP_INSTALLED=1
52 52
 }
53 53
 
54
-function change_password_tahoelafs {
55
-    echo -n ''
56
-}
57
-
58 54
 function reconfigure_tahoelafs {
59 55
     for d in /home/*/ ; do
60 56
         USERNAME=$(echo "$d" | awk -F '/' '{print $3}')

+ 0
- 4
src/freedombone-app-vpn View File

@@ -37,10 +37,6 @@ function install_interactive_vpn {
37 37
     APP_INSTALLED=1
38 38
 }
39 39
 
40
-function change_password_vpn {
41
-    echo -n ''
42
-}
43
-
44 40
 function reconfigure_vpn {
45 41
     echo -n ''
46 42
 }

+ 0
- 4
src/freedombone-app-zeronet View File

@@ -66,10 +66,6 @@ function install_interactive_zeronet {
66 66
     APP_INSTALLED=1
67 67
 }
68 68
 
69
-function change_password_zeronet {
70
-    echo -n ''
71
-}
72
-
73 69
 function reconfigure_zeronet {
74 70
     echo -n ''
75 71
 }