(Re)generate /etc/apache2/virtual.conf on pac.add and pac.delete.
This commit is contained in:
parent
fea9a5a083
commit
9a219290a4
@ -314,7 +314,7 @@ public class DomainProcessorFactory implements EntityProcessorFactory {
|
||||
new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-available/" + domName + ".tmp", "root", "root", "644", true),
|
||||
new ShellProcessor("ls /etc/apache2/pems/" + pac + ".pem >/dev/null 2>&1 " +
|
||||
" && sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-available/" + domName + ".tmp" +
|
||||
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ")" +
|
||||
" && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp)" +
|
||||
" || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName + ".tmp"),
|
||||
new ShellProcessor(
|
||||
" (diff -q /etc/apache2/sites-available/" + domName + ".tmp /etc/apache2/sites-available/" + domName + " && rm /etc/apache2/sites-available/" + domName + ".tmp ) " +
|
||||
|
@ -16,6 +16,7 @@ import de.hsadmin.core.qserv.Processor;
|
||||
import de.hsadmin.core.qserv.ProcessorException;
|
||||
import de.hsadmin.core.qserv.ShellProcessor;
|
||||
import de.hsadmin.core.qserv.TemplateProcessor;
|
||||
import de.hsadmin.core.qserv.CreateFileProcessor;
|
||||
import de.hsadmin.core.qserv.WaitingTasksProcessor;
|
||||
import de.hsadmin.core.util.Config;
|
||||
import de.hsadmin.core.util.PasswordTool;
|
||||
@ -44,12 +45,27 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
||||
createSudouersProc(hiveValues, pacValuesList),
|
||||
createProftpdConfProc(hiveValues, pacValuesList),
|
||||
createMakePacDirectoryStructure(unixUser),
|
||||
createIfUp(pacName));
|
||||
createIfUp(pacName),
|
||||
createHttpdVirtualProc(pacName, pacValuesList));
|
||||
WaitingTasksProcessor secProcessor = new WaitingTasksProcessor(priProcessor);
|
||||
// secProcessor.appendProcessor(pac.getHiveName(), createSendEMailProc(pacName, customerEMail, emailVars), "send email to customer");
|
||||
return secProcessor;
|
||||
}
|
||||
|
||||
private Processor createHttpdVirtualProc(
|
||||
String pacName, List<Map<String, String>> pacValuesList) throws ProcessorException {
|
||||
Processor domSetupProcessor = new CompoundProcessor(
|
||||
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("(diff -q /etc/apache2/apache.conf.tmp /etc/apache2/apache.conf"
|
||||
+ " && rm /etc/apache2/apache.conf.tmp)"
|
||||
+ " || invoke-rc.d apache2 reload >/dev/null 2>&1"));
|
||||
return domSetupProcessor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends AbstractEntity> Processor createUpdateProcessor(EntityManager em, T entity)
|
||||
throws ProcessorException {
|
||||
@ -68,7 +84,8 @@ public class PacProcessorFactory implements EntityProcessorFactory {
|
||||
createEtcHostsProc(hiveValues, pacValuesList),
|
||||
createNetworkInterfacesProc(hiveValues, pacValuesList),
|
||||
createSudouersProc(hiveValues, pacValuesList),
|
||||
createProftpdConfProc(hiveValues, pacValuesList)));
|
||||
createProftpdConfProc(hiveValues, pacValuesList),
|
||||
createHttpdVirtualProc(pac.getName(), pacValuesList)));
|
||||
waitingProcessor.appendProcessor(pac.getHiveName(), createDelUserProc(pac.getName()), "remove packet");
|
||||
return waitingProcessor;
|
||||
}
|
||||
|
@ -3,18 +3,17 @@
|
||||
# Do not edit manually. Changes will be overwritten.
|
||||
#
|
||||
|
||||
NameVirtualHost {PAC_IPNUMBER}:80
|
||||
NameVirtualHost {PAC_IPNUMBER_EX}:80
|
||||
NameVirtualHost {PAC_IPNUMBER}:443
|
||||
NameVirtualHost {PAC_IPNUMBER_EX}:443
|
||||
<!-- BEGIN: iterate -->
|
||||
NameVirtualHost {PAC_IP}:80
|
||||
NameVirtualHost {PAC_IP}:443
|
||||
|
||||
<VirtualHost {PAC_IPNUMBER}:80 {PAC_IPNUMBER_EX}:80>
|
||||
<VirtualHost {PAC_IP}:80>
|
||||
|
||||
Redirect 404 /
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
<VirtualHost {PAC_IPNUMBER}:443 {PAC_IPNUMBER_EX}:443>
|
||||
<VirtualHost {PAC_IP}:443>
|
||||
|
||||
SSLEngine On
|
||||
SSLCertificateFile /etc/apache2/pems/default.pem
|
||||
@ -25,4 +24,5 @@ NameVirtualHost {PAC_IPNUMBER_EX}:443
|
||||
Redirect 404 /
|
||||
|
||||
</VirtualHost>
|
||||
<!-- END: iterate -->
|
||||
<!-- END: main -->
|
Loading…
Reference in New Issue
Block a user