--- /dev/null
+server {
+ listen 443 ssl;
+ server_name REPLACE_fqdn_ECALPER;
+ ssl_certificate /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/fullchain.pem;
+ ssl_certificate_key /etc/letsencrypt/live/REPLACE_fqdn_ECALPER/privkey.pem;
+ root /var/www-dump/;
+ index index.html index.htm index.nginx-debian.html;
+
+ location /dump/ {
+ autoindex on;
+ }
+
+ location /geheim/ {
+ auth_basic "geheim geheim";
+ auth_basic_user_file /var/www-dump/password_geheim;
+ autoindex on;
+ }
+}
--- /dev/null
+#!/bin/sh
+set -e
+set -x
+w
+if [ "$#" -ne 2 ]; then
+ echo 'Need domain name and mail.'
+ false
+fi
+domain="$1"
+mail="$2"
+
+# Install configs, set up firewall.
+config_tree_prefix="${HOME}/config/buster"
+./install_for_target.sh web dumpsite
+./copy_dirtree.sh "${config_tree_prefix}/etc_files" "" web dumpsite
+nft -f /etc/nftables.conf
+
+# Set up letsencrypt certificate. TODO: Is it auto-renewed?
+ln -sf /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
+certbot --nginx --agree-tos --redirect --no-eff-email -m "${mail}" -d "${domain}"
+rm /etc/nginx/sites-enabled/default
+
+# Set up dump dirs.
+mkdir /var/www-dump
+chown plom:plom /var/www-dump
+dump_dir=dump
+geheim_dir=geheim
+su -lc "mkdir ${dump_dir} ${geheim_dir}"
+su -lc "ln -s ${dump_dir} /var/www-dump/${dump_dir}" plom
+su -lc "ln -s ${geheim_dir} /var/www-dump/${geheim_dir}" plom
+password_geheim=$(pwgen -1)
+echo "foo:${password_geheim}" > /var/www-dump/password_geheim
+
+# Prepare NGINX.
+sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/dumpsite.nginx
+ln -s /etc/nginx/sites-available/dumpsite.nginx /etc/nginx/sites-enabled/dumpsite.nginx
+
+service nginx restart
#!/bin/sh
set -e
-set -x
-# Heavily inspired by <https://docs-develop.pleroma.social/backend/installation/debian_based_en/>
if [ "$#" -ne 4 ]; then
echo 'Need domain name and mail and old server IP and key ID as argument.'
sed -i "s/REPLACE_fqdn_ECALPER/${domain}/g" /etc/nginx/sites-available/website.nginx
ln -s /etc/nginx/sites-available/website.nginx /etc/nginx/sites-enabled/website.nginx
-# Set up website.
+# Set up website. TODO: use non-/var/www dir for better separation to dump site
rm -rf /var/www
mkdir /var/www
chown plom:plom /var/www