Merge branch '277-no_default_vhost_template' into pu
This commit is contained in:
commit
79ad391793
|
@ -130,8 +130,8 @@ $dom->unlock();
|
|||
|
||||
<select class="inl" name="https_<?php ehe($dt['name']); ?>" id="https_<?php ehe($dt['name']); ?>">
|
||||
<option value="http"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="http") || false); ?>><?php __("HTTP Only (redirect HTTPS to HTTP)"); ?></option>
|
||||
<option value="https"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="http") || true); ?>><?php __("HTTPS Only (redirect HTTP to HTTPS)"); ?></option>
|
||||
<option value="both"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="http") || false); ?>><?php __("Both HTTP and HTTPS hosted at the same place"); ?></option>
|
||||
<option value="https"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="https") || false); ?>><?php __("HTTPS Only (redirect HTTP to HTTPS)"); ?></option>
|
||||
<option value="both"<?php selected((strtoupper($type)==strtoupper($dt['name']) && $sd["https"]=="both") || false); ?>><?php __("Both HTTP and HTTPS hosted at the same place"); ?></option>
|
||||
</select>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
|
|
@ -567,14 +567,22 @@ SELECT ?,?,?, FROM_UNIXTIME(?), FROM_UNIXTIME(?), ?, ?, sslcsr FROM certificate
|
|||
return; // nothing to do : this domain type does not involve Vhosts
|
||||
}
|
||||
|
||||
// The 'vhost' type is overloaded with -http, -https, and -both.
|
||||
// If the type starts with vhost, we should match vhost%
|
||||
// Generally, only 'vhost' is used since the overloads are not enabled
|
||||
// for use in the interface.
|
||||
$type_match = $type;
|
||||
if (substr($type, 0, 5) == 'vhost') {
|
||||
$type_match = 'vhost%';
|
||||
}
|
||||
if ($action == "postinst") {
|
||||
$msg->log("ssl", "update_domain:CREATE($action,$type,$fqdn)");
|
||||
$offset = 0;
|
||||
$found = false;
|
||||
do { // try each subdomain (strtok-style) and search them in sub_domaines table:
|
||||
$db->query(
|
||||
"SELECT * FROM sub_domaines WHERE sub=? AND domaine=? AND web_action NOT IN ('','OK') AND type=?",
|
||||
array(substr($fqdn, 0, $offset), substr($fqdn, $offset + ($offset != 0)), $type)
|
||||
"SELECT * FROM sub_domaines WHERE sub=? AND domaine=? AND web_action NOT IN ('','OK') AND type LIKE ?",
|
||||
array(substr($fqdn, 0, $offset), substr($fqdn, $offset + ($offset != 0)), $type_match)
|
||||
);
|
||||
if ($db->next_record()) {
|
||||
$found = true;
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
php_admin_flag mail.add_x_header on
|
||||
Options -MultiViews -FollowSymLinks +SymLinksIfOwnerMatch
|
||||
AllowOverride AuthConfig FileInfo Limit Options Indexes
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
|
|
|
@ -479,18 +479,26 @@ CREATE TABLE IF NOT EXISTS `domaines_type` (
|
|||
PRIMARY KEY ( `name` )
|
||||
) ENGINE=InnoDB COMMENT = 'Type of domains allowed';
|
||||
|
||||
INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced, enable) values
|
||||
('vhost', 'Locally hosted', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'ALL'),
|
||||
('url', 'URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2', false, false, false, 'ALL'),
|
||||
('ip', 'IPv4 redirect', 'IP', '%SUB% IN A %TARGET%', 'url,ip,ipv6,txt,mx,mx2,defmx,defmx2', true, true, false, 'ALL'),
|
||||
('ipv6', 'IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%', 'ip,ipv6,txt,mx,mx2,defmx,defmx2', true, true, true, 'ALL'),
|
||||
('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', '', true, true, true, 'ALL'),
|
||||
('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"', 'vhost,url,ip,ipv6,txt,mx,mx2,defmx,defmx2', true, true, true, 'ALL'),
|
||||
('mx', 'MX DNS entry', 'DOMAIN', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,ipv6,txt,mx,mx2', true, true, true, 'ALL'),
|
||||
('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,ipv6,txt,mx,mx2', true, true, true, 'ALL'),
|
||||
('defmx', 'Default mail server', 'NONE', '%SUB% IN MX 5 @@DEFAULT_MX@@.', 'vhost,url,ip,ipv6,txt,defmx2', true, true, true, 'ADMIN'),
|
||||
('defmx2', 'Default backup mail server', 'NONE', '%SUB% IN MX 10 @@DEFAULT_SECONDARY_MX@@.', 'vhost,url,ip,ipv6,txt,defmx', true, true, true, 'ADMIN'),
|
||||
('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,ipv6,txt,mx,mx2,defmx,defmx2', false, false, true, 'ALL')
|
||||
INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced, enable, has_https_option) values
|
||||
-- Default vhost type to maintains compatibility across versions.
|
||||
-- This is overloaded depending on the value of the https column in sub_domaines
|
||||
('vhost', 'Locally hosted', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'ALL', true),
|
||||
-- The following 3 types (vhost-http, vhost-https, vhost-both) are overloads for vhost
|
||||
-- and are "disabled" to not be available from the interface, but still be valid domaine types
|
||||
-- when checking in m_ssl::updateDomain.
|
||||
('vhost-http','Locally hosted with http->https', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'NONE', false),
|
||||
('vhost-https','Locally hosted with http->https', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'NONE', false),
|
||||
('vhost-both', 'Locally hosted with http and https', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'NONE', false),
|
||||
('url', 'URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2', false, false, false, 'ALL', false),
|
||||
('ip', 'IPv4 redirect', 'IP', '%SUB% IN A %TARGET%', 'url,ip,ipv6,txt,mx,mx2,defmx,defmx2', true, true, false, 'ALL', false),
|
||||
('ipv6', 'IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%', 'ip,ipv6,txt,mx,mx2,defmx,defmx2', true, true, true, 'ALL', false),
|
||||
('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', '', true, true, true, 'ALL', false),
|
||||
('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"', 'vhost,url,ip,ipv6,txt,mx,mx2,defmx,defmx2', true, true, true, 'ALL', false),
|
||||
('mx', 'MX DNS entry', 'DOMAIN', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,ipv6,txt,mx,mx2', true, true, true, 'ALL', false),
|
||||
('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,ipv6,txt,mx,mx2', true, true, true, 'ALL', false),
|
||||
('defmx', 'Default mail server', 'NONE', '%SUB% IN MX 5 @@DEFAULT_MX@@.', 'vhost,url,ip,ipv6,txt,defmx2', true, true, true, 'ADMIN', false),
|
||||
('defmx2', 'Default backup mail server', 'NONE', '%SUB% IN MX 10 @@DEFAULT_SECONDARY_MX@@.', 'vhost,url,ip,ipv6,txt,defmx', true, true, true, 'ADMIN', false),
|
||||
('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,ipv6,txt,mx,mx2,defmx,defmx2', false, false, true, 'ALL', false)
|
||||
;
|
||||
UPDATE domaines_type SET create_tmpdir=true, create_targetdir=true WHERE target='DIRECTORY';
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
-- upgrade from 3.5.0.1 to 3.5.0.2
|
||||
INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced, enable, has_https_option) values
|
||||
('vhost-http','Locally hosted with http->https', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'NONE', false),
|
||||
('vhost-https','Locally hosted with http->https', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'NONE', false),
|
||||
('vhost-both', 'Locally hosted with http and https', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt,defmx,defmx2,mx,mx2', false, false, false, 'NONE', false),
|
|
@ -57,7 +57,7 @@ mysql_query "update sub_domaines sd, domaines d set sd.web_action = 'DELETE' whe
|
|||
|
||||
# Sub_domaines we want to delete
|
||||
# sub_domaines.web_action = delete
|
||||
for sub in $( mysql_query "select concat_ws('$B',lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine)) from sub_domaines sd where web_action ='DELETE';") ; do
|
||||
for sub in $( mysql_query "select concat_ws('$B', lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine)) from sub_domaines sd where web_action ='DELETE';") ; do
|
||||
host_delete ${sub/$B/ }
|
||||
mysql_query "delete from sub_domaines where concat_ws('$B',lower(type), if(length(sub)>0,concat_ws('.',sub,domaine),domaine)) = '$sub' and web_action ='DELETE';"
|
||||
echo 1 > "$RELOAD_WEB"
|
||||
|
@ -67,7 +67,7 @@ done
|
|||
# sub_domaines.web_action = update and sub_domains.only_dns = false
|
||||
IFS="$NEWIFS"
|
||||
mysql_query "
|
||||
select concat_ws('$IFS',sd.id, lower(sd.type), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), concat_ws('@',m.login,v.value), sd.valeur )
|
||||
select concat_ws('$IFS',sd.id, if(length(sd.https)>0,concat_ws('-',sd.type,sd.https),lower(sd.type)), if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine), concat_ws('@',m.login,v.value), sd.valeur )
|
||||
from sub_domaines sd,membres m,variable v
|
||||
where sd.compte=m.uid and sd.web_action ='UPDATE' and v.name='mailname_bounce'
|
||||
;" | while read sdid type domain mail valeur ; do
|
||||
|
@ -77,14 +77,14 @@ where sd.compte=m.uid and sd.web_action ='UPDATE' and v.name='mailname_bounce'
|
|||
done
|
||||
|
||||
# Domaine to enable
|
||||
mysql_query "select concat_ws('$IFS',sd.id, lower(sd.type),if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),sd.valeur) from sub_domaines sd where sd.enable ='ENABLE' ;"|while read sdid type domain valeur ; do
|
||||
mysql_query "select concat_ws('$IFS',sd.id, if(length(sd.https)>0,concat_ws('-',sd.type,sd.https),lower(sd.type)),if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),sd.valeur) from sub_domaines sd where sd.enable ='ENABLE' ;"|while read sdid type domain valeur ; do
|
||||
host_enable "$type" "$domain" "$valeur"
|
||||
mysql_query "update sub_domaines sd set enable='ENABLED' where sd.id = '$sdid' ;"
|
||||
echo 1 > "$RELOAD_WEB"
|
||||
done
|
||||
|
||||
# Domains to disable
|
||||
mysql_query "select concat_ws('$IFS', sd.id, lower(sd.type),if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),sd.valeur) from sub_domaines sd where sd.enable ='DISABLE' ;"|while read sdid type domain valeur ; do
|
||||
mysql_query "select concat_ws('$IFS', sd.id, if(length(sd.https)>0,concat_ws('-',sd.type,sd.https),lower(sd.type)),if(length(sd.sub)>0,concat_ws('.',sd.sub,sd.domaine),sd.domaine),sd.valeur) from sub_domaines sd where sd.enable ='DISABLE' ;"|while read sdid type domain valeur ; do
|
||||
host_disable "$type" "$domain" "$valeur"
|
||||
mysql_query "update sub_domaines sd set enable='DISABLED' where sd.id = '$sdid' ;"
|
||||
echo 1 > "$RELOAD_WEB"
|
||||
|
|
Loading…
Reference in New Issue