2022-04-20 00:29:47 +02:00
|
|
|
#!/usr/bin/bash
|
2022-05-03 15:41:14 +02:00
|
|
|
source /etc/os-release
|
2022-04-20 00:29:47 +02:00
|
|
|
|
2022-05-05 02:03:01 +02:00
|
|
|
# Clear configuration (will be filled with mkosi.extra/)
|
2022-04-20 00:29:47 +02:00
|
|
|
rm -r /etc/nginx/*
|
|
|
|
rm -r /etc/ssh/*
|
2022-05-05 02:03:01 +02:00
|
|
|
rm /etc/tor/torrc
|
2022-04-20 00:29:47 +02:00
|
|
|
if [[ $ID = "debian" ]]; then
|
2022-05-09 02:39:53 +02:00
|
|
|
rm -r /etc/php/8.1/fpm/pool.d
|
|
|
|
rm /usr/lib/tmpfiles.d/php8.1-fpm.conf
|
2022-05-03 15:41:14 +02:00
|
|
|
fi
|
|
|
|
if [[ $ID = "arch" ]]; then
|
|
|
|
rm /etc/php/php-fpm.d/*
|
2022-04-20 00:29:47 +02:00
|
|
|
fi
|
|
|
|
|
2022-05-05 02:03:01 +02:00
|
|
|
# Create dedicated Tor instance
|
|
|
|
if [[ $ID = "debian" ]]; then
|
|
|
|
tor-instance-create niver
|
|
|
|
fi
|
|
|
|
|
2022-04-20 00:29:47 +02:00
|
|
|
# Generate default self-signed TLS key pair
|
|
|
|
openssl req -subj '/' -new -newkey RSA:3072 -days 3650 -nodes -x509 -keyout /etc/ssl/private/niver.key -out /etc/ssl/certs/niver.crt
|
|
|
|
|
2022-05-08 21:44:06 +02:00
|
|
|
# Generate OpenSSH server key pair
|
2022-04-20 00:29:47 +02:00
|
|
|
ssh-keygen -f /etc/ssh/ed25519 -t ed25519 -N ""
|
|
|
|
ssh-keygen -lvf /etc/ssh/ed25519 > /etc/ssh/ed25519.fp
|
2022-05-08 21:44:06 +02:00
|
|
|
|
|
|
|
# Generate SFTPGo key pair
|
|
|
|
ssh-keygen -f /etc/sftpgo/ed25519 -t ed25519 -N ""
|
|
|
|
ssh-keygen -lvf /etc/sftpgo/ed25519 > /etc/sftpgo/ed25519.fp
|
2022-05-20 16:31:40 +02:00
|
|
|
|
|
|
|
# Create database
|
|
|
|
sqlite3 /srv/php/niver/db/niver.db < /srv/php/niver/db/source.sql
|