Skip to content

Commit d606add

Browse files
author
Florian Schaal
committed
add server for last commit
1 parent e2940f4 commit d606add

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

server/conf/bind_pri.domain.master

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ $TTL {tmpl_var name='ttl'}
2020
<tmpl_if name="type" op='==' value='ALIAS'>
2121
{tmpl_var name='name'} {tmpl_var name='ttl'} CNAME {tmpl_var name='data'}
2222
</tmpl_if>
23+
<tmpl_if name="type" op='==' value='CAA'>
24+
{tmpl_var name='name'} {tmpl_var name='ttl'} CAA {tmpl_var name='data'}
25+
</tmpl_if>
2326
<tmpl_if name="type" op='==' value='CNAME'>
2427
{tmpl_var name='name'} {tmpl_var name='ttl'} CNAME {tmpl_var name='data'}
2528
</tmpl_if>
@@ -53,5 +56,9 @@ $TTL {tmpl_var name='ttl'}
5356
<tmpl_if name="type" op='==' value='TXT'>
5457
{tmpl_var name='name'} {tmpl_var name='ttl'} TXT "{tmpl_var name='data'}"
5558
</tmpl_if>
59+
<tmpl_if name="type" op='==' value='TYPE257'>
60+
{tmpl_var name='name'} {tmpl_var name='ttl'} TYPE257 {tmpl_var name='data'}
61+
</tmpl_if>
5662
</tmpl_loop>
5763

64+

server/plugins-available/bind_plugin.inc.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,17 @@ function soa_update($event_name, $data) {
236236
//* load the server configuration options
237237
$dns_config = $app->getconf->get_server_config($conf["server_id"], 'dns');
238238

239+
//* Get the bind version
240+
$bind_caa = false;
241+
$bind = explode("\n", shell_exec('which named bind'));
242+
$bind = reset($bind);
243+
if(is_executable($bind)) {
244+
exec($bind . ' -v 2>&1', $tmp);
245+
$bind_caa = @(version_compare($tmp[0],"BIND 9.9.6", '>='))?true:false;
246+
unset($tmp);
247+
}
248+
unset($bind);
249+
239250
//* Write the domain file
240251
if(!empty($data['new']['id'])) {
241252
$tpl = new tpl();
@@ -253,6 +264,19 @@ function soa_update($event_name, $data) {
253264
if($records[$i]['type'] == 'TXT' && strlen($records[$i]['data']) > 255) {
254265
$records[$i]['data'] = implode('" "',str_split( $records[$i]['data'], 255));
255266
}
267+
//* CAA-Records - Type257 for older bind-versions
268+
if($records[$i]['type'] == 'CAA' && !$bind_caa) {
269+
$records[$i]['type'] = 'TYPE257';
270+
$temp = explode(' ', $records[$i]['data']);
271+
unset($temp[0]);
272+
$records[$i]['data'] = implode(' ', $temp);
273+
$data_new = str_replace(array('"', ' '), '', $records[$i]['data']);
274+
$hex = unpack('H*', $data_new);
275+
$hex[1] = '0005'.strtoupper($hex[1]);
276+
$length = strlen($hex[1])/2;
277+
$data_new = "\# $length $hex[1]";
278+
$records[$i]['data'] = $data_new;
279+
}
256280
}
257281
}
258282
$tpl->setLoop('zones', $records);

0 commit comments

Comments
 (0)