Initialer Import der Synology Scripts
This commit is contained in:
Executable
+86
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Variablen für benutzerdefinierte Einstellungen
|
||||
DB_NAME="openxpki"
|
||||
DB_USER="your_db_user"
|
||||
DB_PASSWORD="your_db_password"
|
||||
SERVER_NAME="ca.test.lan"
|
||||
|
||||
# Aktualisiere das System
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
|
||||
# Installiere erforderliche Pakete
|
||||
sudo apt-get install -y build-essential libssl-dev libdbi-perl libdbd-sqlite3-perl libdbd-mysql-perl \
|
||||
libdbd-pg-perl libdata-uuid-perl libdatetime-perl libdatetime-timezone-perl libmime-base64-urlsafe-perl \
|
||||
libxml-parser-perl libxml-simple-perl libmoose-perl libmoosex-aliases-perl libtry-tiny-perl \
|
||||
libjson-perl libdbd-mysql-perl libdbd-sqlite3-perl libdbd-pg-perl
|
||||
|
||||
# Füge das OpenXPKI-Repository hinzu
|
||||
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551
|
||||
echo "deb http://packages.openxpki.org/debian/ focal release" | sudo tee /etc/apt/sources.list.d/openxpki.list
|
||||
sudo apt-get update
|
||||
|
||||
# Installiere OpenXPKI
|
||||
sudo apt-get install -y openxpki
|
||||
|
||||
# Installiere MySQL-Server
|
||||
sudo apt-get install -y mysql-server
|
||||
sudo mysql_secure_installation
|
||||
|
||||
# Erstelle und konfiguriere die OpenXPKI-Datenbank
|
||||
sudo mysql -u root -p <<EOF
|
||||
CREATE DATABASE $DB_NAME;
|
||||
CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PASSWORD';
|
||||
GRANT ALL PRIVILEGES ON $DB_NAME.* TO '$DB_USER'@'localhost';
|
||||
FLUSH PRIVILEGES;
|
||||
EXIT;
|
||||
EOF
|
||||
|
||||
# Konfigurationsdateien bearbeiten, um den benutzerdefinierten Datenbankbenutzer zu verwenden
|
||||
sudo sed -i "s/DBI:mysql:database=openxpki;host=localhost/DBI:mysql:database=$DB_NAME;host=localhost/" /etc/openxpki/config.d/system/database.yaml
|
||||
sudo sed -i "s/user: openxpki/user: $DB_USER/" /etc/openxpki/config.d/system/database.yaml
|
||||
sudo sed -i "s/pass: secret/password: $DB_PASSWORD/" /etc/openxpki/config.d/system/database.yaml
|
||||
|
||||
# Starte und aktiviere OpenXPKI
|
||||
sudo systemctl start openxpki
|
||||
sudo systemctl enable openxpki
|
||||
|
||||
# Installiere und konfiguriere Apache
|
||||
sudo apt-get install -y apache2 libapache2-mod-fcgid
|
||||
|
||||
# Erstelle die Apache-Konfigurationsdatei
|
||||
sudo tee /etc/apache2/sites-available/openxpki.conf <<EOF
|
||||
<VirtualHost *:80>
|
||||
ServerName $SERVER_NAME
|
||||
|
||||
DocumentRoot /var/www/openxpki
|
||||
|
||||
<Directory /var/www/openxpki>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
|
||||
<Directory "/usr/lib/cgi-bin">
|
||||
AllowOverride None
|
||||
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
Alias /openxpki /var/www/openxpki
|
||||
<Directory /var/www/openxpki>
|
||||
Options Indexes FollowSymLinks
|
||||
AllowOverride None
|
||||
Require all granted
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
EOF
|
||||
|
||||
# Konfiguriere und starte Apache neu
|
||||
sudo a2enmod cgi
|
||||
sudo a2ensite openxpki
|
||||
sudo systemctl restart apache2
|
||||
|
||||
echo "Installation und Konfiguration von OpenXPKI abgeschlossen. Öffne http://$SERVER_NAME/openxpki in deinem Browser."
|
||||
Reference in New Issue
Block a user