|
@@ -127,68 +127,75 @@ function reconfigure_xmpp {
|
127
|
127
|
}
|
128
|
128
|
|
129
|
129
|
function update_prosody_modules {
|
130
|
|
- if [ ! -d $INSTALL_DIR/prosody-modules ]; then
|
|
130
|
+ if [ ! -d /var/lib/prosody/prosody-modules ]; then
|
131
|
131
|
return
|
132
|
132
|
fi
|
133
|
133
|
if [ ! -d /usr/lib/prosody ]; then
|
134
|
134
|
return
|
135
|
135
|
fi
|
136
|
136
|
|
137
|
|
- cd $INSTALL_DIR/prosody-modules
|
|
137
|
+ cd /var/lib/prosody/prosody-modules
|
138
|
138
|
hg pull
|
139
|
139
|
hg update
|
140
|
140
|
|
141
|
141
|
# support onion addresses
|
142
|
|
- if [ -f $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua ]; then
|
143
|
|
- cp $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua /usr/lib/prosody/modules/mod_onions.lua
|
144
|
|
- fi
|
|
142
|
+ #if [ -f $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua ]; then
|
|
143
|
+ # cp $INSTALL_DIR/prosody-modules/mod_onions/mod_onions.lua /usr/lib/prosody/modules/mod_onions.lua
|
|
144
|
+ #fi
|
145
|
145
|
|
146
|
146
|
# XEP-0313 message archive management
|
147
|
147
|
# https://modules.prosody.im/mod_mam.html
|
148
|
148
|
# Allows you to download your previous messages onto a new client
|
149
|
149
|
# This only applies if you are not using forward secret crypto
|
150
|
150
|
# such as OTR or OMEMO (eg. OpenPGP)
|
151
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_mam ]; then
|
152
|
|
- cp $INSTALL_DIR/prosody-modules/mod_mam/*.lua /usr/lib/prosody/modules
|
153
|
|
- fi
|
|
151
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_mam ]; then
|
|
152
|
+ # cp $INSTALL_DIR/prosody-modules/mod_mam/*.lua /usr/lib/prosody/modules
|
|
153
|
+ #fi
|
154
|
154
|
|
155
|
155
|
# XEP-0352 Client State Indication
|
156
|
156
|
# Notifies the server if the app is in the background or not
|
157
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_csi ]; then
|
158
|
|
- cp $INSTALL_DIR/prosody-modules/mod_csi/*.lua /usr/lib/prosody/modules
|
159
|
|
- fi
|
|
157
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_csi ]; then
|
|
158
|
+ # cp $INSTALL_DIR/prosody-modules/mod_csi/*.lua /usr/lib/prosody/modules
|
|
159
|
+ #fi
|
160
|
160
|
|
161
|
161
|
# XEP-0280 Message Carbons
|
162
|
162
|
# Ensures all messages get delivered to all clients (if you have a mobile and desktop client)
|
163
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_carbons ]; then
|
164
|
|
- cp $INSTALL_DIR/prosody-modules/mod_carbons/*.lua /usr/lib/prosody/modules
|
165
|
|
- cp $INSTALL_DIR/prosody-modules/mod_carbons_adhoc/*.lua /usr/lib/prosody/modules
|
166
|
|
- cp $INSTALL_DIR/prosody-modules/mod_carbons_copies/*.lua /usr/lib/prosody/modules
|
167
|
|
- fi
|
|
163
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_carbons ]; then
|
|
164
|
+ # cp $INSTALL_DIR/prosody-modules/mod_carbons/*.lua /usr/lib/prosody/modules
|
|
165
|
+ # cp $INSTALL_DIR/prosody-modules/mod_carbons_adhoc/*.lua /usr/lib/prosody/modules
|
|
166
|
+ # cp $INSTALL_DIR/prosody-modules/mod_carbons_copies/*.lua /usr/lib/prosody/modules
|
|
167
|
+ #fi
|
168
|
168
|
|
169
|
169
|
# XEP-0198 Stream management
|
170
|
170
|
# Helps mobile apps recover when a device switches networks.
|
171
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_smacks ]; then
|
172
|
|
- cp $INSTALL_DIR/prosody-modules/mod_smacks/*.lua /usr/lib/prosody/modules
|
173
|
|
- fi
|
174
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_smacks_offline ]; then
|
175
|
|
- cp $INSTALL_DIR/prosody-modules/mod_smacks_offline/*.lua /usr/lib/prosody/modules
|
176
|
|
- fi
|
|
171
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_smacks ]; then
|
|
172
|
+ # cp $INSTALL_DIR/prosody-modules/mod_smacks/*.lua /usr/lib/prosody/modules
|
|
173
|
+ #fi
|
|
174
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_smacks_offline ]; then
|
|
175
|
+ # cp $INSTALL_DIR/prosody-modules/mod_smacks_offline/*.lua /usr/lib/prosody/modules
|
|
176
|
+ #fi
|
177
|
177
|
|
178
|
178
|
# XEP-0191: blocking
|
179
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_blocking ]; then
|
180
|
|
- cp $INSTALL_DIR/prosody-modules/mod_blocking/*.lua /usr/lib/prosody/modules
|
181
|
|
- fi
|
|
179
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_blocking ]; then
|
|
180
|
+ # cp $INSTALL_DIR/prosody-modules/mod_blocking/*.lua /usr/lib/prosody/modules
|
|
181
|
+ #fi
|
182
|
182
|
|
183
|
183
|
# XEP-0016 Privacy lists
|
184
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_privacy_lists ]; then
|
185
|
|
- cp $INSTALL_DIR/prosody-modules/mod_privacy_lists/*.lua /usr/lib/prosody/modules
|
186
|
|
- fi
|
|
184
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_privacy_lists ]; then
|
|
185
|
+ # cp $INSTALL_DIR/prosody-modules/mod_privacy_lists/*.lua /usr/lib/prosody/modules
|
|
186
|
+ #fi
|
187
|
187
|
|
188
|
188
|
# If offline then send messages to email
|
189
|
|
- if [ -d $INSTALL_DIR/prosody-modules/mod_offline_email ]; then
|
190
|
|
- cp $INSTALL_DIR/prosody-modules/mod_offline_email/*.lua /usr/lib/prosody/modules
|
191
|
|
- fi
|
|
189
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_offline_email ]; then
|
|
190
|
+ # cp $INSTALL_DIR/prosody-modules/mod_offline_email/*.lua /usr/lib/prosody/modules
|
|
191
|
+ #fi
|
|
192
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_pep_vcard_avatar ]; then
|
|
193
|
+ # cp $INSTALL_DIR/prosody-modules/mod_pep_vcard_avatar/*.lua /usr/lib/prosody/modules
|
|
194
|
+ #fi
|
|
195
|
+
|
|
196
|
+ #if [ -d $INSTALL_DIR/prosody-modules/mod_blocking ]; then
|
|
197
|
+ # cp $INSTALL_DIR/prosody-modules/mod_blocking/*.lua /usr/lib/prosody/modules
|
|
198
|
+ #fi
|
192
|
199
|
}
|
193
|
200
|
|
194
|
201
|
function upgrade_xmpp {
|
|
@@ -291,9 +298,6 @@ function remove_xmpp {
|
291
|
298
|
remove_onion_service xmpp 5222 5223 5269
|
292
|
299
|
|
293
|
300
|
apt-get -yq remove --purge prosody prosody-modules
|
294
|
|
- if [ -d $INSTALL_DIR/prosody-modules ]; then
|
295
|
|
- rm -rf $INSTALL_DIR/prosody-modules
|
296
|
|
- fi
|
297
|
301
|
if [ -d /etc/prosody ]; then
|
298
|
302
|
rm -rf /etc/prosody
|
299
|
303
|
fi
|
|
@@ -340,20 +344,27 @@ function xmpp_modules {
|
340
|
344
|
echo ' "mam"; -- Message archive management' >> $filename
|
341
|
345
|
echo ' "csi"; -- Client state indication' >> $filename
|
342
|
346
|
echo ' "carbons"; -- Message carbons' >> $filename
|
|
347
|
+ echo ' "carbons_adhoc"; -- Message carbons' >> $filename
|
|
348
|
+ echo ' "carbons_copies"; -- Message carbons' >> $filename
|
343
|
349
|
echo ' "smacks"; -- Stream management' >> $filename
|
344
|
350
|
echo ' "smacks_offline"; -- Stream management' >> $filename
|
345
|
351
|
echo ' "pep"; -- Personal Eventing Protocol (to support OMEMO)' >> $filename
|
|
352
|
+ echo ' "pep_vcard_avatar"; -- Personal Eventing Protocol (to support OMEMO)' >> $filename
|
346
|
353
|
echo ' "privacy"; -- Privacy lists' >> $filename
|
347
|
354
|
echo ' "privacy_lists"; -- Privacy lists' >> $filename
|
348
|
355
|
echo ' "blocking"; -- Blocking command' >> $filename
|
349
|
356
|
echo ' "roster"; -- Roster versioning' >> $filename
|
350
|
357
|
echo ' "offline_email"; -- If offline send to email' >> $filename
|
351
|
358
|
echo ' "offline"; -- Store offline messages' >> $filename
|
|
359
|
+ echo ' "http";' >> $filename
|
|
360
|
+ echo ' "http_upload";' >> $filename
|
|
361
|
+ echo ' "websocket";' >> $filename
|
352
|
362
|
echo '};' >> $filename
|
353
|
363
|
}
|
354
|
364
|
|
355
|
365
|
function xmpp_create_config {
|
356
|
366
|
echo "admins = { \"$MY_USERNAME@$DEFAULT_DOMAIN_NAME\" }" > /etc/prosody/prosody.cfg.lua
|
|
367
|
+ echo 'plugin_paths = { "/var/lib/prosody/prosody-modules" }' >> /etc/prosody/prosody.cfg.lua
|
357
|
368
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
358
|
369
|
xmpp_modules /etc/prosody/prosody.cfg.lua
|
359
|
370
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
|
@@ -363,6 +374,13 @@ function xmpp_create_config {
|
363
|
374
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
364
|
375
|
echo 'pidfile = "/var/run/prosody/prosody.pid";' >> /etc/prosody/prosody.cfg.lua
|
365
|
376
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
|
377
|
+ echo 'https_ports = { 5281 }' >> /etc/prosody/prosody.cfg.lua
|
|
378
|
+ echo ' https_interfaces = { "*" }' >> /etc/prosody/prosody.cfg.lua
|
|
379
|
+ echo 'https_ssl = {' >> /etc/prosody/prosody.cfg.lua
|
|
380
|
+ echo " certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
|
|
381
|
+ echo " key = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.key\";" >> /etc/prosody/prosody.cfg.lua
|
|
382
|
+ echo "}" >> /etc/prosody/prosody.cfg.lua
|
|
383
|
+ echo '' >> /etc/prosody/prosody.cfg.lua
|
366
|
384
|
echo 'ssl = {' >> /etc/prosody/prosody.cfg.lua
|
367
|
385
|
echo " key = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.key\";" >> /etc/prosody/prosody.cfg.lua
|
368
|
386
|
echo " certificate = \"/etc/prosody/certs/${DEFAULT_DOMAIN_NAME}.pem\";" >> /etc/prosody/prosody.cfg.lua
|
|
@@ -398,6 +416,8 @@ function xmpp_create_config {
|
398
|
416
|
echo ' }' >> /etc/prosody/prosody.cfg.lua
|
399
|
417
|
echo '' >> /etc/prosody/prosody.cfg.lua
|
400
|
418
|
echo 'Include "conf.d/*.cfg.lua"' >> /etc/prosody/prosody.cfg.lua
|
|
419
|
+ echo 'http_upload_path = "/var/lib/prosody/http_uploads"' >> /etc/prosody/prosody.cfg.lua
|
|
420
|
+ echo 'http_upload_file_size_limit = 50000000' >> /etc/prosody/prosody.cfg.lua
|
401
|
421
|
}
|
402
|
422
|
|
403
|
423
|
function install_xmpp_main {
|
|
@@ -415,8 +435,10 @@ function install_xmpp_main {
|
415
|
435
|
fi
|
416
|
436
|
fi
|
417
|
437
|
|
418
|
|
- apt-get -yq install lua-sec lua-bitop
|
419
|
|
- apt-get -yq install prosody prosody-modules mercurial
|
|
438
|
+ apt-get -yq install lua-sec lua-bitop lua5.1 liblua5.1-dev
|
|
439
|
+ apt-get -yq install libidn11-dev libssl-dev lua-dbi-sqlite3
|
|
440
|
+ apt-get -yq mercurial
|
|
441
|
+ apt-get -yq install prosody prosody-modules
|
420
|
442
|
|
421
|
443
|
if [ ! -d /etc/prosody ]; then
|
422
|
444
|
echo $"ERROR: prosody does not appear to have installed. $CHECK_MESSAGE"
|
|
@@ -425,30 +447,28 @@ function install_xmpp_main {
|
425
|
447
|
|
426
|
448
|
groupadd prosody
|
427
|
449
|
|
428
|
|
- if [ ! -d /var/lib/prosody ]; then
|
429
|
|
- mkdir /var/lib/prosody
|
|
450
|
+ if [ ! -d /var/lib/prosody/http_uploads ]; then
|
|
451
|
+ mkdir -p /var/lib/prosody/http_uploads
|
430
|
452
|
fi
|
431
|
453
|
if [ ! -d /etc/prosody/conf.d ]; then
|
432
|
454
|
mkdir /etc/prosody/conf.d
|
433
|
455
|
fi
|
434
|
|
- chmod -R 700 /etc/prosody/conf.d
|
435
|
|
- chown -R prosody /var/lib/prosody
|
436
|
|
- chown -R prosody /etc/prosody/conf.d
|
437
|
456
|
|
438
|
457
|
# obtain the prosody modules
|
439
|
|
- cd $INSTALL_DIR
|
440
|
|
- hg clone https://hg.prosody.im/prosody-modules/ prosody-modules
|
441
|
|
- if [ ! -d $INSTALL_DIR/prosody-modules/mod_onions ]; then
|
|
458
|
+ if [ ! -d /var/lib/prosody/prosody-modules ]; then
|
|
459
|
+ hg clone https://hg.prosody.im/prosody-modules/ /var/lib/prosody/prosody-modules
|
|
460
|
+ fi
|
|
461
|
+ if [ ! -d /var/lib/prosody/prosody-modules/mod_onions ]; then
|
442
|
462
|
echo $'mod_onions prosody module could not be found'
|
443
|
463
|
exit 73254
|
444
|
464
|
fi
|
445
|
465
|
|
|
466
|
+ chmod -R 700 /etc/prosody/conf.d
|
|
467
|
+ chown -R prosody /var/lib/prosody
|
|
468
|
+ chown -R prosody /etc/prosody/conf.d
|
|
469
|
+
|
446
|
470
|
# install the onions module
|
447
|
471
|
update_prosody_modules
|
448
|
|
- if [ ! -f /usr/lib/prosody/modules/mod_onions.lua ]; then
|
449
|
|
- echo $'mod_onions.lua could not be copied to the prosody modules directory'
|
450
|
|
- exit 63952
|
451
|
|
- fi
|
452
|
472
|
|
453
|
473
|
# create a certificate
|
454
|
474
|
if [[ "$(cert_exists ${DEFAULT_DOMAIN_NAME} pem)" == "0" ]]; then
|