| | |
| | | } |
| | | } |
| | | |
| | | private Processor createAccountingRulesProc() { |
| | | return new ShellProcessor("mk-iptables-rules Accounting"); |
| | | } |
| | | |
| | | private Processor createHttpdVirtualProc(Hive hive) throws ProcessorException { |
| | | Processor domSetupProcessor = new CompoundProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.vm", hive, |
| | | "/etc/apache2/virtual.conf.tmp", "root", "root", "644", true), |
| | | new ShellProcessor("for PEM in $( cat /etc/apache2/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\" /etc/apache2/virtual.conf.tmp && " + |
| | | " sed -i \"/SSLCertificateChainFile.*${PEM:18:5}.chain.pem/c \\\n" + |
| | | "\\ \\ \\ \\ SSLCertificateChainFile \\/etc\\/apache2\\/pems\\/default.chain.pem\" /etc/apache2/virtual.conf.tmp " + |
| | | "); " + |
| | | "done"), |
| | | new ShellProcessor("for PEM in $( cat /etc/apache2/virtual.conf.tmp | grep SSLCertificateChainFile | cut -c29- ); do " + |
| | | "ls $PEM >/dev/null 2>&1 || " + |
| | | " sed -i \"/SSLCertificateChainFile.*${PEM:18:5}.chain.pem/d \" /etc/apache2/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 " |
| | | + " && invoke-rc.d apache2 reload >/dev/null 2>&1 ) ")); |
| | | return domSetupProcessor; |
| | | } |
| | | |
| | | @Override |
| | | public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity) |
| | | throws ProcessorException { |
| | |
| | | } |
| | | } |
| | | |
| | | private Processor createAccountingRulesProc() { |
| | | return new ShellProcessor("mk-iptables-rules Accounting"); |
| | | } |
| | | |
| | | private Processor createHttpdVirtualProc(Hive hive) throws ProcessorException { |
| | | Processor domSetupProcessor = new CompoundProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.vm", hive, |
| | | "/etc/apache2/virtual.conf.tmp", "root", "root", "644", true), |
| | | new ShellProcessor("for PEM in $( cat /etc/apache2/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\" /etc/apache2/virtual.conf.tmp && " + |
| | | " sed -i \"/SSLCertificateChainFile.*${PEM:18:5}.chain.pem/c \\\n" + |
| | | "\\ \\ \\ \\ SSLCertificateChainFile \\/etc\\/apache2\\/pems\\/default.chain.pem\" /etc/apache2/virtual.conf.tmp " + |
| | | "); " + |
| | | "done"), |
| | | new ShellProcessor("for PEM in $( cat /etc/apache2/virtual.conf.tmp | grep SSLCertificateChainFile | cut -c29- ); do " + |
| | | "ls $PEM >/dev/null 2>&1 || " + |
| | | " sed -i \"/SSLCertificateChainFile.*${PEM:18:5}.chain.pem/d \" /etc/apache2/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 " |
| | | + " && invoke-rc.d apache2 reload >/dev/null 2>&1 ) ")); |
| | | return domSetupProcessor; |
| | | } |
| | | |
| | | private Processor createEtcHostsProc(Hive hive) throws ProcessorException { |
| | | return new VelocityProcessor("/de/hsadmin/mods/pac/hosts.vm", hive, "/etc/hosts", true); |
| | | } |
| | | |
| | | private Processor createNetworkInterfacesProc(Hive hive) throws ProcessorException { |
| | | return new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true); |
| | | VelocityProcessor interfacesProc = new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true); |
| | | VelocityProcessor pacIPv4Proc = new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true); |
| | | return new CompoundProcessor(interfacesProc, pacIPv4Proc); |
| | | } |
| | | |
| | | private Processor createIPTablesProc() { |