From 28cd07d1a75c4e9dcaecac49efee0091f2fc62fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=2E=20T=C3=A4ffner?= <darkalex@firesplash.de> Date: Thu, 7 Apr 2016 11:30:49 +0200 Subject: [PATCH] Implemented a checkbox "enable DNSSEC" in DNS-Wizard. This Checkbox can be enabled or disabled by template. Further I fixed an inconsistent design (HTML) which was introduced by @tbrehm yesterday I tink. (DKIM-Checkbox) --- install/sql/incremental/upd_dev_collection.sql | 2 +- install/sql/ispconfig3.sql | 2 +- interface/web/dns/dns_wizard.php | 4 +++- interface/web/dns/form/dns_template.tform.php | 2 +- interface/web/dns/templates/dns_wizard.htm | 12 +++++++++--- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index ed23e82999..2c4300a678 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -25,7 +25,7 @@ ALTER TABLE `client_template` ALTER TABLE `client` ADD `contact_firstname` VARCHAR( 64 ) NOT NULL DEFAULT '' AFTER `gender`; -UPDATE `dns_template` SET `fields` = 'DOMAIN,IP,NS1,NS2,EMAIL,DKIM' WHERE `dns_template`.`template_id` =1; +UPDATE `dns_template` SET `fields` = 'DOMAIN,IP,NS1,NS2,EMAIL,DKIM,DNSSEC' WHERE `dns_template`.`template_id` =1; UPDATE `dns_template` SET `template` = '[ZONE] origin={DOMAIN}. ns={NS1}. diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index 0c9b893ef1..9d7509506d 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -2397,7 +2397,7 @@ INSERT INTO `country` (`iso`, `name`, `printable_name`, `iso3`, `numcode`, `eu`) -- Dumping data for table `dns_template` -- -INSERT INTO `dns_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `name`, `fields`, `template`, `visible`) VALUES (1, 1, 1, 'riud', 'riud', '', 'Default', 'DOMAIN,IP,NS1,NS2,EMAIL,DKIM', '[ZONE]\norigin={DOMAIN}.\nns={NS1}.\nmbox={EMAIL}.\nrefresh=7200\nretry=540\nexpire=604800\nminimum=3600\nttl=3600\n\n[DNS_RECORDS]\nA|{DOMAIN}.|{IP}|0|3600\nA|www|{IP}|0|3600\nA|mail|{IP}|0|3600\nNS|{DOMAIN}.|{NS1}.|0|3600\nNS|{DOMAIN}.|{NS2}.|0|3600\nMX|{DOMAIN}.|mail.{DOMAIN}.|10|3600\nTXT|{DOMAIN}.|v=spf1 mx a ~all|0|3600', 'y'); +INSERT INTO `dns_template` (`template_id`, `sys_userid`, `sys_groupid`, `sys_perm_user`, `sys_perm_group`, `sys_perm_other`, `name`, `fields`, `template`, `visible`) VALUES (1, 1, 1, 'riud', 'riud', '', 'Default', 'DOMAIN,IP,NS1,NS2,EMAIL,DKIM,DNSSEC', '[ZONE]\norigin={DOMAIN}.\nns={NS1}.\nmbox={EMAIL}.\nrefresh=7200\nretry=540\nexpire=604800\nminimum=3600\nttl=3600\n\n[DNS_RECORDS]\nA|{DOMAIN}.|{IP}|0|3600\nA|www|{IP}|0|3600\nA|mail|{IP}|0|3600\nNS|{DOMAIN}.|{NS1}.|0|3600\nNS|{DOMAIN}.|{NS2}.|0|3600\nMX|{DOMAIN}.|mail.{DOMAIN}.|10|3600\nTXT|{DOMAIN}.|v=spf1 mx a ~all|0|3600', 'y'); -- -------------------------------------------------------- diff --git a/interface/web/dns/dns_wizard.php b/interface/web/dns/dns_wizard.php index bacadf19c8..b6534a3970 100644 --- a/interface/web/dns/dns_wizard.php +++ b/interface/web/dns/dns_wizard.php @@ -300,6 +300,7 @@ if($_POST['create'] == 1) { if($_POST['ns1'] != '') $tpl_content = str_replace('{NS1}', $_POST['ns1'], $tpl_content); if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}', $_POST['ns2'], $tpl_content); if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}', $_POST['email'], $tpl_content); + $enable_dnssec = (($_POST['dnssec'] == 'Y') ? 'Y' : 'N'); if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/', $_POST['domain'])) { $sql = $app->db->queryOneRecord("SELECT dkim_public, dkim_selector FROM mail_domain WHERE domain = ? AND dkim = 'y' AND ".$app->tform->getAuthSQL('r'), $_POST['domain']); $public_key = $sql['dkim_public']; @@ -395,7 +396,8 @@ if($_POST['create'] == 1) { "active" => 'Y', "xfer" => $xfer, "also_notify" => $also_notify, - "update_acl" => $update_acl + "update_acl" => $update_acl, + "dnssec_wanted" => $enable_dnssec ); $dns_soa_id = $app->db->datalogInsert('dns_soa', $insert_data, 'id'); diff --git a/interface/web/dns/form/dns_template.tform.php b/interface/web/dns/form/dns_template.tform.php index 8c2b17580a..541eec4445 100644 --- a/interface/web/dns/form/dns_template.tform.php +++ b/interface/web/dns/form/dns_template.tform.php @@ -74,7 +74,7 @@ $form["tabs"]['template'] = array ( 'formtype' => 'CHECKBOXARRAY', 'default' => '', 'separator' => ',', - 'value' => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'IPV6' => 'IPv6 Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM'), + 'value' => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'IPV6' => 'IPv6 Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM', 'DNSSEC' => 'DNSSEC'), 'validators' => array ( 0 => array ('type' => 'CUSTOM', 'class' => 'validate_dkim', 'function' => 'check_template', diff --git a/interface/web/dns/templates/dns_wizard.htm b/interface/web/dns/templates/dns_wizard.htm index 255a1f81c8..907dedca88 100644 --- a/interface/web/dns/templates/dns_wizard.htm +++ b/interface/web/dns/templates/dns_wizard.htm @@ -89,10 +89,16 @@ <div class="col-sm-9"><input type="text" name="email" id="email" value="{tmpl_var name='email'}" class="form-control" /></div></div> </tmpl_if> <tmpl_if name="DKIM_VISIBLE"> - <label for="dkim" class="col-sm-3 control-label">{tmpl_var name='dkim_txt'}</label> - <input type="checkbox" disabled readonly checked><input name="dkim" type="hidden" maxlength="255" type="text"/> + <div class="form-group"> + <label for="dkim" class="col-sm-3 control-label">{tmpl_var name='dkim_txt'}</label> + <div class="col-sm-9"><input type="checkbox" disabled readonly checked><input name="dkim" type="hidden" maxlength="255" type="text"/></div></div> </tmpl_if> - + <tmpl_if name="DNSSEC_VISIBLE"> + <div class="form-group"> + <label for="dkim" class="col-sm-3 control-label">{tmpl_var name='dnssec_txt'}</label> + <div class="col-sm-9"><input type="checkbox" name="dnssec" value="Y"></div></div> + </tmpl_if> + <input type="hidden" name="create" value="0" /> -- GitLab