diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-07-12 15:57:49 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-07-12 15:57:49 -0300 |
commit | ad38f611a620ad96c12dc0d83ba5b28759a07da5 (patch) | |
tree | d72a3a9d32e52d1c9d424abb5d989c3fce85b3cf | |
parent | ce9bf77f19c3bd820bec1919f0a3346b8627b66a (diff) | |
download | templates-ad38f611a620ad96c12dc0d83ba5b28759a07da5.tar.gz templates-ad38f611a620ad96c12dc0d83ba5b28759a07da5.tar.bz2 |
Feat: scripts: split between provision and provision-host
-rw-r--r-- | kvmxfile | 4 | ||||
-rwxr-xr-x | scripts/provision | 41 | ||||
-rwxr-xr-x | scripts/provision-host | 45 |
3 files changed, 48 insertions, 42 deletions
@@ -13,7 +13,9 @@ shared_folders="shared:.:/srv/shared" # Absolute path for a provision script located inside the guest. # Needs ssh_support set to "y" and a workable SSH connection to the guest. -provision_command="/usr/local/share/kvmx/provision/debian/development && /srv/shared/scripts/provision" +provision_command="/usr/local/share/kvmx/provision/debian/development" +provision_command="$provision_command && /srv/shared/scripts/provision" +provision_command="$provision_command && /srv/shared/scripts/provision-host" # Startup command startup_command="hydractl aperiodic-upgrade" diff --git a/scripts/provision b/scripts/provision index 0b4418f..bdc248e 100755 --- a/scripts/provision +++ b/scripts/provision @@ -23,44 +23,3 @@ sudo apt install -y $DEPENDENCIES # Install python dependencies pip3 install --break-system-packages $DEPENDENCIES_PIP - -# Configure an onion service -trashman install tor-onion-service - -# Configure virtual host for the Onion Service -cat <<-EOF | sudo tee /etc/apache2/sites-available/onion.conf > /dev/null -<VirtualHost *:80> - ServerName localhost - ServerAlias *.onion - DocumentRoot "/srv/shared/site" - - <Directory /srv/shared/site> - AuthType Basic - AuthName "Protected" - AuthUserFile /srv/shared/.htpasswd - Require valid-user - </Directory> -</VirtualHost> -EOF - -# Configure virtual host for the local service -cat <<-EOF | sudo tee /etc/apache2/sites-available/local.conf > /dev/null -<VirtualHost *:80> - ServerName protocolos.local - DocumentRoot "/srv/shared/site" - - <Directory /srv/shared/site> - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - </Directory> -</VirtualHost> -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 diff --git a/scripts/provision-host b/scripts/provision-host new file mode 100755 index 0000000..d8fccb2 --- /dev/null +++ b/scripts/provision-host @@ -0,0 +1,45 @@ +#!/bin/bash +# +# Provisioner +# + +# Configure an onion service +trashman install tor-onion-service + +# Configure virtual host for the Onion Service +cat <<-EOF | sudo tee /etc/apache2/sites-available/onion.conf > /dev/null +<VirtualHost *:80> + ServerName localhost + ServerAlias *.onion + DocumentRoot "/srv/shared/site" + + <Directory /srv/shared/site> + AuthType Basic + AuthName "Protected" + AuthUserFile /srv/shared/.htpasswd + Require valid-user + </Directory> +</VirtualHost> +EOF + +# Configure virtual host for the local service +cat <<-EOF | sudo tee /etc/apache2/sites-available/local.conf > /dev/null +<VirtualHost *:80> + ServerName protocolos.local + DocumentRoot "/srv/shared/site" + + <Directory /srv/shared/site> + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + </Directory> +</VirtualHost> +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 |