|
|
|
|
202
|
# Domain name for Owncloud installation
|
202
|
# Domain name for Owncloud installation
|
203
|
OWNCLOUD_DOMAIN_NAME=
|
203
|
OWNCLOUD_DOMAIN_NAME=
|
204
|
OWNCLOUD_CODE=
|
204
|
OWNCLOUD_CODE=
|
|
|
205
|
+OWNCLOUD_ONION_PORT=8088
|
205
|
OWNCLOUD_ADMIN_PASSWORD=
|
206
|
OWNCLOUD_ADMIN_PASSWORD=
|
206
|
OWNCLOUD_MUSIC_APP_REPO="https://github.com/owncloud/music"
|
207
|
OWNCLOUD_MUSIC_APP_REPO="https://github.com/owncloud/music"
|
207
|
OWNCLOUD_MUSIC_APP_COMMIT='7f79afb4ae9a6ecd8f530d87106f960306c0a15a'
|
208
|
OWNCLOUD_MUSIC_APP_COMMIT='7f79afb4ae9a6ecd8f530d87106f960306c0a15a'
|
|
|
|
|
5783
|
echo ' access_log off;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
5784
|
echo ' access_log off;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
5784
|
echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
5785
|
echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
5785
|
echo '}' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
5786
|
echo '}' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5787
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5788
|
+ echo 'server {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5789
|
+ echo " listen 127.0.0.1:${OWNCLOUD_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5790
|
+ echo " root /var/www/$OWNCLOUD_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5791
|
+ echo " server_name $OWNCLOUD_DOMAIN_NAME;" >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5792
|
+ echo ' access_log off;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5793
|
+ echo " error_log /var/log/nginx/${OWNCLOUD_DOMAIN_NAME}_error.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5794
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5795
|
+ echo ' limit_conn conn_limit_per_ip 10;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5796
|
+ echo ' limit_req zone=req_limit_per_ip burst=10 nodelay;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5797
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5798
|
+ echo ' add_header X-Frame-Options DENY;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5799
|
+ echo ' add_header X-Content-Type-Options nosniff;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5800
|
+ echo ' add_header Strict-Transport-Security max-age=15768000;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5801
|
+ echo ' # if you want to be able to access the site via HTTP' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5802
|
+ echo ' # then replace the above with the following:' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5803
|
+ echo ' # add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5804
|
+ echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5805
|
+ echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5806
|
+ echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5807
|
+ echo ' allow all;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5808
|
+ echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5809
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5810
|
+ echo ' client_max_body_size 10G; # set max upload size' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5811
|
+ echo ' client_body_buffer_size 128k;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5812
|
+ echo ' fastcgi_buffers 64 4K;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5813
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5814
|
+ echo ' rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5815
|
+ echo ' rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5816
|
+ echo ' rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5817
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5818
|
+ echo ' index index.php;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5819
|
+ echo ' error_page 403 /core/templates/403.php;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5820
|
+ echo ' error_page 404 /core/templates/404.php;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5821
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5822
|
+ echo ' location = /robots.txt {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5823
|
+ echo ' allow all;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5824
|
+ echo ' log_not_found off;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5825
|
+ echo ' access_log off;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5826
|
+ echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5827
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5828
|
+ echo ' location ~ ^/(data|config|\.ht|db_structure\.xml|README) {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5829
|
+ echo ' deny all;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5830
|
+ echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5831
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5832
|
+ echo ' location / {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5833
|
+ echo ' # The following 2 rules are only needed with webfinger' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5834
|
+ echo ' rewrite ^/.well-known/host-meta /public.php?service=host-meta last;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5835
|
+ echo ' rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5836
|
+ echo ' rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5837
|
+ echo ' rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5838
|
+ echo ' rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5839
|
+ echo ' try_files $uri $uri/ index.php;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5840
|
+ echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5841
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5842
|
+ echo ' location ~ ^(.+?\.php)(/.*)?$ {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5843
|
+ echo ' try_files $1 =404;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5844
|
+ echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5845
|
+ echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5846
|
+ echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5847
|
+ echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5848
|
+ echo ' fastcgi_param SCRIPT_FILENAME $document_root$1;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5849
|
+ echo ' fastcgi_param PATH_INFO $2;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5850
|
+ echo ' fastcgi_param HTTPS on;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5851
|
+ echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5852
|
+ echo '' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5853
|
+ echo ' # Optional: set long EXPIRES header on static assets' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5854
|
+ echo ' location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5855
|
+ echo ' expires 30d;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5856
|
+ echo " # Optional: Don't log access to assets" >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5857
|
+ echo ' access_log off;' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5858
|
+ echo ' }' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
|
|
5859
|
+ echo '}' >> /etc/nginx/sites-available/$OWNCLOUD_DOMAIN_NAME
|
5786
|
|
5860
|
|
5787
|
configure_php
|
5861
|
configure_php
|
5788
|
|
5862
|
|
|
|
|
|
5826
|
echo 'fi' >> /usr/bin/backupdatabases
|
5900
|
echo 'fi' >> /usr/bin/backupdatabases
|
5827
|
|
5901
|
|
5828
|
nginx_ensite $OWNCLOUD_DOMAIN_NAME
|
5902
|
nginx_ensite $OWNCLOUD_DOMAIN_NAME
|
|
|
5903
|
+
|
|
|
5904
|
+ if [ ! -d /var/lib/tor ]; then
|
|
|
5905
|
+ echo $'No Tor installation found. Owncloud onion site cannot be configured.'
|
|
|
5906
|
+ exit 877367
|
|
|
5907
|
+ fi
|
|
|
5908
|
+ if ! grep -q "hidden_service_owncloud" /etc/tor/torrc; then
|
|
|
5909
|
+ echo 'HiddenServiceDir /var/lib/tor/hidden_service_owncloud/' >> /etc/tor/torrc
|
|
|
5910
|
+ echo "HiddenServicePort 80 127.0.0.1:${OWNCLOUD_ONION_PORT}" >> /etc/tor/torrc
|
|
|
5911
|
+ echo $'Added onion site for Owncloud'
|
|
|
5912
|
+ fi
|
|
|
5913
|
+
|
5829
|
service php5-fpm restart
|
5914
|
service php5-fpm restart
|
5830
|
service nginx restart
|
5915
|
service nginx restart
|
|
|
5916
|
+ systemctl restart tor
|
|
|
5917
|
+
|
|
|
5918
|
+ if [ ! -f /var/lib/tor/hidden_service_owncloud/hostname ]; then
|
|
|
5919
|
+ echo $'Owncloud onion site hostname not found'
|
|
|
5920
|
+ exit 76362
|
|
|
5921
|
+ fi
|
|
|
5922
|
+ OWNCLOUD_ONION_HOSTNAME=$(cat /var/lib/tor/hidden_service_owncloud/hostname)
|
|
|
5923
|
+
|
|
|
5924
|
+ if ! grep -q "Owncloud onion domain" /home/$MY_USERNAME/README; then
|
|
|
5925
|
+ echo "Owncloud onion domain: ${OWNCLOUD_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
|
|
|
5926
|
+ echo '' >> /home/$MY_USERNAME/README
|
|
|
5927
|
+ chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
|
|
|
5928
|
+ chmod 600 /home/$MY_USERNAME/README
|
|
|
5929
|
+ fi
|
|
|
5930
|
+ echo "Owncloud onion domain:${OWNCLOUD_ONION_HOSTNAME}" >> $COMPLETION_FILE
|
5831
|
|
5931
|
|
5832
|
# update the dynamic DNS
|
5932
|
# update the dynamic DNS
|
5833
|
CURRENT_DDNS_DOMAIN=$OWNCLOUD_DOMAIN_NAME
|
5933
|
CURRENT_DDNS_DOMAIN=$OWNCLOUD_DOMAIN_NAME
|
|
|
|
|
7558
|
echo $'Added onion site for GNU Social'
|
7658
|
echo $'Added onion site for GNU Social'
|
7559
|
fi
|
7659
|
fi
|
7560
|
|
7660
|
|
7561
|
- service php5-fpm restart
|
|
|
7562
|
- service nginx restart
|
|
|
|
|
7661
|
+ systemctl restart php5-fpm
|
|
|
7662
|
+ systemctl restart nginx
|
7563
|
systemctl restart tor
|
7663
|
systemctl restart tor
|
7564
|
|
7664
|
|
7565
|
if [ ! -f /var/lib/tor/hidden_service_microblog/hostname ]; then
|
7665
|
if [ ! -f /var/lib/tor/hidden_service_microblog/hostname ]; then
|