From 45131668bfadbdb1fbe56bfed80ba9ca276db357 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 28 Mar 2011 13:15:47 +0000 Subject: [PATCH] Premier jet refonte MX pour le "root" du domaine --- bureau/class/m_dom.php | 8 ++++---- install/mysql.sql | 12 +++++++----- install/upgrades/1.0.sql | 12 +++++++----- src/functions_dns.sh | 7 +++++-- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php index 2dd3d1db..b321ee8e 100644 --- a/bureau/class/m_dom.php +++ b/bureau/class/m_dom.php @@ -73,8 +73,8 @@ class m_dom { var $type_ipv6 = "IPV6"; var $type_cname = "CNAME"; var $type_txt = "TXT"; - var $type_mx = "MX"; - var $type_mx2 = "MX2"; + var $type_mx = "DEFMX"; + var $type_mx2 = "DEFMX2"; var $action_insert = "0"; var $action_update= "1"; @@ -411,9 +411,9 @@ class m_dom { } if ($mx) { - $this->set_sub_domain($domain, '', $this->type_mx, $GLOBALS['L_DEFAULT_MX']); + $this->set_sub_domain($domain, '', $this->type_defmx, ''); if (! empty($GLOBALS['L_DEFAULT_SECONDARY_MX'])) { - $this->set_sub_domain($domain, '', $this->type_mx2, $GLOBALS['L_DEFAULT_SECONDARY_MX']); + $this->set_sub_domain($domain, '', $this->type_defmx2, ''); } } diff --git a/install/mysql.sql b/install/mysql.sql index 4f89f751..9cf12411 100644 --- a/install/mysql.sql +++ b/install/mysql.sql @@ -497,12 +497,14 @@ PRIMARY KEY ( `name` ) INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced) values ('vhost','Locally hosted', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false), ('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true, false), -('ip','IPv4 redirect', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt,mx,mx2', false, true, false), +('ip','IPv4 redirect', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt,mx,mx2,defmx,defmx2', false, true, false), ('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false), -('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt,mx,mx2',true, true, true ), -('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true, true ), -('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, true, true), +('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt,mx,mx2,defmx,defmx2',true, true, true ), +('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt,mx,mx2,defmx,defmx2',true, true, true ), +('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2,defmx,defmx2',true, true, true), ('mx', 'MX DNS entry', 'DOMAIN', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true), -('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx2',true, false, true), +('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true), +('defmx', 'Default mail server', 'NONE', '%SUB% IN MX 5 @@DEFAULT_MX@@', 'vhost,url,ip,webmail,ipv6,cname,txt,defmx2',true, false, true), +('defmx2', 'Default backup mail server', 'DOMAIN', '%SUB% IN MX 10 @@DEFAULT_SECONDARY_MX@@', 'vhost,url,ip,webmail,ipv6,cname,txt,defmx',true, false, true), ('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true) ; diff --git a/install/upgrades/1.0.sql b/install/upgrades/1.0.sql index dd1f48f8..a7f046a5 100644 --- a/install/upgrades/1.0.sql +++ b/install/upgrades/1.0.sql @@ -22,13 +22,15 @@ PRIMARY KEY ( `name` ) INSERT IGNORE INTO `domaines_type` (name, description, target, entry, compatibility, only_dns, need_dns, advanced) values ('vhost','Locally hosted', 'DIRECTORY', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false), ('url','URL redirection', 'URL', '%SUB% IN A @@PUBLIC_IP@@','txt', true, true, false), -('ip','IPv4 redirect', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt,mx,mx2', false, true, false), +('ip','IPv4 redirect', 'IP', '%SUB% IN A %TARGET%','url,ip,ipv6,txt,mx,mx2,defmx,defmx2', false, true, false), ('webmail', 'Webmail access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'txt', false, false, false), -('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt,mx,mx2',true, true, true ), -('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt',true, true, true ), -('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, true, true), +('ipv6','IPv6 redirect', 'IPV6', '%SUB% IN AAAA %TARGET%','ip,ipv6,webmail,txt,mx,mx2,defmx,defmx2',true, true, true ), +('cname', 'CNAME DNS entry', 'DOMAIN', '%SUB% CNAME %TARGET%', 'txt,mx,mx2,defmx,defmx2',true, true, true ), +('txt', 'TXT DNS entry', 'TXT', '%SUB% IN TXT "%TARGET%"','vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2,defmx,defmx2',true, true, true), ('mx', 'MX DNS entry', 'DOMAIN', '%SUB% IN MX 5 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true), -('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx2',true, false, true), +('mx2', 'secondary MX DNS entry', 'DOMAIN', '%SUB% IN MX 10 %TARGET%', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true), +('defmx', 'Default mail server', 'NONE', '%SUB% IN MX 5 @@DEFAULT_MX@@', 'vhost,url,ip,webmail,ipv6,cname,txt,defmx2',true, false, true), +('defmx2', 'Default backup mail server', 'DOMAIN', '%SUB% IN MX 10 @@DEFAULT_SECONDARY_MX@@', 'vhost,url,ip,webmail,ipv6,cname,txt,defmx',true, false, true), ('panel', 'AlternC panel access', 'NONE', '%SUB% IN A @@PUBLIC_IP@@', 'vhost,url,ip,webmail,ipv6,cname,txt,mx,mx2',true, false, true) ; diff --git a/src/functions_dns.sh b/src/functions_dns.sh index b27467ea..78e5fa59 100755 --- a/src/functions_dns.sh +++ b/src/functions_dns.sh @@ -97,7 +97,9 @@ dns_regenerate() { ) # Get some usefull vars - local mx=$( $MYSQL_DO "select mx from domaines where domaine='$domain' limit 1;") + +# Deprecated ? +# local mx=$( $MYSQL_DO "select mx from domaines where domaine='$domain' limit 1;") # Replace the vars by their values # Here we can add dynamic value for the default MX @@ -105,7 +107,8 @@ dns_regenerate() { s/%%fqdn%%/$FQDN/g; s/%%ns1%%/$NS1_HOSTNAME/g; s/%%ns2%%/$NS2_HOSTNAME/g; - s/%%mx%%/$mx/g; + s/%%DEFAULT_MX%%/$DEFAULT_MX/g; + s/%%DEFAULT_SECONDARY_MX%%/$DEFAULT_SECONDARY_MX/g; s/@@DOMAINE@@/$domain/g; s/@@SERIAL@@/$serial/g; s/@@PUBLIC_IP@@/$PUBLIC_IP/g")