From d5b27e5a5946a82f36ec580ecf04ecf9e8d0e27f Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Tue, 16 Oct 2012 17:11:10 +0200 Subject: [PATCH] correct cert-chain in vortual.conf --- .../hsadmin/mods/pac/PacProcessorFactory.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java index 27c8ed3..7d65e53 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java @@ -60,10 +60,19 @@ public class PacProcessorFactory implements EntityProcessorFactory { new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.jtpl", new HashMap(), 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 "