smeserver-certificates/root/etc/e-smith/templates/usr/bin/hook-script.sh/10deploy_cert
Jean-Philippe Pialasse e631a1dffc * Wed Feb 12 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0-2.sme
- move smanager panel in package [SME: 12916]
- add Requires
- add templates from smeserver-letsencrypt
- use /var/www/html/.well-known/acme-challenge
2025-02-13 01:05:14 -05:00

55 lines
1.4 KiB
Plaintext

{
use strict;
use warnings;
use esmith::ConfigDB;
my $configDB = esmith::ConfigDB->open_ro or die("can't open Config DB");
my $letsencryptStatus = $configDB->get_prop( 'letsencrypt', 'status' ) || 'disabled';
my $version = $configDB->get_prop( 'sysconfig', 'ReleaseVersion' );
$version = substr( $version, 0, 1 );
if ( $letsencryptStatus ne 'disabled' ) {
if ( $version == 8 ) {
$OUT .= <<'_EOF';
if [ $1 = "deploy_cert" ]; then
KEY=$3
CERT=$4
CHAIN=$6
echo "Set up modSSL db keys"
/sbin/e-smith/db configuration setprop modSSL key $KEY
/sbin/e-smith/db configuration setprop modSSL crt $CERT
/sbin/e-smith/db configuration setprop modSSL CertificateChainFile $CHAIN
echo "Signal events"
/sbin/e-smith/signal-event domain-modify
/sbin/e-smith/signal-event email-update
/sbin/e-smith/signal-event ibay-modify
echo "All complete"
fi
_EOF
}
else {
$OUT .= <<'_EOF';
if [ $1 = "deploy_cert" ]; then
KEY=$3
CERT=$4
CHAIN=$6
echo "Set up modSSL db keys"
/sbin/e-smith/db configuration setprop modSSL key $KEY
/sbin/e-smith/db configuration setprop modSSL crt $CERT
/sbin/e-smith/db configuration setprop modSSL CertificateChainFile $CHAIN
echo "Signal events"
/sbin/e-smith/signal-event ssl-update
echo "All complete"
fi
_EOF
}
}
}