Some more work on the dns module. The only thing not working for some reason is the zone.slae.erb for an unknown reason.

This commit is contained in:
svimes 2012-02-05 21:29:13 +02:00
parent da1eef4333
commit bd4cc55ce1
6 changed files with 50 additions and 45 deletions

View file

@ -2,26 +2,25 @@
; BIND data file for <%= zone %>
;
;
$TTL 3600
$ORIGIN <%= zone %>.
<% master.each do |m| -%>
@ IN SOA <%= m['name'] %>. root.<%= zone %>. (
<% master.each_pair do |k, v| %>
@ IN SOA <%= v['ns'] %>. hostmaster.<%= zone %>. (
<%= Time.now.to_i %> ; Serial
3600 ; Refresh
7200 ; Retry
604800 ; Expire
86400 ) ; Negative Cache TTL
<% end -%>
;
<% master.each do |m| -%>
@ IN NS <%= m['name'] %>.
@ IN NS <%= v['ns'] %>.
<% end -%>
<% if has_variable?(slaves) -%>
<% slaves.each do |slave| -%>
@ IN NS <%= slave['name'] %>.
<% end -%>
<% slaves.each_pair do |k, v| -%>
@ IN NS <%= v['ns'] %>.
<% end -%>
<% if zone.match(/\//) %>
$INCLUDE <%= zonedir %>/db.<%= zone.sub(/\//, '-') %>-dynamic
$INCLUDE <%= zonedir %>/db.<%= zone.sub(/\//, '-') %>-static
<% else %>
$INCLUDE <%= zonedir %>/db.<%= zone %>-dynamic
$INCLUDE <%= zonedir %>/db.<%= zone %>-static
<% end -%>

View file

@ -19,7 +19,11 @@ acl "trusted" {
};
<% dns_zones.each do |zone| -%>
include "/etc/bind/zone.<%= zone %>";
<% if zone.match(/\//) %>
include "/etc/bind/zone.<%= zone.sub(/\//, '-') %>";
<% else %>
include "/etc/bind/zone.<%= zone %>";
<% end -%>
<% end -%>
// Consider adding the 1918 zones here, if they are not used in your

View file

@ -1,10 +1,7 @@
options {
listen-on {
<%= ipaddr %>;
};
allow-transfer {
xfer;
};
listen-on { any; };
listen-on-v6 { none; };
allow-transfer { xfer; };
allow-recursion {
trusted;
};
@ -28,6 +25,6 @@ options {
// };
auth-nxdomain no; # conform to RFC1035
version ""; // remove this to allow version queries
};

View file

@ -1,12 +1,14 @@
zone "<%= zone %>" {
type master;
file "<%= zonedir %>/db.<%= zone %>";
<% if not slaves.empty? -%>
allow-transfer {
<% slaves.each do |slave| -%>
<%= slave %>;
<% end -%>
};
allow-update { none;};
type master;
<% if zone.match(/\//) %>
file "<%= zonedir %>/db.<%= zone.sub(/\//, '-') %>";
<% else %>
file "<%= zonedir %>/db.<%= zone %>";
<% end -%>
allow-transfer {
<% slaves.each_pair do |k, v| -%>
<%= v['ip'] %>;
<% end -%>
};
allow-update { none; };
};

View file

@ -1,10 +1,12 @@
zone "<%= zone %>" {
type slave;
file "<%= zonedir %>/db.<%= zone %>";
masters {
<% master.each do |m| -%>
<%= m %>;
<% end -%>
allow-transfer { none; };
};
type slave;
<% if zone.match(/\//) %>
file "<%= zonedir %>/db.<%= zone.sub(/\//, '-') %>";
<% else %>
file "<%= zonedir %>/db.<%= zone %>";
<% end -%>
<% master.each_pair do |k, v| -%>
masters { <% v['ip'] %> };
<% end -%>
allow-transfer { none; };
};