From 7ed2696e697225a1b9374efa55598a8d7fe84934 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 13 Jul 2024 14:24:16 -0300 Subject: Fix: scripts: split between provision and provision-host --- scripts/provision-host | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 scripts/provision-host (limited to 'scripts/provision-host') diff --git a/scripts/provision-host b/scripts/provision-host new file mode 100755 index 0000000..12cbe52 --- /dev/null +++ b/scripts/provision-host @@ -0,0 +1,62 @@ +#!/bin/bash +# +# Provisioner for the hosting environment +# + +# Parameters +DIRNAME="`dirname $0`" + +# Check for sudo +if [ "`whoami`" != "root" ]; then + SUDO="sudo" +fi + +# Install Apache +$SUDO apt install -y apache2 + +# Tor +trashman install tor + +# Configure an onion service +trashman install tor-onion-service + +# Install python dependencies +#pip3 install $DEPENDENCIES_PIP + +# Configure virtual host for the Onion Service +cat <<-EOF | $SUDO tee /etc/apache2/sites-available/onion.conf > /dev/null + + ServerName slides.onion + ServerAlias slides.*.onion + DocumentRoot "/srv/shared/" + + + AuthType Basic + AuthName "Protected" + AuthUserFile /srv/shared/.htpasswd + Require valid-user + + +EOF + +# Configure virtual host for the local service +cat <<-EOF | $SUDO tee /etc/apache2/sites-available/local.conf > /dev/null + + ServerName slides.local + DocumentRoot "/srv/shared/" + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + +EOF + +# Enable virtual host +$SUDO a2ensite onion local +$SUDO systemctl reload apache2 + +# Configure PATH +#mkdir -p ~/.custom +#echo 'export PATH=$PATH:/srv/shared/scripts' > ~/.custom/profile -- cgit v1.2.3