correct cert-chain in vortual.conf

This commit is contained in:
Peter Hormanns 2012-10-16 17:11:10 +02:00
parent fbbb1f4132
commit d5b27e5a59

View File

@ -60,10 +60,19 @@ public class PacProcessorFactory implements EntityProcessorFactory {
new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.jtpl",
new HashMap<String, String>(), pacValuesList.iterator(),
"/etc/apache2/virtual.conf.tmp", "root", "root", "644", true),
new ShellProcessor("ls /etc/apache2/pems/" + pacName + ".pem >/dev/null 2>&1 " + "&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/apache.conf.tmp"
+ " && (ls /etc/apache2/pems/" + pacName + ".chain.pem >/dev/null 2>&1"
+ " || sed -i '/SSLCertificateChain.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp)"
+ " || sed -i '/SSLCertificate.*" + pacName + "/d' " + "/etc/apache2/virtual.conf.tmp"),
new ShellProcessor("for PEM in $( cat virtual.conf.tmp | grep SSLCertificateFile | cut -c24- ); do " +
"ls $PEM >/dev/null 2>&1 || ( " +
" sed -i \"/SSLCertificateFile.*${PEM:18}/c \\\n" +
"\\ \\ \\ \\ SSLCertificateFile \\/etc\\/apache2\\/pems\\/default.pem\" virtual.conf.tmp && " +
" sed -i \"/SSLCertificateChainFile.*${PEM:18:5}.chain.pem/c \\\n" +
"\\ \\ \\ \\ SSLCertificateChainFile \\/etc\\/apache2\\/pems\\/default.chain.pem\" virtual.conf.tmp " +
"); " +
"done"),
new ShellProcessor("for PEM in $( cat virtual.conf.tmp | grep SSLCertificateChainFile | cut -c24- ); do " +
"ls $PEM >/dev/null 2>&1 || " +
" sed -i \"/SSLCertificateChainFile.*${PEM:18:5}.chain.pem/d \" virtual.conf.tmp " +
"); " +
"done"),
new ShellProcessor("(diff -q /etc/apache2/virtual.conf.tmp /etc/apache2/virtual.conf"
+ " && rm /etc/apache2/virtual.conf.tmp )"
+ " || ( mv /etc/apache2/virtual.conf.tmp /etc/apache2/virtual.conf "