|
@@ -35,8 +35,13 @@ IN_DEFAULT_INSTALL=0
|
35
|
35
|
SHOW_ON_ABOUT=0
|
36
|
36
|
SHOW_ICANN_ADDRESS_ON_ABOUT=0
|
37
|
37
|
|
|
38
|
+SCUTTLEBOT_DOMAIN_NAME=
|
|
39
|
+SCUTTLEBOT_CODE=
|
38
|
40
|
SCUTTLEBOT_VERSION='10.4.6'
|
39
|
41
|
SCUTTLEBOT_PORT=8010
|
|
42
|
+SCUTTLEBOT_ONION_PORT=8623
|
|
43
|
+GIT_SSB_PORT=7718
|
|
44
|
+NGINX_GIT_SSB_PORT=7719
|
40
|
45
|
|
41
|
46
|
scuttlebot_variables=(MY_USERNAME
|
42
|
47
|
DEFAULT_DOMAIN_NAME
|
|
@@ -91,7 +96,13 @@ function add_user_scuttlebot {
|
91
|
96
|
}
|
92
|
97
|
|
93
|
98
|
function install_interactive_scuttlebot {
|
94
|
|
- echo -n ''
|
|
99
|
+ if [[ $ONION_ONLY != "no" ]]; then
|
|
100
|
+ SCUTTLEBOT_DOMAIN_NAME='scuttlebot.local'
|
|
101
|
+ write_config_param "SCUTTLEBOT_DOMAIN_NAME" "$SCUTTLEBOT_DOMAIN_NAME"
|
|
102
|
+ else
|
|
103
|
+ function_check interactive_site_details
|
|
104
|
+ interactive_site_details scuttlebot
|
|
105
|
+ fi
|
95
|
106
|
APP_INSTALLED=1
|
96
|
107
|
}
|
97
|
108
|
|
|
@@ -180,6 +191,10 @@ function restore_remote_scuttlebot {
|
180
|
191
|
|
181
|
192
|
function remove_scuttlebot {
|
182
|
193
|
firewall_remove ${SCUTTLEBOT_PORT}
|
|
194
|
+ firewall_remove ${GIT_SSB_PORT}
|
|
195
|
+
|
|
196
|
+ nginx_dissite ${SCUTTLEBOT_DOMAIN_NAME}
|
|
197
|
+ rm /etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME}
|
183
|
198
|
|
184
|
199
|
systemctl stop scuttlebot
|
185
|
200
|
systemctl disable scuttlebot
|
|
@@ -196,7 +211,81 @@ function remove_scuttlebot {
|
196
|
211
|
sed -i '/scuttlebot /d' $COMPLETION_FILE
|
197
|
212
|
}
|
198
|
213
|
|
|
214
|
+function scuttlebot_git_setup {
|
|
215
|
+ if [[ "$1" == "mesh" ]]; then
|
|
216
|
+ git_ssb_nginx_site=$rootdir/etc/nginx/sites-available/git_ssb
|
|
217
|
+ echo 'server {' > $git_ssb_nginx_site
|
|
218
|
+ echo " listen $NGINX_GIT_SSB_PORT default_server;" >> $git_ssb_nginx_site
|
|
219
|
+ echo " server_name P${PEER_ID}.local;" >> $git_ssb_nginx_site
|
|
220
|
+ echo '' >> $git_ssb_nginx_site
|
|
221
|
+ echo ' access_log /dev/null;' >> $git_ssb_nginx_site
|
|
222
|
+ echo ' error_log /dev/null;' >> $git_ssb_nginx_site
|
|
223
|
+ echo '' >> $git_ssb_nginx_site
|
|
224
|
+ echo ' add_header X-XSS-Protection "1; mode=block";' >> $git_ssb_nginx_site
|
|
225
|
+ echo ' add_header X-Content-Type-Options nosniff;' >> $git_ssb_nginx_site
|
|
226
|
+ echo ' add_header X-Frame-Options SAMEORIGIN;' >> $git_ssb_nginx_site
|
|
227
|
+ else
|
|
228
|
+ git_ssb_nginx_site=/etc/nginx/sites-available/${SCUTTLEBOT_DOMAIN_NAME}
|
|
229
|
+ function_check nginx_http_redirect
|
|
230
|
+ nginx_http_redirect $SCUTTLEBOT_DOMAIN_NAME "index index.html"
|
|
231
|
+ echo 'server {' >> $git_ssb_nginx_site
|
|
232
|
+ echo ' listen 443 ssl;' >> $git_ssb_nginx_site
|
|
233
|
+ echo ' listen [::]:443 ssl;' >> $git_ssb_nginx_site
|
|
234
|
+ echo " server_name $SCUTTLEBOT_DOMAIN_NAME;" >> $git_ssb_nginx_site
|
|
235
|
+ echo '' >> $git_ssb_nginx_site
|
|
236
|
+ function_check nginx_compress
|
|
237
|
+ nginx_compress $SCUTTLEBOT_DOMAIN_NAME
|
|
238
|
+ echo '' >> $git_ssb_nginx_site
|
|
239
|
+ echo ' # Security' >> $git_ssb_nginx_site
|
|
240
|
+ function_check nginx_ssl
|
|
241
|
+ nginx_ssl $SCUTTLEBOT_DOMAIN_NAME
|
|
242
|
+
|
|
243
|
+ function_check nginx_disable_sniffing
|
|
244
|
+ nginx_disable_sniffing $SCUTTLEBOT_DOMAIN_NAME
|
|
245
|
+ fi
|
|
246
|
+
|
|
247
|
+ echo '' >> $git_ssb_nginx_site
|
|
248
|
+ echo ' location = / {' >> $git_ssb_nginx_site
|
|
249
|
+ echo " proxy_pass http://localhost:${GIT_SSB_PORT};" >> $git_ssb_nginx_site
|
|
250
|
+ echo ' proxy_set_header X-Real-IP $remote_addr;' >> $git_ssb_nginx_site
|
|
251
|
+ echo ' proxy_set_header Host $host;' >> $git_ssb_nginx_site
|
|
252
|
+ echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $git_ssb_nginx_site
|
|
253
|
+ echo ' proxy_http_version 1.1;' >> $git_ssb_nginx_site
|
|
254
|
+ echo ' proxy_set_header Upgrade $http_upgrade;' >> $git_ssb_nginx_site
|
|
255
|
+ echo ' proxy_set_header Connection upgrade;' >> $git_ssb_nginx_site
|
|
256
|
+ echo ' }' >> $git_ssb_nginx_site
|
|
257
|
+ echo '}' >> $git_ssb_nginx_site
|
|
258
|
+
|
|
259
|
+ if [ $SCUTTLEBOT_ONION_HOSTNAME ]; then
|
|
260
|
+ echo '' >> $git_ssb_nginx_site
|
|
261
|
+ echo 'server {' >> $git_ssb_nginx_site
|
|
262
|
+ echo " listen 127.0.0.1:${SCUTTLEBOT_ONION_PORT} default_server;" >> $git_ssb_nginx_site
|
|
263
|
+ echo " server_name ${SCUTTLEBOT_ONION_HOSTNAME};" >> $git_ssb_nginx_site
|
|
264
|
+ echo '' >> $git_ssb_nginx_site
|
|
265
|
+ echo ' access_log /dev/null;' >> $git_ssb_nginx_site
|
|
266
|
+ echo ' error_log /dev/null;' >> $git_ssb_nginx_site
|
|
267
|
+ echo '' >> $git_ssb_nginx_site
|
|
268
|
+ echo ' add_header X-XSS-Protection "1; mode=block";' >> $git_ssb_nginx_site
|
|
269
|
+ echo ' add_header X-Content-Type-Options nosniff;' >> $git_ssb_nginx_site
|
|
270
|
+ echo ' add_header X-Frame-Options SAMEORIGIN;' >> $git_ssb_nginx_site
|
|
271
|
+ echo '' >> $git_ssb_nginx_site
|
|
272
|
+ echo ' location = / {' >> $git_ssb_nginx_site
|
|
273
|
+ echo " proxy_pass http://localhost:${GIT_SSB_PORT};" >> $git_ssb_nginx_site
|
|
274
|
+ echo ' proxy_set_header X-Real-IP $remote_addr;' >> $git_ssb_nginx_site
|
|
275
|
+ echo ' proxy_set_header Host $host;' >> $git_ssb_nginx_site
|
|
276
|
+ echo ' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' >> $git_ssb_nginx_site
|
|
277
|
+ echo ' proxy_http_version 1.1;' >> $git_ssb_nginx_site
|
|
278
|
+ echo ' proxy_set_header Upgrade $http_upgrade;' >> $git_ssb_nginx_site
|
|
279
|
+ echo ' proxy_set_header Connection upgrade;' >> $git_ssb_nginx_site
|
|
280
|
+ echo ' }' >> $git_ssb_nginx_site
|
|
281
|
+ echo '}' >> $git_ssb_nginx_site
|
|
282
|
+ fi
|
|
283
|
+ nginx_ensite git_ssb
|
|
284
|
+}
|
|
285
|
+
|
199
|
286
|
function mesh_install_scuttlebot {
|
|
287
|
+ SCUTTLEBOT_ONION_HOSTNAME=
|
|
288
|
+
|
200
|
289
|
get_npm_arch
|
201
|
290
|
|
202
|
291
|
cat <<EOF > $rootdir/usr/bin/install_scuttlebot
|
|
@@ -238,6 +327,8 @@ EOF
|
238
|
327
|
echo '' >> $rootdir/etc/systemd/system/scuttlebot.service
|
239
|
328
|
echo '[Install]' >> $rootdir/etc/systemd/system/scuttlebot.service
|
240
|
329
|
echo 'WantedBy=multi-user.target' >> $rootdir/etc/systemd/system/scuttlebot.service
|
|
330
|
+
|
|
331
|
+ scuttlebot_git_setup mesh
|
241
|
332
|
}
|
242
|
333
|
|
243
|
334
|
function install_scuttlebot {
|
|
@@ -316,6 +407,12 @@ function install_scuttlebot {
|
316
|
407
|
systemctl restart scuttlebot.service
|
317
|
408
|
|
318
|
409
|
firewall_add scuttlebot ${SCUTTLEBOT_PORT}
|
|
410
|
+ firewall_add git_ssb ${GIT_SSB_PORT}
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+ SCUTTLEBOT_ONION_HOSTNAME=$(add_onion_service scuttlebot 80 ${SCUTTLEBOT_ONION_PORT})
|
|
414
|
+ scuttlebot_git_setup
|
|
415
|
+ systemctl restart nginx
|
319
|
416
|
|
320
|
417
|
if ! grep -q "scuttlebot version:" ${COMPLETION_FILE}; then
|
321
|
418
|
echo "scuttlebot version:${SCUTTLEBOT_VERSION}" >> ${COMPLETION_FILE}
|