| | |
| | | } |
| | | templateVars.put("PROTOCOL", "http"); |
| | | domDirsProcessor.appendProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs/.htaccess", userName, pacName, "644") |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs/.htaccess", userName, pacName, "644", false) |
| | | ); |
| | | templateVars.put("PROTOCOL", "https"); |
| | | domDirsProcessor.appendProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs-ssl/.htaccess", userName, pacName, "644") |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/htaccess.jtpl", templateVars, domainDir + "/htdocs-ssl/.htaccess", userName, pacName, "644", false) |
| | | ); |
| | | domDirsProcessor.appendProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs/www/index.html", userName, pacName, "644") |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs/www/index.html", userName, pacName, "644", false) |
| | | ); |
| | | domDirsProcessor.appendProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644") |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/index.html.jtpl", templateVars, domainDir + "/subs-ssl/www/index.html", userName, pacName, "644", false) |
| | | ); |
| | | if (dynamicWeb) { |
| | | domDirsProcessor.appendProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi/test.cgi", userName, pacName, "755") |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi/test.cgi", userName, pacName, "755", false) |
| | | ); |
| | | domDirsProcessor.appendProcessor( |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi-ssl/test.cgi", userName, pacName, "755") |
| | | new CreateFileProcessor("/de/hsadmin/mods/dom/test.cgi.jtpl", templateVars, domainDir + "/cgi-ssl/test.cgi", userName, pacName, "755", false) |
| | | ); |
| | | domDirsProcessor.appendProcessor( |
| | | new CopyFileProcessor("/usr/local/src/phpstub/phpstub", domainDir + "/fastcgi/phpstub", userName, pacName, "755") |
| | |
| | | private Processor createApacheVHostSetupProcessor(Domain dom, Map<String, String> templateVars) |
| | | throws ProcessorException { |
| | | String domName = dom.getName(); |
| | | int level = domName.split("\\.").length; |
| | | String linkPrefix = Integer.toString(100 - level); |
| | | String pac = dom.getUser().getPac().getName(); |
| | | Processor domSetupProcessor = new CompoundProcessor( |
| | | createDomainDirectoriesProcessor(dom, templateVars), |
| | | new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-generated/" + domName, "root", "root", "644"), |
| | | new CreateFileProcessor(selectVHostTemplate(dom), templateVars, "/etc/apache2/sites-available/" + domName, "root", "root", "644", true), |
| | | new ShellProcessor("ls /etc/apache2/pems/" + pac + ".pem >/dev/null 2>&1 " + |
| | | "&& sed -i '/SSLCertificate.*default/d' " + "/etc/apache2/sites-generated/" + domName + |
| | | " && (ls /etc/apache2/pems/" + pac + ".chain.pem >/dev/null 2>&1 || sed -i '/SSLCertificateChain.*" + pac + "/d' " + "/etc/apache2/sites-generated/" + domName + ")" + |
| | | " || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-generated/" + domName), |
| | | "&& sed -i '/SSLCertificate.*default/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 + ")" + |
| | | " || sed -i '/SSLCertificate.*" + pac + "/d' " + "/etc/apache2/sites-available/" + domName), |
| | | new ShellProcessor( |
| | | "ln -sf /etc/apache2/sites-generated/" + domName + " /etc/apache2/sites-enabled/010-" + domName + |
| | | "ln -sf /etc/apache2/sites-available/" + domName + " /etc/apache2/sites-enabled/" + linkPrefix + "-"+ domName + |
| | | " && invoke-rc.d apache2 reload >/dev/null 2>&1") |
| | | ); |
| | | return domSetupProcessor; |
| | |
| | | Processor vhostDelProcessor = |
| | | new ShellProcessor("rm /home/doms/" + domName + |
| | | " && rm -rf " + dom.getUser().getHomedir() + "/doms/" + domName + |
| | | " && rm /etc/apache2/sites-generated/" + domName + |
| | | " && rm /etc/apache2/sites-available/" + domName + |
| | | " && rm /etc/apache2/sites-*/`ls -1 /etc/apache2/sites-enabled/ | egrep \"^[01]+-" + domName + "$\"`" + |
| | | " && invoke-rc.d apache2 reload >/dev/null 2>&1"); |
| | | return vhostDelProcessor; |