+#!/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