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

add server for last commit

parent e2940f4c
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,9 @@ $TTL {tmpl_var name='ttl'}
<tmpl_if name="type" op='==' value='ALIAS'>
{tmpl_var name='name'} {tmpl_var name='ttl'} CNAME {tmpl_var name='data'}
</tmpl_if>
<tmpl_if name="type" op='==' value='CAA'>
{tmpl_var name='name'} {tmpl_var name='ttl'} CAA {tmpl_var name='data'}
</tmpl_if>
<tmpl_if name="type" op='==' value='CNAME'>
{tmpl_var name='name'} {tmpl_var name='ttl'} CNAME {tmpl_var name='data'}
</tmpl_if>
......@@ -53,5 +56,9 @@ $TTL {tmpl_var name='ttl'}
<tmpl_if name="type" op='==' value='TXT'>
{tmpl_var name='name'} {tmpl_var name='ttl'} TXT "{tmpl_var name='data'}"
</tmpl_if>
<tmpl_if name="type" op='==' value='TYPE257'>
{tmpl_var name='name'} {tmpl_var name='ttl'} TYPE257 {tmpl_var name='data'}
</tmpl_if>
</tmpl_loop>
......@@ -236,6 +236,17 @@ class bind_plugin {
//* load the server configuration options
$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
//* Get the bind version
$bind_caa = false;
$bind = explode("\n", shell_exec('which named bind'));
$bind = reset($bind);
if(is_executable($bind)) {
exec($bind . ' -v 2>&1', $tmp);
$bind_caa = @(version_compare($tmp[0],"BIND 9.9.6", '>='))?true:false;
unset($tmp);
}
unset($bind);
//* Write the domain file
if(!empty($data['new']['id'])) {
$tpl = new tpl();
......@@ -253,6 +264,19 @@ class bind_plugin {
if($records[$i]['type'] == 'TXT' && strlen($records[$i]['data']) > 255) {
$records[$i]['data'] = implode('" "',str_split( $records[$i]['data'], 255));
}
//* CAA-Records - Type257 for older bind-versions
if($records[$i]['type'] == 'CAA' && !$bind_caa) {
$records[$i]['type'] = 'TYPE257';
$temp = explode(' ', $records[$i]['data']);
unset($temp[0]);
$records[$i]['data'] = implode(' ', $temp);
$data_new = str_replace(array('"', ' '), '', $records[$i]['data']);
$hex = unpack('H*', $data_new);
$hex[1] = '0005'.strtoupper($hex[1]);
$length = strlen($hex[1])/2;
$data_new = "\# $length $hex[1]";
$records[$i]['data'] = $data_new;
}
}
}
$tpl->setLoop('zones', $records);
......
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