don't create one giant vhost for all IP's but separate ones for each ip

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-05-02 13:02:40 +02:00
parent 9691a39102
commit 4825c77e2e

View File

@@ -589,29 +589,30 @@ class apache
} }
$query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip` $query = "SELECT * FROM `".TABLE_PANEL_IPSANDPORTS."` `i`, `".TABLE_DOMAINTOIP."` `dip`
WHERE dip.id_domain = '".$domain[id]."' AND i.id = dip.id_ipandports "; WHERE dip.id_domain = '".$domain['id']."' AND i.id = dip.id_ipandports ";
if ($ssl_vhost === true if ($ssl_vhost === true
&& ($domain['ssl'] == '1' || $domain['ssl_redirect'] == '1') && ($domain['ssl'] == '1' || $domain['ssl_redirect'] == '1')
) { ) {
$query .= "AND i.ssl = 1 ORDER BY i.ssl_cert_file ASC;"; // by ordering by cert-file the row with filled out SSL-Fields will be shown last, thus it is enough to fill out 1 set of SSL-Fields // by ordering by cert-file the row with filled out SSL-Fields will be shown last, thus it is enough to fill out 1 set of SSL-Fields
$query .= "AND i.ssl = 1 ORDER BY i.ssl_cert_file ASC;";
} else { } else {
$query .= "AND i.ssl = '0';"; $query .= "AND i.ssl = '0';";
} }
$ipport = ''; $vhost_content = '';
$result = $this->db->query($query); $result = $this->db->query($query);
while ($ipandport = $this->db->fetch_array($result)) { while ($ipandport = $this->db->fetch_array($result)) {
$ipport = '';
$domain['ip'] = $ipandport['ip']; $domain['ip'] = $ipandport['ip'];
$domain['port'] = $ipandport['port']; $domain['port'] = $ipandport['port'];
if (filter_var($domain['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if (filter_var($domain['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$ipport .= '['.$domain[ip].']:'.$domain[port]. ' '; $ipport = '['.$domain['ip'].']:'.$domain['port']. ' ';
} else { } else {
$ipport .= $domain[ip].':'.$domain[port].' '; $ipport = $domain['ip'].':'.$domain['port'].' ';
}
} }
$domain['ssl_cert_file'] = $ipandport['ssl_cert_file']; // save last delivered ssl settings $domain['ssl_cert_file'] = $ipandport['ssl_cert_file']; // save last delivered ssl settings
@@ -620,7 +621,7 @@ class apache
// #418 // #418
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
$vhost_content = '<VirtualHost ' . $ipport . '>' . "\n"; $vhost_content .= '<VirtualHost ' . $ipport . '>' . "\n";
$vhost_content.= $this->getServerNames($domain); $vhost_content.= $this->getServerNames($domain);
@@ -716,6 +717,8 @@ class apache
} }
$vhost_content .= '</VirtualHost>' . "\n"; $vhost_content .= '</VirtualHost>' . "\n";
} // while ip's
return $vhost_content; return $vhost_content;
} }