Skip to content
Snippets Groups Projects
Commit dd1a3355 authored by Florian Schaal's avatar Florian Schaal
Browse files

allow dkim-records if there is no maildomain (#4626)

parent fcc522b8
No related branches found
No related tags found
No related merge requests found
Showing
with 66 additions and 13 deletions
...@@ -72,16 +72,26 @@ class page_action extends tform_actions { ...@@ -72,16 +72,26 @@ class page_action extends tform_actions {
parent::onShowNew(); parent::onShowNew();
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_GET['zone']); $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_GET['zone']);
$sql=$app->db->queryOneRecord("SELECT dkim_public, dkim_selector FROM mail_domain WHERE domain = ? AND dkim = 'y' AND " . $app->tform->getAuthSQL('r'), substr_replace($soa['origin'],'',-1)); $sql=$app->db->queryOneRecord("SELECT domain, dkim_public, dkim_selector, dkim FROM mail_domain WHERE domain = ? AND " . $app->tform->getAuthSQL('r'), substr_replace($soa['origin'],'',-1));
$public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$sql['dkim_public']); if(isset($sql['domain']) && $sql['domain'] != '') {
$app->tpl->setVar('public_key', $public_key); if($sql['dkim'] == 'y') {
$app->tpl->setVar('selector', $sql['dkim_selector']); $public_key=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$sql['dkim_public']);
$app->tpl->setVar('public_key', $public_key);
$app->tpl->setVar('selector', $sql['dkim_selector']);
} else {
//TODO: show warning - use mail_domain for dkim and enabled dkim
}
$app->tpl->setVar('edit_disabled', 1);
} else {
$app->tpl->setVar('edit_disabled', 0);
}
$app->tpl->setVar('name', $soa['origin']); $app->tpl->setVar('name', $soa['origin']);
} }
function onSubmit() { function onSubmit() {
global $app, $conf; global $app, $conf;
// Get the parent soa record of the domain // Get the parent soa record of the domain
$soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_POST["zone"]); $soa = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ? AND " . $app->tform->getAuthSQL('r'), $_POST["zone"]);
// Check if Domain belongs to user // Check if Domain belongs to user
...@@ -110,15 +120,20 @@ class page_action extends tform_actions { ...@@ -110,15 +120,20 @@ class page_action extends tform_actions {
$this->dataRecord['name']=$this->dataRecord['selector'].'._domainkey.'.$this->dataRecord['name']; $this->dataRecord['name']=$this->dataRecord['selector'].'._domainkey.'.$this->dataRecord['name'];
$this->dataRecord['ttl']=60; $this->dataRecord['ttl']=60;
} }
// Update the serial number and timestamp of the RR record // Update the serial number and timestamp of the RR record
$soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ?", $this->id); $soa = $app->db->queryOneRecord("SELECT serial FROM dns_rr WHERE id = ?", $this->id);
$this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]); $this->dataRecord["serial"] = $app->validate_dns->increase_serial($soa["serial"]);
$this->dataRecord["stamp"] = date('Y-m-d H:i:s'); $this->dataRecord["stamp"] = date('Y-m-d H:i:s');
// check for duplicate entry // check for duplicate entry
$check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ? AND type = ? AND data = ? AND name = ?", $this->dataRecord["zone"], $this->dataRecord["type"], $this->dataRecord["data"], $this->dataRecord['name']); $check=$app->db->queryOneRecord("SELECT * FROM dns_rr WHERE zone = ? AND type = ? AND data = ? AND name = ?", $this->dataRecord["zone"], $this->dataRecord["type"], $this->dataRecord["data"], $this->dataRecord['name']);
if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"]; if ($check!='') $app->tform->errorMessage .= $app->tform->wordbook["record_exists_txt"];
if (empty($this->dataRecord['data'])) $app->tform->errorMessage .= $app->tform->wordbook["dkim_disabled_txt"]; if (empty($this->dataRecord['data'])) $app->tform->errorMessage /= $app->tform->wordbook["dkim_disabled_txt"];
// validate selector and public-key
if (empty($this->dataRecord['selector'])) $app->tform->errorMessage .= '<br/>'.$app->tform->wordbook["dkim_selector_empty_txt"].'<br/>';
$this->dataRecord['data']=str_replace(array('-----BEGIN PUBLIC KEY-----','-----END PUBLIC KEY-----',"\r","\n"),'',$this->dataRecord['data']); // if the users entered his own key
parent::onSubmit(); parent::onSubmit();
} }
......
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'O limite de registros dns para esta conta foi alc ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'O limite de registros dns para esta conta foi alc
$wb['no_zone_perm'] = 'Você não tem permissão para adicionar registros a esta zona dns.'; $wb['no_zone_perm'] = 'Você não tem permissão para adicionar registros a esta zona dns.';
$wb['ttl_range_error'] = 'O ttl mínimo são 60 segundos.'; $wb['ttl_range_error'] = 'O ttl mínimo são 60 segundos.';
$wb['selector_txt'] = 'Seletor DKIM'; $wb['selector_txt'] = 'Seletor DKIM';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Byl dosažen max. počet DNS záznamů pro váš ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Byl dosažen max. počet DNS záznamů pro váš
$wb['no_zone_perm'] = 'Nemáte povolení k přidat záznam do této zóny DNS.'; $wb['no_zone_perm'] = 'Nemáte povolení k přidat záznam do této zóny DNS.';
$wb['ttl_range_error'] = 'Min. TTL doba je 60 sekund.'; $wb['ttl_range_error'] = 'Min. TTL doba je 60 sekund.';
$wb['selector_txt'] = 'DKIM selektor'; $wb['selector_txt'] = 'DKIM selektor';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Die max. Anzahl von DNS Eintraegen für den Accou ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'Die max. Anzahl von DNS Eintraegen für den Accou
$wb['no_zone_perm'] = 'Fehlende Berechtigung zum Hinzufuegen eines Eintrags zur DNS-Zone.'; $wb['no_zone_perm'] = 'Fehlende Berechtigung zum Hinzufuegen eines Eintrags zur DNS-Zone.';
$wb['ttl_range_error'] = 'Min. TTL time ist 60 Sekunden.'; $wb['ttl_range_error'] = 'Min. TTL time ist 60 Sekunden.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'öffentlicher Schlüssel fehlt';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector darf nicht leer sein';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb["limit_dns_record_txt"] = 'The max. number of DNS records for your account i
$wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.'; $wb["no_zone_perm"] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['record_exists_txt'] = 'El registro DNS ya existe'; ...@@ -8,4 +8,6 @@ $wb['record_exists_txt'] = 'El registro DNS ya existe';
$wb['selector_txt'] = 'Seleccionador DKIM'; $wb['selector_txt'] = 'Seleccionador DKIM';
$wb['ttl_range_error'] = 'El tiempo mín. de TTL es 60 segundos.'; $wb['ttl_range_error'] = 'El tiempo mín. de TTL es 60 segundos.';
$wb['ttl_txt'] = 'TTL'; $wb['ttl_txt'] = 'TTL';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['no_zone_perm'] = 'Vous n\'avez pas la permission d\'ajouter un enregistreme ...@@ -8,4 +8,6 @@ $wb['no_zone_perm'] = 'Vous n\'avez pas la permission d\'ajouter un enregistreme
$wb['ttl_range_error'] = 'Le temps minimum TTL est de 60 secondes.'; $wb['ttl_range_error'] = 'Le temps minimum TTL est de 60 secondes.';
$wb['selector_txt'] = 'Selecteur DKIM'; $wb['selector_txt'] = 'Selecteur DKIM';
$wb['dkim_disabled_txt'] = 'DKIM disabled for this mail-domain'; $wb['dkim_disabled_txt'] = 'DKIM disabled for this mail-domain';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i ...@@ -8,4 +8,6 @@ $wb['limit_dns_record_txt'] = 'The max. number of DNS records for your account i
$wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.'; $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DNS zone.';
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.'; $wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
$wb['selector_txt'] = 'DKIM-Selector'; $wb['selector_txt'] = 'DKIM-Selector';
$wb['data_error_empty'] = 'Public-Key missing';
$wb['dkim_selector_empty_txt'] = 'DKIM-Selector is empty';
?> ?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment