Przeglądaj źródła

Reimplementation of tahoelafs

Bob Mottram 8 lat temu
rodzic
commit
3c31be64b5

+ 276
- 86
src/freedombone-app-tahoelafs Wyświetl plik

@@ -8,13 +8,14 @@
8 8
 #
9 9
 #                    Freedom in the Cloud
10 10
 #
11
-# Distributed storage system introducer
11
+# Tahow-LAFS data storage grid implemented via Tor
12
+# https://k0rx.com/blog/2017/01/lafs.html
12 13
 # http://tahoe-lafs.readthedocs.io/en/latest/anonymity-configuration.html
13 14
 #
14 15
 # License
15 16
 # =======
16 17
 #
17
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
18
+# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
18 19
 #
19 20
 # This program is free software: you can redistribute it and/or modify
20 21
 # it under the terms of the GNU Affero General Public License as published by
@@ -38,51 +39,138 @@ TAHOELAFS_REPO="https://github.com/tahoe-lafs/tahoe-lafs"
38 39
 TAHOELAFS_COMMIT='bb782b0331a60de438136a593bba18338d8d866b'
39 40
 
40 41
 TAHOELAFS_PORT=50213
42
+TAHOELAFS_STORAGE_PORT=50214
41 43
 TAHOELAFS_ONION_PORT=8096
44
+TAHOELAFS_STORAGE_ONION_PORT=8097
42 45
 
43
-TAHOELAFS_SHARED_DIR='Shared'
44 46
 TAHOE_COMMAND="cd /home/tahoelafs/tahoelafs && venv/bin/tahoe"
47
+tahoelafs_storage_file=/home/tahoelafs/client/private/servers.yaml
45 48
 
46 49
 tahoelafs_variables=(ONION_ONLY
50
+                     MY_USERNAME
47 51
                      TAHOELAFS_REPO
48 52
                      TAHOELAFS_PORT)
49 53
 
50
-function tahoelafs_setup_config {
51
-    config_file=$1
52
-    nick="$2"
53
-
54
-    if ! grep -q "[node]" $config_file; then
55
-        echo '' >> $config_file
56
-        echo '[node]' >> $config_file
54
+function add_tahoelafs_storage_node_interactive {
55
+    data=$(tempfile 2>/dev/null)
56
+    trap "rm -f $data" 0 1 2 5 15
57
+    dialog --backtitle $"Freedombone Configuration" \
58
+           --title $"Add Tahoe-LAFS storage node" \
59
+           --form $"\nEnter the storage node details which can be found on the About screen of another server" 13 75 5 \
60
+           $"Hostname:" 1 1 "" 1 14 53 40 \
61
+           $"Public Key:" 2 1 "" 2 14 53 255 \
62
+           $"Nickname:" 3 1 "" 3 14 53 255 \
63
+           $"FURL:" 4 1 "" 4 14 53 255 \
64
+           2> $data
65
+    sel=$?
66
+    case $sel in
67
+        1) return;;
68
+        255) return;;
69
+    esac
70
+    storage_hostname=$(cat $data | sed -n 1p)
71
+    public_key="$(cat $data | sed -n 2p)"
72
+    nick=$(cat $data | sed -n 3p)
73
+    furl=$(cat $data | sed -n 4p)
74
+
75
+    if [ ${#public_key} -eq 0 ]; then
76
+        return
57 77
     fi
58 78
 
59
-    if ! grep -q "[connections]" $config_file; then
60
-        echo '' >> $config_file
61
-        echo '[connections]' >> $config_file
62
-    fi
79
+    add_tahoelafs_server "${storage_hostname}" "${public_key}" "${nick}" "${furl}"
63 80
 
64
-    if ! grep -q "reveal-IP-address" $config_file; then
65
-        sed -i '/[node]/a reveal-IP-address = False' $config_file
66
-    else
67
-        sed -i 's|reveal-IP-address.*|reveal-IP-address = False|g' $config_file
81
+    if grep -q "$public_key" $tahoelafs_storage_file; then
82
+        dialog --title $"Add Tahoe-LAFS storage node" \
83
+               --msgbox $"Storage node added" 6 40
68 84
     fi
85
+}
69 86
 
70
-    if ! grep -q "tcp =" $config_file; then
71
-        sed -i '/[connections]/a tcp = tor' $config_file
72
-    else
73
-        sed -i 's|tcp =.*|tcp = tor|g' $config_file
74
-    fi
87
+function edit_tahoelafs_nodes {
88
+    editor $tahoelafs_storage_file
89
+    chown tahoelafs:debian-tor $tahoelafs_storage_file
90
+    systemctl restart tahoelafs-client
91
+}
75 92
 
76
-    if ! grep -q "tub.location =" $config_file; then
77
-        sed -i '/[node]/a tub.location = disabled' $config_file
78
-    fi
79
-    if ! grep -q "tub.port =" $config_file; then
80
-        sed -i "/[node]/a tub.port = tcp:${TAHOELAFS_ONION_PORT}:interface=127.0.0.1" $config_file
81
-    fi
82
-    sed -i "s|tub.port.*|tub.port = tcp:${TAHOELAFS_ONION_PORT}:interface=127.0.0.1|g" $config_file
83
-    sed -i "s|tub.location.*|tub.location = tor:${TAHOELAFS_ONION_HOSTNAME}:${TAHOELAFS_PORT}|g" $config_file
93
+function configure_interactive_tahoelafs {
94
+    data=$(tempfile 2>/dev/null)
95
+    trap "rm -f $data" 0 1 2 5 15
96
+    dialog --backtitle $"Freedombone Configuration" \
97
+           --title $"Tahoe-LAFS" \
98
+           --radiolist $"The least authority is always the best" 10 50 3 \
99
+           1 "Add a storage node" off \
100
+           2 "Manually edit storage nodes" off \
101
+           3 "Back to main menu" on 2> $data
102
+    sel=$?
103
+    case $sel in
104
+        1) exit 1;;
105
+        255) exit 1;;
106
+    esac
107
+    case $(cat $data) in
108
+        1) add_tahoelafs_storage_node_interactive;;
109
+        2) edit_tahoelafs_nodes;;
110
+    esac
111
+}
112
+
113
+function tahoelafs_setup_client_config {
114
+    config_file=$1
115
+    nick="$2"
116
+
117
+    echo '[node]' > $config_file
118
+    echo "nickname = $nick" >> $config_file
119
+    echo 'reveal-IP-address = false' >> $config_file
120
+    echo "web.port = tcp:$TAHOELAFS_ONION_PORT:interface=127.0.0.1" >> $config_file
121
+    echo 'web.static = public_html' >> $config_file
122
+    echo 'tub.port = disabled' >> $config_file
123
+    echo 'tub.location = disabled' >> $config_file
124
+    echo '' >> $config_file
125
+    echo '[client]' >> $config_file
126
+    echo 'introducer.furl =' >> $config_file
127
+    echo 'shares.needed = 3' >> $config_file
128
+    echo 'shares.happy = 7' >> $config_file
129
+    echo 'shares.total = 10' >> $config_file
130
+    echo '' >> $config_file
131
+    echo '[storage]' >> $config_file
132
+    echo 'enabled = false' >> $config_file
133
+    echo 'reserved_space = 3G' >> $config_file
134
+    echo '' >> $config_file
135
+    echo '[helper]' >> $config_file
136
+    echo 'enabled = false' >> $config_file
137
+    echo '' >> $config_file
138
+    echo '[connections]' >> $config_file
139
+    echo 'tcp = tor' >> $config_file
140
+}
141
+
142
+function tahoelafs_setup_storage_config {
143
+    config_file=$1
144
+    nick="$2"
84 145
 
85
-    sed -i "s|nickname =.*|nickname = ${NICK}|g" $config_file
146
+    echo '[node]' > $config_file
147
+    echo "nickname = $nick" >> $config_file
148
+    echo 'reveal-IP-address = false' >> $config_file
149
+    echo 'web.port =' >> $config_file
150
+    echo 'web.static = public_html' >> $config_file
151
+    echo "tub.port = tcp:${TAHOELAFS_STORAGE_ONION_PORT}:interface=127.0.0.1" >> $config_file
152
+    echo "tub.location = tor:${TAHOELAFS_STORAGE_ONION_HOSTNAME}:${TAHOELAFS_STORAGE_PORT}" >> $config_file
153
+    echo '' >> $config_file
154
+    echo '[client]' >> $config_file
155
+    echo 'introducer.furl =' >> $config_file
156
+    echo 'helper.furl =' >> $config_file
157
+    echo '' >> $config_file
158
+    echo 'shares.needed = 3' >> $config_file
159
+    echo 'shares.happy = 7' >> $config_file
160
+    echo 'shares.total = 10' >> $config_file
161
+    echo '' >> $config_file
162
+    echo '[storage]' >> $config_file
163
+    echo 'enabled = true' >> $config_file
164
+    echo 'reserved_space = 3G' >> $config_file
165
+    echo 'expire.enabled = true' >> $config_file
166
+    echo 'expire.mode = age' >> $config_file
167
+    echo 'expire.override_lease_duration = 3 months' >> $config_file
168
+    echo '' >> $config_file
169
+    echo '[helper]' >> $config_file
170
+    echo 'enabled = false' >> $config_file
171
+    echo '' >> $config_file
172
+    echo '[connections]' >> $config_file
173
+    echo 'tcp = tor' >> $config_file
86 174
 
87 175
     chown -R tahoelafs:debian-tor /home/tahoelafs
88 176
 }
@@ -169,7 +257,10 @@ function restore_remote_tahoelafs {
169 257
 }
170 258
 
171 259
 function reconfigure_tahoelafs {
172
-    echo -n ''
260
+    if [ -f $tahoelafs_storage_file ]; then
261
+        shred -zu $tahoelafs_storage_file
262
+    fi
263
+    sed -i '/HidServAuth /d' /etc/tor/torrc
173 264
 }
174 265
 
175 266
 function remove_tahoelafs {
@@ -184,31 +275,26 @@ function remove_tahoelafs {
184 275
 
185 276
     systemctl stop tahoelafs-storage
186 277
     systemctl disable tahoelafs-storage
187
-    rm /etc/systemd/system/tahoelafs-storage.service
278
+    rm /etc/systemd/system/tahoelafs-storage.serice
188 279
 
189
-    systemctl stop tahoelafs-introducer
190
-    systemctl disable tahoelafs-introducer
191
-    rm /etc/systemd/system/tahoelafs-introducer.service
280
+    systemctl stop tahoelafs-client
281
+    systemctl disable tahoelafs-client
282
+    rm /etc/systemd/system/tahoelafs-client.serice
192 283
 
193
-    #firewall_remove ${TAHOELAFS_PORT}
194
-    rm -rf /var/lib/tahoelafs
284
+    if [ -d /var/lib/tahoelafs ]; then
285
+        rm -rf /var/lib/tahoelafs
286
+    fi
195 287
     remove_completion_param install_tahoelafs
196
-    #remove_completion_param configure_firewall_for_tahoelafs
197 288
     function_check remove_onion_service
198 289
     remove_onion_service tahoelafs ${TAHOELAFS_ONION_PORT}
290
+    remove_onion_service tahoelafs-storage ${TAHOELAFS_STORAGE_ONION_PORT}
291
+    sed -i '/HidServAuth /d' /etc/tor/torrc
199 292
     deluser tahoelafs
200 293
     if [ -d /home/tahoelafs ]; then
201 294
         rm -rf /home/tahoelafs
202 295
     fi
203 296
     remove_app tahoelafs
204
-}
205
-
206
-function configure_firewall_for_tahoelafs {
207
-    if [[ $(is_completed $FUNCNAME) == "1" ]]; then
208
-        return
209
-    fi
210
-    firewall_add Tahoe-LAFS ${TAHOELAFS_PORT}
211
-    mark_completed $FUNCNAME
297
+    systemctl reload tor
212 298
 }
213 299
 
214 300
 function install_tahoelafs_to_directory {
@@ -227,6 +313,42 @@ function install_tahoelafs_to_directory {
227 313
     venv/bin/pip install --editable .
228 314
 }
229 315
 
316
+function create_tahoelafs_stealth_node {
317
+    node_dir="$1"
318
+    client_dir="$2"
319
+    node_nick="$3"
320
+    client_nick="$4"
321
+
322
+    if [ ${#node_dir} -eq 0 ]; then
323
+        echo $'No tahoe-LAFS storage node directory given'
324
+        exit 783522
325
+    fi
326
+    if [ ${#client_dir} -eq 0 ]; then
327
+        echo $'No tahoe-LAFS client directory given'
328
+        exit 368935
329
+    fi
330
+    if [ ${#node_nick} -eq 0 ]; then
331
+        echo $'No tahoe-LAFS node nick given'
332
+        exit 672351
333
+    fi
334
+    if [ ${#client_nick} -eq 0 ]; then
335
+        echo $'No tahoe-LAFS client nick given'
336
+        exit 682362
337
+    fi
338
+
339
+    if [ ! -f ${node_dir}/tahoe.cfg ]; then
340
+        su -c "mkdir ${node_dir}" - tahoelafs
341
+        su -c "$TAHOE_COMMAND create-node -C ${node_dir} --hostname=fixme" - tahoelafs
342
+        tahoelafs_setup_storage_config ${node_dir}/tahoe.cfg ${node_nick}
343
+    fi
344
+
345
+    if [ ! -f ${client_dir}/tahoe.cfg ]; then
346
+        su -c "mkdir ${client_dir}" - tahoelafs
347
+        su -c "$TAHOE_COMMAND create-client -C ${client_dir}" - tahoelafs
348
+        tahoelafs_setup_client_config ${client_dir}/tahoe.cfg ${client_nick}
349
+    fi
350
+}
351
+
230 352
 function create_tahoelafs_introducer {
231 353
     introducer_dir="$1"
232 354
 
@@ -275,8 +397,58 @@ function create_tahoelafs_client {
275 397
     sed -i 's|tub.location =.*|tub.location = disabled|g' $client_dir/tahoe.cfg
276 398
 }
277 399
 
278
-function get_tahoelafs_introducer {
279
-    echo "$(cat /home/tahoelafs/introducer/private/introducer.furl)"
400
+function get_tahoelafs_furl {
401
+    echo "$(cat /home/tahoelafs/storage/private/storage.furl)"
402
+}
403
+
404
+function get_tahoelafs_nick {
405
+    echo "${MY_USERNAME}-node"
406
+}
407
+
408
+function get_tahoelafs_storage_hostname {
409
+    echo "$(cat /var/lib/tor/hidden_service_tahoelafs-storage/hostname)"
410
+}
411
+
412
+function get_tahoelafs_public_key {
413
+    echo "$(cat /home/tahoelafs/storage/node.pubkey | grep 'v0-')"
414
+}
415
+
416
+function add_tahoelafs_server {
417
+    storage_hostname="$1"
418
+    public_key="$2"
419
+    nick="$3"
420
+    furl="$4"
421
+
422
+    if [ ${#storage_hostname} -eq 0 ]; then
423
+        return
424
+    fi
425
+    if [ ${#public_key} -eq 0 ]; then
426
+        return
427
+    fi
428
+    if [ ${#nick} -eq 0 ]; then
429
+        return
430
+    fi
431
+    if [ ${#furl} -eq 0 ]; then
432
+        return
433
+    fi
434
+
435
+    if grep -q "$public_key" $tahoelafs_storage_file; then
436
+        return
437
+    fi
438
+    if [ ! -f $tahoelafs_storage_file ]; then
439
+        echo 'storage:' > $tahoelafs_storage_file
440
+    else
441
+        echo '# storage' >> $tahoelafs_storage_file
442
+    fi
443
+    echo "  $public_key" >> $tahoelafs_storage_file
444
+    echo "    ann:" >> $tahoelafs_storage_file
445
+    echo "      nickname: $nick" >> $tahoelafs_storage_file
446
+    echo "      anonymous-storage-FURL: $furl" >> $tahoelafs_storage_file
447
+    chown tahoelafs:debian-tor $tahoelafs_storage_file
448
+
449
+    if ! grep -q "HidServAuth ${storage_hostname}" /etc/tor/torrc; then
450
+        echo "HidServAuth ${storage_hostname}" >> /etc/tor/torrc
451
+    fi
280 452
 }
281 453
 
282 454
 function create_tahoelafs_daemon {
@@ -308,6 +480,45 @@ function create_tahoelafs_daemon {
308 480
     systemctl start tahoelafs-${daemon_name}
309 481
 }
310 482
 
483
+function create_tahoelafs_web {
484
+    if [ ! -d /var/www/tahoelafs/htdocs ]; then
485
+        mkdir -p /var/www/tahoelafs/htdocs
486
+    fi
487
+
488
+    tahoelafs_nginx_site=/etc/nginx/sites-available/tahoelafs
489
+    echo 'server {' > $tahoelafs_nginx_site
490
+    echo "    listen 127.0.0.1:$TAHOELAFS_ONION_PORT default_server;" >> $tahoelafs_nginx_site
491
+    echo "    server_name $TAHOELAFS_ONION_HOSTNAME;" >> $tahoelafs_nginx_site
492
+    echo '' >> $tahoelafs_nginx_site
493
+    function_check nginx_disable_sniffing
494
+    nginx_disable_sniffing tahoelafs
495
+    echo '' >> $tahoelafs_nginx_site
496
+    echo '  # Logs' >> $tahoelafs_nginx_site
497
+    echo '  access_log /dev/null;' >> $tahoelafs_nginx_site
498
+    echo '  error_log /dev/null;' >> $tahoelafs_nginx_site
499
+    echo '' >> $tahoelafs_nginx_site
500
+    echo '  # Root' >> $tahoelafs_nginx_site
501
+    echo "  root /var/www/tahoelafs/htdocs;" >> $tahoelafs_nginx_site
502
+    echo '' >> $tahoelafs_nginx_site
503
+    echo '  location / {' >> $tahoelafs_nginx_site
504
+    function_check nginx_limits
505
+    nginx_limits tahoelafs '15m'
506
+    echo '    rewrite /(.*) /$1 break;' >> $tahoelafs_nginx_site
507
+    echo '    proxy_set_header X-Real-IP $remote_addr;' >> $tahoelafs_nginx_site
508
+    echo '    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $tahoelafs_nginx_site
509
+    echo '    proxy_set_header Host $http_host;' >> $tahoelafs_nginx_site
510
+    echo '    proxy_set_header X-NginX-Proxy true;' >> $tahoelafs_nginx_site
511
+    echo "    proxy_pass http://localhost:${TAHOELAFS_PORT};" >> $tahoelafs_nginx_site
512
+    echo '    proxy_redirect off;' >> $tahoelafs_nginx_site
513
+    echo '  }' >> $tahoelafs_nginx_site
514
+    echo '}' >> $tahoelafs_nginx_site
515
+
516
+    function_check nginx_ensite
517
+    nginx_ensite tahoelafs
518
+
519
+    systemctl reload nginx
520
+}
521
+
311 522
 function install_tahoelafs {
312 523
     if [ $INSTALLING_MESH ]; then
313 524
         return
@@ -328,7 +539,6 @@ function install_tahoelafs {
328 539
     fi
329 540
 
330 541
     install_tahoelafs_to_directory /home/tahoelafs/tahoelafs
331
-    #configure_firewall_for_tahoelafs
332 542
 
333 543
     # remove files we don't need
334 544
     rm -rf /home/tahoelafs/.mutt
@@ -340,51 +550,31 @@ function install_tahoelafs {
340 550
     # set permissions
341 551
     chown -R tahoelafs:debian-tor /home/tahoelafs
342 552
 
343
-    # create the introducer config
344
-    create_tahoelafs_introducer /home/tahoelafs/introducer
345
-    TAHOELAFS_INTRODUCER_CONFIG=/home/tahoelafs/introducer/tahoe.cfg
346
-    if [ ! -f $TAHOELAFS_INTRODUCER_CONFIG ]; then
347
-        echo $'Unable to create introducer'
348
-        exit 62831
349
-    fi
553
+    node_nick=$(get_tahoelafs_nick)
554
+    client_nick=${MY_USERNAME}-client
350 555
 
351
-    # create an onion address
556
+    # create an onion address for storage node
557
+    TAHOELAFS_STORAGE_ONION_HOSTNAME=$(add_onion_service tahoelafs-storage ${TAHOELAFS_STORAGE_PORT} ${TAHOELAFS_STORAGE_ONION_PORT} ${node_nick})
558
+
559
+    # create an onion address for client node
352 560
     TAHOELAFS_ONION_HOSTNAME=$(add_onion_service tahoelafs ${TAHOELAFS_PORT} ${TAHOELAFS_ONION_PORT})
353 561
 
354
-    # start the introducer
355
-    tahoelafs_setup_config $TAHOELAFS_INTRODUCER_CONFIG ${PROJECT_NAME}-introducer
356
-    su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/introducer' - tahoelafs
357
-    TAHOELAFS_INTRODUCER=/home/tahoelafs/introducer/tahoe-introducer.tac
358
-    if [ ! -f $TAHOELAFS_INTRODUCER ]; then
359
-        echo $'Introducer file not found'
360
-        exit 9654845
361
-    fi
362
-    create_tahoelafs_daemon "introducer"
562
+    create_tahoelafs_stealth_node /home/tahoelafs/storage /home/tahoelafs/client ${node_nick} ${client_nick}
363 563
 
364
-    # start the storage node
365
-    create_tahoelafs_storage_node /home/tahoelafs/storage "$(get_tahoelafs_introducer)"
366
-    TAHOELAFS_STORAGE_CONFIG=/home/tahoelafs/storage/tahoe.cfg
367
-    if [ ! -f $TAHOELAFS_STORAGE_CONFIG ]; then
368
-        echo $'Unable to create storage node'
369
-        exit 782523
370
-    fi
371
-    if grep -q 'tub.location' $TAHOELAFS_STORAGE_CONFIG; then
372
-        sed -i "s|tub.location.*|tub.location = disabled|g" $TAHOELAFS_STORAGE_CONFIG
373
-    else
374
-        echo 'tub.location = disabled' >> $TAHOELAFS_STORAGE_CONFIG
375
-    fi
376
-    if grep -q 'tub.port' $TAHOELAFS_STORAGE_CONFIG; then
377
-        sed -i "s|tub.port.*|tub.port = disabled|g" $TAHOELAFS_STORAGE_CONFIG
378
-    else
379
-        echo 'tub.port = disabled' >> $TAHOELAFS_STORAGE_CONFIG
380
-    fi
381
-    sed -i "s|web.port.*|web.port =|g" $TAHOELAFS_STORAGE_CONFIG
564
+    add_tahoelafs_server "$(get_tahoelafs_storage_hostname)" "$(get_tahoelafs_public_key)" "${node_nick}" "$(get_tahoelafs_furl)"
382 565
 
566
+    # start the storage node
383 567
     su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/storage' - tahoelafs
384 568
     create_tahoelafs_daemon "storage"
385 569
 
570
+    # start the client
571
+    su -c '/home/tahoelafs/tahoelafs/venv/bin/python2 /home/tahoelafs/tahoelafs/venv/bin/tahoe start /home/tahoelafs/client' - tahoelafs
572
+    create_tahoelafs_daemon "client"
573
+
386 574
     set_completion_param "tahoelafs commit" "$TAHOELAFS_COMMIT"
387 575
 
576
+    create_tahoelafs_web
577
+    systemctl reload tor
388 578
     APP_INSTALLED=1
389 579
 }
390 580
 

+ 2
- 2
src/freedombone-config Wyświetl plik

@@ -195,8 +195,8 @@ function choose_default_domain_name {
195 195
                 esac
196 196
                 DEFAULT_DOMAIN_NAME=$(cat $data | sed -n 1p)
197 197
                 DEFAULT_DOMAIN_CODE=$(cat $data | sed -n 2p)
198
-                EMAIL_DOMAIN_CODE=$(cat $data | sed -n 2p)
199
-                XMPP_DOMAIN_CODE=$(cat $data | sed -n 2p)
198
+                EMAIL_DOMAIN_CODE=$(cat $data | sed -n 3p)
199
+                XMPP_DOMAIN_CODE=$(cat $data | sed -n 4p)
200 200
                 if [ $DEFAULT_DOMAIN_NAME ]; then
201 201
                     validate_freedns_code "$DEFAULT_DOMAIN_CODE"
202 202
                     if [ ! $VALID_CODE ]; then

+ 10
- 6
src/freedombone-controlpanel Wyświetl plik

@@ -93,6 +93,7 @@ read_config_param SMTP_PROXY_PORT
93 93
 read_config_param SMTP_PROXY_USERNAME
94 94
 read_config_param SMTP_PROXY_PASSWORD
95 95
 read_config_param USB_DRIVE
96
+read_config_param MY_USERNAME
96 97
 if [[ $USB_DRIVE == *"dev"* ]]; then
97 98
     USB_DRIVE=$(echo ${USB_DRIVE} | awk -F '/' '{print $3}' | sed 's|1||g' | sed 's|2||g')
98 99
 fi
@@ -476,14 +477,17 @@ function show_mirrors_password {
476 477
     echo ''
477 478
 }
478 479
 
479
-function show_tahoe_introducer {
480
-    if [ ! -f /home/tahoelafs/introducer/private/introducer.furl ]; then
480
+function show_tahoelafs {
481
+    if [ ! -f /home/tahoelafs/storage/private/storage.furl ]; then
481 482
         return
482 483
     fi
483
-    echo 'Tahoe-LAFS'
484
-    echo '=========='
484
+    echo 'Tahoe-LAFS Storage Node'
485
+    echo '======================='
485 486
     echo ''
486
-    get_tahoelafs_introducer
487
+    echo "Hostname:   $(get_tahoelafs_storage_hostname)"
488
+    echo "Public key: $(get_tahoelafs_public_key)"
489
+    echo "Nickname:   $(get_tahoelafs_nick)"
490
+    echo "FURL:       $(get_tahoelafs_furl)"
487 491
     echo ''
488 492
 }
489 493
 
@@ -562,7 +566,7 @@ function show_about {
562 566
     show_tor_bridges
563 567
     show_ssh_public_key
564 568
     show_domains
565
-    show_tahoelafs_introducer
569
+    show_tahoelafs
566 570
     show_mirrors_password
567 571
     show_tahoe_introducer
568 572
     show_users

+ 4
- 1
src/freedombone-utils-onion Wyświetl plik

@@ -112,6 +112,7 @@ function add_onion_service {
112 112
     onion_service_name="$1"
113 113
     onion_service_port_from=$2
114 114
     onion_service_port_to=$3
115
+    onion_stealth_name="$4"
115 116
 
116 117
     if [[ $(onion_service_exists ${onion_service_name}) == "1" ]]; then
117 118
         echo $(cat /var/lib/tor/hidden_service_${onion_service_name}/hostname)
@@ -125,7 +126,9 @@ function add_onion_service {
125 126
     if ! grep -q "hidden_service_${onion_service_name}" /etc/tor/torrc; then
126 127
         echo "HiddenServiceDir /var/lib/tor/hidden_service_${onion_service_name}/" >> /etc/tor/torrc
127 128
         echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
128
-        #echo "HiddenServiceAuthorizeClient stealth ${onion_service_name}" >> /etc/tor/torrc
129
+        if [ ${#onion_stealth_name} -gt 0 ]; then
130
+            echo "HiddenServiceAuthorizeClient stealth ${onion_stealth_name}" >> /etc/tor/torrc
131
+        fi
129 132
     fi
130 133
 
131 134
     onion_update