Initialer Import der Synology Scripts

This commit is contained in:
root
2026-08-05 08:43:57 +02:00
commit 5e32a7c411
404 changed files with 79932 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
#!/bin/bash
# Variablen für benutzerdefinierte Einstellungen
DB_NAME="openxpki_intermediate"
DB_USER="intermediate_db_user"
DB_PASSWORD="intermediate_db_password"
SERVER_NAME="intermediateca.heim.lan"
ROOT_CA_CERT_PATH="/path/to/root/ca-cert.crt"
INTERMEDIATE_CA_CERT_PATH="/path/to/intermediate/ca-cert.crt"
INTERMEDIATE_CA_KEY_PATH="/path/to/intermediate/ca-key.key"
# System aktualisieren
sudo dnf update -y
# Installiere erforderliche Pakete
sudo dnf install -y epel-release
sudo dnf install -y gcc gcc-c++ make perl-CPAN perl-DBI perl-DBD-MySQL perl-DBD-SQLite perl-DBD-Pg \
perl-Data-UUID perl-DateTime perl-DateTime-TimeZone perl-MIME-Base64-URLSafe \
perl-XML-Parser perl-XML-Simple perl-Moose perl-MooseX-Aliases perl-Try-Tiny \
perl-JSON perl-DBD-MySQL perl-DBD-SQLite perl-DBD-Pg mariadb-server
# Füge das OpenXPKI-Repository hinzu
sudo rpm --import https://packages.openxpki.org/key/OpenXPKI-2016-02-15.pub
sudo tee /etc/yum.repos.d/openxpki.repo <<EOF
[openxpki]
name=OpenXPKI
baseurl=http://packages.openxpki.org/rhel/8/release/
enabled=1
gpgcheck=1
EOF
sudo dnf update -y
# Installiere OpenXPKI
sudo dnf install -y openxpki
# Starte und sichere die MariaDB-Installation
sudo systemctl start mariadb
sudo systemctl enable mariadb
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 dnf install -y httpd mod_fcgid
# Erstelle die Apache-Konfigurationsdatei
sudo tee /etc/httpd/conf.d/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 systemctl start httpd
sudo systemctl enable httpd
sudo systemctl restart httpd
# Firewall-Einstellungen anpassen
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=https --permanent
sudo firewall-cmd --reload
# OpenXPKI als Intermediate CA initialisieren (Beispielkonfiguration)
sudo tee /etc/openxpki/config.d/realm/heim.lan