|
@@ -64,6 +64,110 @@ xmpp_variables=(ONION_ONLY
|
64
|
64
|
DEFAULT_DOMAIN_NAME
|
65
|
65
|
XMPP_DOMAIN_CODE)
|
66
|
66
|
|
|
67
|
+function xmpp_add_onion_address {
|
|
68
|
+ domain_name="$1"
|
|
69
|
+ onion_address="$2"
|
|
70
|
+ if [ ${#domain_name} -eq 0 ]; then
|
|
71
|
+ return
|
|
72
|
+ fi
|
|
73
|
+ if [ ${#onion_address} -eq 0 ]; then
|
|
74
|
+ return
|
|
75
|
+ fi
|
|
76
|
+ if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then
|
|
77
|
+ sed -i "s|[\"${domain_name}\"].*|[\"${domain_name}\"] = \"${onion_address}\";|g" /etc/prosody/prosody.cfg.lua
|
|
78
|
+ else
|
|
79
|
+ sed -i "/onions_map = {/a [\"${domain_name}\"] = \"${onion_address}\";" /etc/prosody/prosody.cfg.lua
|
|
80
|
+ fi
|
|
81
|
+ systemctl restart prosody
|
|
82
|
+}
|
|
83
|
+
|
|
84
|
+function xmpp_add_onion_address_interactive {
|
|
85
|
+ data=$(tempfile 2>/dev/null)
|
|
86
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
87
|
+ dialog --backtitle $"Freedombone Control Panel" \
|
|
88
|
+ --title $"Add an ICANN to Onion domain mapping" \
|
|
89
|
+ --form $"Sepecify an ICANN domain name and its equivalent onion address\n" 9 50 2 \
|
|
90
|
+ $"Domain:" 1 1 "" 1 18 26 25 \
|
|
91
|
+ $"Onion address:" 2 1 "" 2 18 26 25 \
|
|
92
|
+ 2> $data
|
|
93
|
+ sel=$?
|
|
94
|
+ case $sel in
|
|
95
|
+ 1) return;;
|
|
96
|
+ 255) return;;
|
|
97
|
+ esac
|
|
98
|
+ domain_name=$(cat $data | sed -n 1p)
|
|
99
|
+ onion_address=$(cat $data | sed -n 2p)
|
|
100
|
+ if [[ "$onion_address" != *".onion" ]]; then
|
|
101
|
+ return
|
|
102
|
+ fi
|
|
103
|
+ if [[ "$domain_name" != *"."* ]]; then
|
|
104
|
+ return
|
|
105
|
+ fi
|
|
106
|
+
|
|
107
|
+ xmpp_add_onion_address "$domain_name" "$onion_address"
|
|
108
|
+
|
|
109
|
+ dialog --title $"Add an ICANN to Onion domain mapping" \
|
|
110
|
+ --msgbox $"${domain_name} -> ${onion_address} added" 6 70
|
|
111
|
+}
|
|
112
|
+
|
|
113
|
+function xmpp_remove_onion_address {
|
|
114
|
+ domain_name="$1"
|
|
115
|
+ if [ ${#domain_name} -eq 0 ]; then
|
|
116
|
+ return
|
|
117
|
+ fi
|
|
118
|
+ if grep -q "[\"${domain_name}\"]" /etc/prosody/prosody.cfg.lua; then
|
|
119
|
+ sed -i "/[\"${domain_name}\"]/d" /etc/prosody/prosody.cfg.lua
|
|
120
|
+ fi
|
|
121
|
+
|
|
122
|
+ if grep -q "= \"${domain_name}\";" /etc/prosody/prosody.cfg.lua; then
|
|
123
|
+ sed -i "/= \"${domain_name}\";/d" /etc/prosody/prosody.cfg.lua
|
|
124
|
+ fi
|
|
125
|
+ systemctl restart prosody
|
|
126
|
+}
|
|
127
|
+
|
|
128
|
+function xmpp_remove_onion_address_interactive {
|
|
129
|
+ data=$(tempfile 2>/dev/null)
|
|
130
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
131
|
+ dialog --title $"Remove ICANN to Onion domain mapping" \
|
|
132
|
+ --backtitle $"Freedombone Control Panel" \
|
|
133
|
+ --inputbox $'Enter the domain name or onion address to be removed' 8 60 2>$data
|
|
134
|
+ sel=$?
|
|
135
|
+ case $sel in
|
|
136
|
+ 0) domain_name=$(<$data)
|
|
137
|
+ if [[ "$domain_name" != *"."* ]]; then
|
|
138
|
+ return
|
|
139
|
+ fi
|
|
140
|
+ xmpp_remove_onion_address "$domain_name"
|
|
141
|
+ dialog --title $"Remove an ICANN to Onion domain mapping" \
|
|
142
|
+ --msgbox $"${domain_name} removed" 6 70
|
|
143
|
+ ;;
|
|
144
|
+ esac
|
|
145
|
+}
|
|
146
|
+
|
|
147
|
+function configure_interactive_xmpp {
|
|
148
|
+ while true
|
|
149
|
+ do
|
|
150
|
+ data=$(tempfile 2>/dev/null)
|
|
151
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
152
|
+ dialog --backtitle $"Freedombone Control Panel" \
|
|
153
|
+ --title $"XMPP" \
|
|
154
|
+ --radiolist $"Choose an operation:" 12 70 3 \
|
|
155
|
+ 1 $"Add an ICANN to onion domain mapping" off \
|
|
156
|
+ 2 $"Remove an ICANN to onion domain mapping" off \
|
|
157
|
+ 3 $"Exit" on 2> $data
|
|
158
|
+ sel=$?
|
|
159
|
+ case $sel in
|
|
160
|
+ 1) return;;
|
|
161
|
+ 255) return;;
|
|
162
|
+ esac
|
|
163
|
+ case $(cat $data) in
|
|
164
|
+ 1) xmpp_add_onion_address_interactive;;
|
|
165
|
+ 2) xmpp_remove_onion_address_interactive;;
|
|
166
|
+ 3) break;;
|
|
167
|
+ esac
|
|
168
|
+ done
|
|
169
|
+}
|
|
170
|
+
|
67
|
171
|
function remove_user_xmpp {
|
68
|
172
|
remove_username="$1"
|
69
|
173
|
${PROJECT_NAME}-pass -u $remove_username --rmapp xmpp
|
|
@@ -214,6 +318,13 @@ function upgrade_xmpp_server {
|
214
|
318
|
fi
|
215
|
319
|
rm ${INSTALL_DIR}/${prosody_filename}.tar.gz
|
216
|
320
|
fi
|
|
321
|
+
|
|
322
|
+ # add onion addresses for known servers
|
|
323
|
+ if ! grep -q "onions_map =" /etc/prosody/prosody.cfg.lua; then
|
|
324
|
+ echo '' >> /etc/prosody/prosody.cfg.lua
|
|
325
|
+ xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
|
|
326
|
+ fi
|
|
327
|
+
|
217
|
328
|
systemctl restart prosody
|
218
|
329
|
}
|
219
|
330
|
|
|
@@ -432,12 +543,52 @@ function xmpp_modules {
|
432
|
543
|
echo '};' >> $filename
|
433
|
544
|
}
|
434
|
545
|
|
|
546
|
+function xmpp_onion_addresses {
|
|
547
|
+ filename=$1
|
|
548
|
+ echo 'onions_map = {' >> $filename
|
|
549
|
+ echo ' ["anonymitaet-im-inter.net"] = "rwf5skuv5vqzcdit.onion";' >> $filename
|
|
550
|
+ echo ' ["autistici.org"] = "wi7qkxyrdpu5cmvr.onion";' >> $filename
|
|
551
|
+ echo ' ["jabber.calyxinstitute.org"] = "ijeeynrc6x2uy5ob.onion";' >> $filename
|
|
552
|
+ echo ' ["jabber.ccc.de"] = "okj7xc6j2szr2y75.onion";' >> $filename
|
|
553
|
+ echo ' ["cloak.dk"] = "m2dsl4banuimpm6c.onion";' >> $filename
|
|
554
|
+ echo ' ["jabber.cryptoparty.is"] = "cryjabkbdljzohnp.onion";' >> $filename
|
|
555
|
+ echo ' ["daemons.cf"] = "daemon4jidu2oig6.onion";' >> $filename
|
|
556
|
+ echo ' ["dukgo.com"] = "wlcpmruglhxp6quz.onion";' >> $filename
|
|
557
|
+ echo ' ["evil.im"] = "evilxro6nvjuvxqo.onion";' >> $filename
|
|
558
|
+ echo ' ["xmpp.evil.im"] = "evilxro6nvjuvxqo.onion";' >> $filename
|
|
559
|
+ echo ' ["inventati.org"] = "wi7qkxyrdpu5cmvr.onion";' >> $filename
|
|
560
|
+ echo ' ["jabber.ipredator.se"] = "3iffdebkzzkpgipa.onion";' >> $filename
|
|
561
|
+ echo ' ["jabber-germany.de"] = "dbbrphko5tqcpar3.onion";' >> $filename
|
|
562
|
+ echo ' ["kode.im"] = "ihkw7qy3tok45dun.onion";' >> $filename
|
|
563
|
+ echo ' ["im.koderoot.net"] = "ihkw7qy3tok45dun.onion";' >> $filename
|
|
564
|
+ echo ' ["jabber.lqdn.fr"] = "jabber63t4r2qi57.onion";' >> $filename
|
|
565
|
+ echo ' ["jabber.otr.im"] = "5rgdtlawqkcplz75.onion";' >> $filename
|
|
566
|
+ echo ' ["otromundo.cf"] = "arauemwe2utqqzye.onion";' >> $filename
|
|
567
|
+ echo ' ["patchcord.be"] = "xsydhi3dnbjuatpz.onion";' >> $filename
|
|
568
|
+ echo ' ["riseup.net"] = "4cjw6cwpeaeppfqz.onion";' >> $filename
|
|
569
|
+ echo ' ["xmpp.riseup.net"] = "4cjw6cwpeaeppfqz.onion";' >> $filename
|
|
570
|
+ echo ' ["rows.io"] = "yz6yiv2hxyagvwy6.onion";' >> $filename
|
|
571
|
+ echo ' ["xmpp.rows.io"] = "yz6yiv2hxyagvwy6.onion";' >> $filename
|
|
572
|
+ echo ' ["securejabber.me"] = "giyvshdnojeivkom.onion";' >> $filename
|
|
573
|
+ echo ' ["so36.net"] = "s4fgy24e2b5weqdb.onion";' >> $filename
|
|
574
|
+ echo ' ["jabber.so36.net"] = "s4fgy24e2b5weqdb.onion";' >> $filename
|
|
575
|
+ echo ' ["jabber.systemli.org"] = "x5tno6mwkncu5m3h.onion";' >> $filename
|
|
576
|
+ echo ' ["taolo.ga"] = "l3ybpw4vs6ie5rv2.onion";' >> $filename
|
|
577
|
+ echo ' ["tchncs.de"] = "duvfmyqmdlyvc3mi.onion";' >> $filename
|
|
578
|
+ echo ' ["wtfismyip.com"] = "ofkztxcohimx34la.onion";' >> $filename
|
|
579
|
+ echo ' ["prosody.xmpp.is"] = "y2qmqomqpszzryei.onion";' >> $filename
|
|
580
|
+ echo ' ["xndr.de"] = "trcubpttd6zkc3tf.onion";' >> $filename
|
|
581
|
+ echo '};' >> $filename
|
|
582
|
+}
|
|
583
|
+
|
435
|
584
|
function xmpp_create_config {
|
436
|
585
|
echo "admins = { \"$MY_USERNAME@$DEFAULT_DOMAIN_NAME\" }" > /etc/prosody/prosody.cfg.lua
|
437
|
586
|
echo 'plugin_paths = { "/var/lib/prosody/prosody-modules" }' >> /etc/prosody/prosody.cfg.lua
|
438
|
587
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
439
|
588
|
xmpp_modules /etc/prosody/prosody.cfg.lua
|
440
|
589
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
|
590
|
+ xmpp_onion_addresses /etc/prosody/prosody.cfg.lua
|
|
591
|
+ echo '' >> /etc/prosody/prosody.cfg.lua
|
441
|
592
|
echo 'allow_registration = false;' >> /etc/prosody/prosody.cfg.lua
|
442
|
593
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
443
|
594
|
echo 'daemonize = true;' >> /etc/prosody/prosody.cfg.lua
|