...
 
Commits (11)
#!/bin/bash
#### Config ################################
DBHOST="localhost"
DBUSER="powerdns"
DBPASS="password"
DATABASE="powerdns"
DEBUG="no"
#### End of Config #########################
REQUIRED_COMMANDS="
mysql
host
grep
awk
tail
"
# print debug messages to STDERR
function debug {
if [ "${DEBUG}" == "yes" ] ; then
echo "DEBUG: $@" >&2
fi
}
for CMD in ${REQUIRED_COMMANDS} ; do
CMDNAME=`echo ${CMD} | awk '{print toupper($1) }' | sed -e s@"-"@""@g`
export $(eval "echo ${CMDNAME}")=`which ${CMD} 2>/dev/null`
if [ -z "${!CMDNAME}" ] ; then
debug "Command: ${CMD} not found!"
exit 1
else
debug "Found command $(echo $CMDNAME) in ${!CMDNAME}"
fi
done
MYSQLCMD="${MYSQL} -h ${DBHOST} -u ${DBUSER} -p${DBPASS} --skip-column-name --silent -e"
check() {
AUTH=`${HOST} -t SOA ${2} ${1} | ${TAIL} -n1 | ${GREP} "has no SOA record"`
if [ "${AUTH}" == "${2} has no SOA record" ]; then
debug "Server ${1} has no SOA for ${2} - removing zone..."
DOMAIN_ID=`${MYSQLCMD} "USE ${DATABASE}; SELECT id FROM domains WHERE name='${2}' AND type='SLAVE' AND master='${1}' LIMIT 1;"`
${MYSQLCMD} "USE ${DATABASE}; DELETE FROM records WHERE domain_id='${DOMAIN_ID}';"
${MYSQLCMD} "USE ${DATABASE}; DELETE FROM domains WHERE id='${DOMAIN_ID}';"
fi
}
MASTERS=(`${MYSQLCMD} "USE ${DATABASE}; SELECT DISTINCT ip FROM supermasters;"`)
for m in "${MASTERS[@]}"; do
NAMES=(`${MYSQLCMD} "USE ${DATABASE}; SELECT name FROM domains WHERE type = 'SLAVE' AND master = '${m}';"`)
for d in "${NAMES[@]}"; do
check ${m} ${d}
done
done
......@@ -228,8 +228,10 @@ if($conf['services']['mail'] == true) {
$inst->configure_spamassassin();
//** Configure Amavis
swriteln('Configuring Amavisd');
$inst->configure_amavis();
if($conf['amavis']['installed'] == true) {
swriteln('Configuring Amavisd');
$inst->configure_amavis();
}
//** Configure Getmail
swriteln('Configuring Getmail');
......
......@@ -216,8 +216,10 @@ if($install_mode == 'standard') {
$inst->configure_spamassassin();
//* Configure Amavis
swriteln('Configuring Amavisd');
$inst->configure_amavis();
if($conf['amavis']['installed'] == true) {
swriteln('Configuring Amavisd');
$inst->configure_amavis();
}
//* Configure Getmail
swriteln('Configuring Getmail');
......
......@@ -289,8 +289,10 @@ if($reconfigure_services_answer == 'yes') {
$inst->configure_spamassassin();
//** Configure Amavis
swriteln('Configuring Amavisd');
$inst->configure_amavis();
if($conf['amavis']['installed'] == true) {
swriteln('Configuring Amavisd');
$inst->configure_amavis();
}
//** Configure Getmail
swriteln('Configuring Getmail');
......
......@@ -149,7 +149,7 @@ class mail_user_filter_plugin {
} elseif ($page_form->dataRecord["op"] == 'is') {
$content .= $searchterm."$";
} elseif ($page_form->dataRecord["op"] == 'begins') {
$content .= " ".$searchterm."";
$content .= "^".$searchterm.".*";
} elseif ($page_form->dataRecord["op"] == 'ends') {
$content .= ".*".$searchterm."$";
}
......
......@@ -202,6 +202,8 @@ if($_POST['create'] == 1) {
if(isset($_POST['ip']) && $_POST['ip'] == '') $error .= $app->lng('error_ip_empty').'<br />';
if(isset($_POST['ipv6']) && $_POST['ipv6'] == '') $error .= $app->lng('error_ipv6_empty').'<br />';
if(isset($_POST['ns1']) && $_POST['ns1'] == '') $error .= $app->lng('error_ns1_empty').'<br />';
elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
......@@ -238,6 +240,7 @@ if($_POST['create'] == 1) {
$tpl_content = $template_record['template'];
if($_POST['domain'] != '') $tpl_content = str_replace('{DOMAIN}', $_POST['domain'], $tpl_content);
if($_POST['ip'] != '') $tpl_content = str_replace('{IP}', $_POST['ip'], $tpl_content);
if($_POST['ipv6'] != '') $tpl_content = str_replace('{IPV6}',$_POST['ipv6'],$tpl_content);
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);
......
......@@ -74,7 +74,7 @@ $form["tabs"]['template'] = array (
'formtype' => 'CHECKBOXARRAY',
'default' => '',
'separator' => ',',
'value' => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM (use TXT|{DOMAIN}.|{DKIM} in your Template)'),
'value' => array('DOMAIN' => 'Domain', 'IP' => 'IP Address', 'IPV6' => 'IPv6 Address', 'NS1' => 'NS 1', 'NS2' => 'NS 2', 'EMAIL' => 'Email', 'DKIM' => 'DKIM (use TXT|{DOMAIN}.|{DKIM} in your Template)'),
'validators' => array ( 0 => array ('type' => 'CUSTOM',
'class' => 'validate_dkim',
'function' => 'check_template',
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Address';
$wb['ipv6_txt'] = 'IPv6 Address';
$wb['error_origin_empty'] = 'Origin empty.';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'EMail empty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Емайл';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP адрес';
$wb['ipv6_txt'] = 'IPv6 адрес';
$wb['error_origin_empty'] = 'Origin empty.';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'Полето с имейла е празно';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Correio';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Endereço IP';
$wb['ipv6_txt'] = 'Endereço IPv6';
$wb['error_origin_empty'] = 'Origem em branco.';
$wb['error_ns_empty'] = 'NS vazio.';
$wb['error_mbox_empty'] = 'Mbox vazia.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum vazio.';
$wb['error_ttl_empty'] = 'TTL vazio.';
$wb['error_domain_empty'] = 'Domínio vazio';
$wb['error_ip_empty'] = 'IP vazio.';
$wb['error_ipv6_empty'] = 'IPv6 vazio.';
$wb['error_ns1_empty'] = 'NS1 vazio.';
$wb['error_ns2_empty'] = 'NS2 vazio.';
$wb['error_email_empty'] = 'Correio vazio.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'E-mail';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP adresa';
$wb['ipv6_txt'] = 'IPv6 adresa';
$wb['error_origin_empty'] = 'Zdroj je prázdný.';
$wb['error_ns_empty'] = 'NS je prázdný.';
$wb['error_mbox_empty'] = 'Mbox je prázdný.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum je prázdný.';
$wb['error_ttl_empty'] = 'TTL je prázdný.';
$wb['error_domain_empty'] = 'Doména je prázdná';
$wb['error_ip_empty'] = 'IP adresa je prázdná.';
$wb['error_ipv6_empty'] = 'IPv6 adresa je prázdná.';
$wb['error_ns1_empty'] = 'NS1 je prázdný.';
$wb['error_ns2_empty'] = 'NS2 je prázdný.';
$wb['error_email_empty'] = 'E-mail je prázdný.';
......
......@@ -13,6 +13,7 @@ $wb['dkim_txt'] = 'DKIM aktiviert';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Adresse';
$wb['ipv6_txt'] = 'IPv6 Adresse';
$wb['error_origin_empty'] = 'Quelle ist leer.';
$wb['error_ns_empty'] = 'NS ist leer.';
$wb['error_mbox_empty'] = 'E-Mail Adresse ist leer.';
......@@ -23,6 +24,7 @@ $wb['error_minimum_empty'] = 'Minimum leer.';
$wb['error_ttl_empty'] = 'TTL ist leer.';
$wb['error_domain_empty'] = 'Domain ist leer';
$wb['error_ip_empty'] = 'IP Adresse ist leer.';
$wb['error_ipv6_empty'] = 'IPv6 Adresse ist leer.';
$wb['error_ns1_empty'] = 'NS1 ist leer.';
$wb['error_ns2_empty'] = 'NS2 ist leer.';
$wb['error_email_empty'] = 'E-Mail Adresse ist leer.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Διεύθυνση IP';
$wb['ipv6_txt'] = 'Διεύθυνση IPv6';
$wb['error_origin_empty'] = 'Δεν έχει οριστεί το Origin.';
$wb['error_ns_empty'] = 'Δεν έχει οριστεί ο NS.';
$wb['error_mbox_empty'] = 'Δεν έχει οριστεί το Mbox.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Δεν έχει οριστεί το Minimum.';
$wb['error_ttl_empty'] = 'Δεν έχει οριστεί το TTL.';
$wb['error_domain_empty'] = 'Δεν έχει οριστεί το Domain';
$wb['error_ip_empty'] = 'Δεν έχει οριστεί ή IP.';
$wb['error_ipv6_empty'] = 'Δεν έχει οριστεί ή IPv6.';
$wb['error_ns1_empty'] = 'Δεν έχει οριστεί ο NS1.';
$wb['error_ns2_empty'] = 'Δεν έχει οριστεί ο NS2.';
$wb['error_email_empty'] = 'Δεν έχει οριστεί το EMail.';
......
......@@ -13,6 +13,7 @@ $wb['dkim_txt'] = 'DKIM enabled';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Address';
$wb['ipv6_txt'] = 'IPv6 Address';
$wb['error_origin_empty'] = 'Origin empty.';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -23,6 +24,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'Email empty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Correo';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Dirección IP';
$wb['ipv6_txt'] = 'Dirección IPv6';
$wb['error_origin_empty'] = 'El campo Origen está vacío.';
$wb['error_ns_empty'] = 'El campo NS está vacío.';
$wb['error_mbox_empty'] = 'El campo Mbox está vacío.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'El campo Mínimo está vacío.';
$wb['error_ttl_empty'] = 'El campo TTL está vacío.';
$wb['error_domain_empty'] = 'El campo Dominio está vacío.';
$wb['error_ip_empty'] = 'El campo IP está vacío.';
$wb['error_ipv6_empty'] = 'El campo IPv6 está vacío.';
$wb['error_ns1_empty'] = 'El campo NS1 está vacío.';
$wb['error_ns2_empty'] = 'El campo NS2 está vacío.';
$wb['error_email_empty'] = 'El campo Correo electrónico está vacío.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Vastuuhenkilön sähköpostiosoite';
$wb['ns1_txt'] = '1. nimipalvelin';
$wb['ns2_txt'] = '2. nimipalvelin';
$wb['ip_txt'] = 'IP-osoite';
$wb['ipv6_txt'] = 'IPv6-osoite';
$wb['error_origin_empty'] = 'Verkkotunnusta ei ole annettu.';
$wb['error_ns_empty'] = 'NS-kenttä tyhjä.';
$wb['error_mbox_empty'] = 'Mbox-kenttä tyhjä.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum-kenttä tyhjä.';
$wb['error_ttl_empty'] = 'TTL-kenttä tyhjä.';
$wb['error_domain_empty'] = 'Domain-kenttä tyhjä';
$wb['error_ip_empty'] = 'IP-kenttä tyhjä.';
$wb['error_ipv6_empty'] = 'IPv6-kenttä tyhjä.';
$wb['error_ns1_empty'] = 'NS1-kenttä tyhjä.';
$wb['error_ns2_empty'] = 'NS2-kenttä tyhjä.';
$wb['error_email_empty'] = 'EMail-kenttä tyhjä.';
......
......@@ -10,6 +10,7 @@ $wb['dkim_txt'] = 'DKIM activé';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Adresse IP';
$wb['ipv6_txt'] = 'Adresse IPv6';
$wb['error_origin_empty'] = 'Origine vide.';
$wb['error_ns_empty'] = 'NS vide.';
$wb['error_mbox_empty'] = 'Mbox vide.';
......@@ -20,6 +21,7 @@ $wb['error_minimum_empty'] = 'Minimum vide.';
$wb['error_ttl_empty'] = 'TTL vide.';
$wb['error_domain_empty'] = 'Domaine vide';
$wb['error_ip_empty'] = 'IP vide.';
$wb['error_ipv6_empty'] = 'IPv6 vide.';
$wb['error_ns1_empty'] = 'NS1 vide.';
$wb['error_ns2_empty'] = 'NS2 vide.';
$wb['error_email_empty'] = 'Email vide.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP adresa';
$wb['ipv6_txt'] = 'IPv6 adresa';
$wb['error_origin_empty'] = 'Prazno polje: Origin.';
$wb['error_ns_empty'] = 'Prazno polje: NS.';
$wb['error_mbox_empty'] = 'Prazno polje: Mbox.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Prazno polje: Minimum.';
$wb['error_ttl_empty'] = 'Prazno polje: TTL.';
$wb['error_domain_empty'] = 'Prazno polje: Domena.';
$wb['error_ip_empty'] = 'Prazno polje: IP adresa.';
$wb['error_ipv6_empty'] = 'Prazno polje: IPv6 adresa.';
$wb['error_ns1_empty'] = 'Prazno polje: NS1.';
$wb['error_ns2_empty'] = 'Prazno polje: NS1.';
$wb['error_email_empty'] = 'Prazno polje: Email.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Address';
$wb['ipv6_txt'] = 'IPv6 Address';
$wb['error_origin_empty'] = 'Origin empty.';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'EMail empty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Alamat IP';
$wb['ipv6_txt'] = 'Alamat IPv6';
$wb['error_origin_empty'] = 'Origin kosong.';
$wb['error_ns_empty'] = 'NS kosong.';
$wb['error_mbox_empty'] = 'Mbox kosong.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum kosong.';
$wb['error_ttl_empty'] = 'TTL kosong.';
$wb['error_domain_empty'] = 'Domain kosong';
$wb['error_ip_empty'] = 'IP kosong.';
$wb['error_ipv6_empty'] = 'IPv6 kosong.';
$wb['error_ns1_empty'] = 'NS1 kosong.';
$wb['error_ns2_empty'] = 'NS2 kosong.';
$wb['error_email_empty'] = 'EMail kosong.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Address';
$wb['ipv6_txt'] = 'IPv6 Address';
$wb['error_origin_empty'] = 'Origin empty.';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'EMail empty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'メールアドレス';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IPアドレス';
$wb['ipv6_txt'] = 'IPv6アドレス';
$wb['error_origin_empty'] = 'origin を指定してください。';
$wb['error_ns_empty'] = 'NS を指定してください。';
$wb['error_mbox_empty'] = 'mbox を指定してください。';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'minimum を指定してください。';
$wb['error_ttl_empty'] = 'ttl を指定してください。';
$wb['error_domain_empty'] = 'ドメインを指定してください。';
$wb['error_ip_empty'] = 'IP を指定してください。';
$wb['error_ipv6_empty'] = 'IPv6 を指定してください。';
$wb['error_ns1_empty'] = 'NS1 を指定してください。';
$wb['error_ns2_empty'] = 'NS2 を指定してください。';
$wb['error_email_empty'] = 'メールアドレスを指定してください';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'E-mail';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP-adres';
$wb['ipv6_txt'] = 'IPv6-adres';
$wb['error_origin_empty'] = 'Oorspong is niet ingvuld.';
$wb['error_ns_empty'] = 'NS is niet ingvuld.';
$wb['error_mbox_empty'] = 'Mbox is niet ingvuld.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum is niet ingvuld.';
$wb['error_ttl_empty'] = 'TTL is niet ingvuld.';
$wb['error_domain_empty'] = 'Domein is niet ingvuld';
$wb['error_ip_empty'] = 'IP is niet ingvuld.';
$wb['error_ipv6_empty'] = 'IPv6 is niet ingvuld.';
$wb['error_ns1_empty'] = 'NS1 is niet ingvuld.';
$wb['error_ns2_empty'] = 'NS2 is niet ingvuld.';
$wb['error_email_empty'] = 'E-mail is niet ingvuld.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'E-mail';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Adres IP';
$wb['ipv6_txt'] = 'Adres IPv6';
$wb['error_origin_empty'] = 'Źródło jest puste.';
$wb['error_ns_empty'] = 'NS jest pusty.';
$wb['error_mbox_empty'] = 'Mbox jest pusty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum jest puste.';
$wb['error_ttl_empty'] = 'TTL jest puste.';
$wb['error_domain_empty'] = 'Domena jest pusta.';
$wb['error_ip_empty'] = 'IP jest puste.';
$wb['error_ipv6_empty'] = 'IPv6 jest puste.';
$wb['error_ns1_empty'] = 'NS1 jest puste.';
$wb['error_ns2_empty'] = 'NS2 jest puste.';
$wb['error_email_empty'] = 'E-mail jest pusty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Correio';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'Endereço IP';
$wb['ipv6_txt'] = 'Endereço IPv6';
$wb['error_origin_empty'] = 'Origem em branco.';
$wb['error_ns_empty'] = 'NS vazio.';
$wb['error_mbox_empty'] = 'Mbox vazia.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum vazio.';
$wb['error_ttl_empty'] = 'TTL vazio.';
$wb['error_domain_empty'] = 'Domínio vazio';
$wb['error_ip_empty'] = 'IP vazio.';
$wb['error_ipv6_empty'] = 'IPv6 vazio.';
$wb['error_ns1_empty'] = 'NS1 vazio.';
$wb['error_ns2_empty'] = 'NS2 vazio.';
$wb['error_email_empty'] = 'Correio vazio.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Address';
$wb['ipv6_txt'] = 'IPv6 Address';
$wb['error_origin_empty'] = 'Origine nula';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'EMail empty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'E-mail';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP-адрес';
$wb['ipv6_txt'] = 'IPv6-адрес';
$wb['error_origin_empty'] = 'Пустой Origin.';
$wb['error_ns_empty'] = 'Пустой NS.';
$wb['error_mbox_empty'] = 'Пустой Mbox.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Пустой Minimum.';
$wb['error_ttl_empty'] = 'Пустой TTL.';
$wb['error_domain_empty'] = 'Пустой Domain';
$wb['error_ip_empty'] = 'Пустой IP.';
$wb['error_ipv6_empty'] = 'Пустой IPv6.';
$wb['error_ns1_empty'] = 'Пустой NS1.';
$wb['error_ns2_empty'] = 'Пустой NS2.';
$wb['error_email_empty'] = 'Пустой E-Mail.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Address';
$wb['ipv6_txt'] = 'IPv6 Address';
$wb['error_origin_empty'] = 'Origin empty.';
$wb['error_ns_empty'] = 'NS empty.';
$wb['error_mbox_empty'] = 'Mbox empty.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum empty.';
$wb['error_ttl_empty'] = 'TTL empty.';
$wb['error_domain_empty'] = 'Domain empty';
$wb['error_ip_empty'] = 'IP empty.';
$wb['error_ipv6_empty'] = 'IPv6 empty.';
$wb['error_ns1_empty'] = 'NS1 empty.';
$wb['error_ns2_empty'] = 'NS2 empty.';
$wb['error_email_empty'] = 'EMail empty.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Adresa';
$wb['ipv6_txt'] = 'IPv6 Adresa';
$wb['error_origin_empty'] = 'Pôvod prázdny.';
$wb['error_ns_empty'] = 'NS prázdny.';
$wb['error_mbox_empty'] = 'Mbox prázdny.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum prázdne.';
$wb['error_ttl_empty'] = 'TTL prázdne.';
$wb['error_domain_empty'] = 'Doména prázdna.';
$wb['error_ip_empty'] = 'IP prázdna.';
$wb['error_ipv6_empty'] = 'IPv6 prázdna.';
$wb['error_ns1_empty'] = 'NS1 prázdne.';
$wb['error_ns2_empty'] = 'NS2 prázdne.';
$wb['error_email_empty'] = 'EMail prázdny.';
......
......@@ -9,6 +9,7 @@ $wb['email_txt'] = 'Email';
$wb['ns1_txt'] = 'NS 1';
$wb['ns2_txt'] = 'NS 2';
$wb['ip_txt'] = 'IP Adresi';
$wb['ipv6_txt'] = 'IPv6 Adresi';
$wb['error_origin_empty'] = 'Origin boş.';
$wb['error_ns_empty'] = 'NS boş.';
$wb['error_mbox_empty'] = 'Mbox boş.';
......@@ -19,6 +20,7 @@ $wb['error_minimum_empty'] = 'Minimum boş.';
$wb['error_ttl_empty'] = 'TTL boş.';
$wb['error_domain_empty'] = 'Domain boş';
$wb['error_ip_empty'] = 'IP boş.';
$wb['error_ipv6_empty'] = 'IPv6 boş.';
$wb['error_ns1_empty'] = 'NS1 boş.';
$wb['error_ns2_empty'] = 'NS2 boş.';
$wb['error_email_empty'] = 'EMail boş.';
......
......@@ -60,6 +60,12 @@
<input name="ip" id="ip" value="{tmpl_var name='ip'}" size="30" maxlength="255" type="text" class="textInput" />
</div>
</tmpl_if>
<tmpl_if name="IPV6_VISIBLE">
<div class="ctrlHolder">
<label for="ipv6">{tmpl_var name='ipv6_txt'}</label>
<input name="ipv6" id="ipv6" value="{tmpl_var name='ipv6'}" size="30" maxlength="255" type="text" class="textInput" />
</div>
</tmpl_if>
<tmpl_if name="NS1_VISIBLE">
<div class="ctrlHolder">
<label for="ns1">{tmpl_var name='ns1_txt'}</label>
......
......@@ -49,6 +49,12 @@
<input name="ip" id="ip" value="{tmpl_var name='ip'}" size="30" maxlength="255" type="text" class="textInput" />
</div>
</tmpl_if>
<tmpl_if name="IPV6_VISIBLE">
<div class="ctrlHolder">
<label for="ipv6">{tmpl_var name='ipv6_txt'}</label>
<input name="ipv6" id="ipv6" value="{tmpl_var name='ipv6'}" size="30" maxlength="255" type="text" class="textInput" />
</div>
</tmpl_if>
<tmpl_if name="NS1_VISIBLE">
<div class="ctrlHolder">
<label for="ns1">{tmpl_var name='ns1_txt'}</label>
......
......@@ -98,8 +98,9 @@ class maildeliver_plugin {
$app->log("Mailfilter config has been changed", LOGLEVEL_DEBUG);
$sieve_file = $data["new"]["maildir"].'/.sieve';
$sieve_file_isp = $data["new"]["maildir"].'/sieve/ispconfig.sieve';
if(is_file($sieve_file)) unlink($sieve_file) or $app->log("Unable to delete file: $sieve_file", LOGLEVEL_WARN);
if(is_file($sieve_file_isp)) unlink($sieve_file_isp) or $app->log("Unable to delete file: $sieve_file_isp", LOGLEVEL_WARN);
$app->load('tpl');
//* Select sieve filter file for dovecot version
......@@ -204,8 +205,20 @@ class maildeliver_plugin {
$tpl->setVar('addresses', $address_str);
file_put_contents($sieve_file, $tpl->grab());
if ( ! is_dir($data["new"]["maildir"].'/sieve/') ) {
$app->system->mkdirpath($data["new"]["maildir"].'/sieve/', 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
}
file_put_contents($sieve_file_isp, $tpl->grab());
chown($sieve_file_isp,$mail_config['mailuser_name']);
chgrp($sieve_file_isp,$mail_config['mailuser_group']);
chdir($data["new"]["maildir"]);
//* create symlink to activate sieve script
symlink("sieve/ispconfig.sieve", ".sieve") or $app->log("Unable to create symlink to active sieve filter", LOGLEVEL_WARN);
if (is_link(".sieve")) {
lchown(".sieve",$mail_config['mailuser_name']);
lchgrp(".sieve",$mail_config['mailuser_group']);
}
unset($tpl);
}
......@@ -215,7 +228,9 @@ class maildeliver_plugin {
global $app, $conf;
$sieve_file = $data["old"]["maildir"].'/.sieve';
$sieve_file_isp = $data["old"]["maildir"].'/sieve/ispconfig.sieve';
if(is_file($sieve_file)) unlink($sieve_file) or $app->log("Unable to delete file: $sieve_file", LOGLEVEL_WARN);
if(is_file($sieve_file_isp)) unlink($sieve_file_isp) or $app->log("Unable to delete file: $sieve_file_isp", LOGLEVEL_WARN);
}
......
......@@ -144,14 +144,17 @@ class powerdns_plugin {
if($ns == '') $ns = $origin;
$hostmaster = substr($data["new"]["mbox"], 0, -1);
$content = $ns.' '.$hostmaster.' 0';
$content = $ns.' '.$hostmaster.' '.$data["new"]["serial"].' '.$data["new"]["refresh"].' '.$data["new"]["retry"].' '.$data["new"]["expire"].' '.$data["new"]["minimum"];
$ttl = $data["new"]["ttl"];
$app->db->query("INSERT INTO powerdns.records (domain_id, name, type, content, ttl, prio, change_date, ispconfig_id) VALUES ($zone_id, '$origin', 'SOA', '$content', $ttl, 0, ".time().", $ispconfig_id)");
//* Reload powerdns nameserver
$app->services->restartServiceDelayed('powerdns', 'reload');
//* tell pdns to rediscover zones in DB
$this->zoneRediscover();
//* tell pdns to use 'pdnssec rectify' on the new zone
$this->rectifyZone($data);
//* tell pdns to send notify to slave
$this->notifySlave($data);
}
function soa_update($event_name, $data) {
......@@ -161,13 +164,10 @@ class powerdns_plugin {
if($data["old"]["active"] != 'Y') return;
$this->soa_delete($event_name, $data);
} else {
if($data["old"]["active"] == 'Y'){
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["id"]);
if($data["old"]["active"] == 'Y' && is_array($exists)){
$origin = substr($data["new"]["origin"], 0, -1);
$ispconfig_id = $data["new"]["id"];
$serial = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$ispconfig_id);
$serial_id = $serial["serial"];
//$app->db->query("UPDATE powerdns.domains SET name = '$origin', notified_serial = $serial_id WHERE ispconfig_id = $ispconfig_idi AND type = 'MASTER'");
//$app->db->query("UPDATE powerdns.domains SET name = '$origin' WHERE ispconfig_id = $ispconfig_id AND type = 'MASTER'");
if(substr($data["new"]["ns"], -1) == '.'){
$ns = substr($data["new"]["ns"], 0, -1);
......@@ -177,15 +177,14 @@ class powerdns_plugin {
if($ns == '') $ns = $origin;
$hostmaster = substr($data["new"]["mbox"], 0, -1);
//$content = $ns.' '.$hostmaster.' 0';
$content = $ns.' '.$hostmaster.' '.$serial_id.'';
$content = $ns.' '.$hostmaster.' '.$data["new"]["serial"].' '.$data["new"]["refresh"].' '.$data["new"]["retry"].' '.$data["new"]["expire"].' '.$data["new"]["minimum"];
$ttl = $data["new"]["ttl"];
$app->db->query("UPDATE powerdns.records SET name = '$origin', content = '$content', ttl = $ttl, change_date = ".time()." WHERE ispconfig_id = ".$data["new"]["id"]." AND type = 'SOA'");
//* Reload powerdns nameserver
$app->services->restartServiceDelayed('powerdns', 'reload');
//* tell pdns to use 'pdnssec rectify' on the new zone
$this->rectifyZone($data);
//* tell pdns to send notify to slave
$this->notifySlave($data);
} else {
$this->soa_insert($event_name, $data);
$ispconfig_id = $data["new"]["id"];
......@@ -197,10 +196,12 @@ class powerdns_plugin {
$this->rr_insert("dns_rr_insert", $data);
}
}
//* tell pdns to use 'pdnssec rectify' on the new zone
$this->rectifyZone($data);
//* tell pdns to send notify to slave
$this->notifySlave($data);
}
}
}
function soa_delete($event_name, $data) {
......@@ -210,10 +211,6 @@ class powerdns_plugin {
$zone_id = $zone["id"];
$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id");
$app->db->query("DELETE FROM powerdns.domains WHERE id = $zone_id");
//* Reload powerdns nameserver
$app->services->restartServiceDelayed('powerdns', 'reload');
}
function slave_insert($event_name, $data) {
......@@ -227,12 +224,10 @@ class powerdns_plugin {
$app->db->query("INSERT INTO powerdns.domains (name, type, master, ispconfig_id) VALUES ('$origin', 'SLAVE', '$master_ns', $ispconfig_id)");
//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
$zone_id = $app->db->insertID();
//* Reload powerdns nameserver
$app->services->restartServiceDelayed('powerdns', 'reload');
//* tell pdns to fetch zone from master server
$this->fetchFromMaster($data);
}
function slave_update($event_name, $data) {
......@@ -249,15 +244,14 @@ class powerdns_plugin {
$master_ns = $data["new"]["ns"];
$app->db->query("UPDATE powerdns.domains SET name = '$origin', type = 'SLAVE', master = '$master_ns' WHERE ispconfig_id=$ispconfig_id AND type = 'SLAVE'");
//$app->db->query("INSERT INTO powerdns.domains (name, type, ispconfig_id) VALUES ('$origin', 'NATIVE', $ispconfig_id)");
$zone_id = $app->db->insertID();
$zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$ispconfig_id." AND type = 'SLAVE'");
$zone_id = $zone["id"];
$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id AND ispconfig_id = 0");
//* Reload powerdns nameserver
$app->services->restartServiceDelayed('powerdns', 'reload');
//* tell pdns to fetch zone from master server
$this->fetchFromMaster($data);
} else {
$this->slave_insert($event_name, $data);
......@@ -274,15 +268,13 @@ class powerdns_plugin {
$zone_id = $zone["id"];
$app->db->query("DELETE FROM powerdns.records WHERE domain_id = $zone_id");
$app->db->query("DELETE FROM powerdns.domains WHERE id = $zone_id");
//* Reload powerdns nameserver
$app->services->restartServiceDelayed('powerdns', 'reload');
}
function rr_insert($event_name, $data) {
global $app, $conf;
if($data["new"]["active"] != 'Y') return;
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.records WHERE ispconfig_id = ".$data["new"]["id"]);
if ( is_array($exists) ) return;
$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
$origin = substr($zone["origin"], 0, -1);
......@@ -337,6 +329,8 @@ class powerdns_plugin {
$app->db->query("INSERT INTO powerdns.records (domain_id, name, type, content, ttl, prio, change_date, ispconfig_id) VALUES ($zone_id, '$name', '$type', '$content', $ttl, $prio, $change_date, $ispconfig_id)");
//* tell pdns to use 'pdnssec rectify' on the new zone
$this->rectifyZone($data);
}
function rr_update($event_name, $data) {
......@@ -346,7 +340,8 @@ class powerdns_plugin {
if($data["old"]["active"] != 'Y') return;
$this->rr_delete($event_name, $data);
} else {
if($data["old"]["active"] == 'Y'){
$exists = $app->db->queryOneRecord("SELECT * FROM powerdns.records WHERE ispconfig_id = ".$data["new"]["id"]);
if($data["old"]["active"] == 'Y' && is_array($exists)){
$zone = $app->db->queryOneRecord("SELECT * FROM dns_soa WHERE id = ".$data["new"]["zone"]);
$origin = substr($zone["origin"], 0, -1);
$powerdns_zone = $app->db->queryOneRecord("SELECT * FROM powerdns.domains WHERE ispconfig_id = ".$data["new"]["zone"]." AND type = 'MASTER'");
......@@ -397,14 +392,14 @@ class powerdns_plugin {
$prio = $data["new"]["aux"];
$change_date = time();
$ispconfig_id = $data["new"]["id"];
//echo "UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE id = $record_id";
$app->db->query("UPDATE powerdns.records SET name = '$name', type = '$type', content = '$content', ttl = $ttl, prio = $prio, change_date = ".time()." WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
//* tell pdns to use 'pdnssec rectify' on the new zone
$this->rectifyZone($data);
} else {
$this->rr_insert($event_name, $data);
}
}
}
function rr_delete($event_name, $data) {
......@@ -412,9 +407,80 @@ class powerdns_plugin {
$ispconfig_id = $data["old"]["id"];
$app->db->query("DELETE FROM powerdns.records WHERE ispconfig_id = $ispconfig_id AND type != 'SOA'");
}
function find_pdns_control() {
$output = array();
$retval = '';
exec("type -p pdns_control", $output, $retval);
if ($retval == 0 && is_file($output[0])){
return $output[0];
} else {
return false;
}
}
function find_pdns_pdnssec() {
$output = array();
$retval = '';
exec("type -p pdnssec", $output, $retval);
if ($retval == 0 && is_file($output[0])){
return $output[0];
} else {
return false;
}
}
function zoneRediscover() {
$pdns_control = $this->find_pdns_control();
if ( $pdns_control != false ) {
exec($pdns_control . ' rediscover');
}
}
function notifySlave($data) {
$pdns_control = $this->find_pdns_control();
if ( $pdns_control != false ) {
exec($pdns_control . ' notify ' . rtrim($data["new"]["origin"],"."));
}
}
function fetchFromMaster($data) {
$pdns_control = $this->find_pdns_control();
if ( $pdns_control != false ) {
exec($pdns_control . ' retrieve ' . rtrim($data["new"]["origin"],"."));
}
}
function get_pdns_version() {
$pdns_control = $this->find_pdns_control();
if ( $pdns_control != false ) {
$output=array();
$retval='';
exec($pdns_control . ' version',$output,$retval);
return $output[0];
} else {
//* fallback to version 2
return 2;
}
}
function rectifyZone($data) {
global $app, $conf;
if ( preg_match('/^3/',$this->get_pdns_version()) ) {
$pdns_pdnssec = $this->find_pdns_pdnssec();
if ( $pdns_pdnssec != false ) {
if (isset($data["new"]["origin"])) {
//* data has origin field only for SOA recordtypes
exec($pdns_pdnssec . ' rectify-zone ' . rtrim($data["new"]["origin"],"."));
} else {
// get origin from DB for all other recordtypes
$zn = $app->db->queryOneRecord("SELECT d.name AS name FROM powerdns.domains d, powerdns.records r WHERE r.ispconfig_id=".$data["new"]["id"]." AND r.domain_id = d.id");
exec($pdns_pdnssec . ' rectify-zone ' . trim($zn["name"]));
}
}
}
}
} // end class
......