Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support controls clause #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion manifests/server/conf.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Parameters:
# $acls:
# Hash of client ACLs, name as key and array of config lines. Default: empty
# $controls:
# Hash of administrative channels, inet as key and array of config lines. Default: empty
# $masters:
# Hash of master ACLs, name as key and array of config lines. Default: empty
# $listen_on_port:
Expand Down Expand Up @@ -66,6 +68,12 @@
# acls => {
# 'rfc1918' => [ '10/8', '172.16/12', '192.168/16' ],
# },
# controls => {
# '127.0.0.1' => {
# address_match_list => ['localhost'],
# keys_list => ['rndc-key'],
# port => 953,
# },
# masters => {
# 'mymasters' => [ '192.0.2.1', '198.51.100.1' ],
# },
Expand All @@ -80,7 +88,7 @@
# 'masters { mymasters; }',
# ],
# }
# keys => {
# keys => {
# 'example.org-tsig' => [
# 'algorithm hmac-md5',
# 'secret "aaabbbcccddd"',
Expand All @@ -90,6 +98,7 @@
#
define bind::server::conf (
$acls = {},
$controls = {},
$masters = {},
$listen_on_port = '53',
$listen_on_addr = [ '127.0.0.1' ],
Expand Down
Empty file added spec/fixtures/manifests/site.pp
Empty file.
18 changes: 18 additions & 0 deletions templates/named.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ acl <%= key %> {
};

<% end -%>
<% end -%>
<% unless @controls.empty? -%>
controls {
<% @controls.each do |inet, settings|
next unless settings.has_key? 'address_match_list' and settings['address_match_list'].is_a? Array
control_settings = ''
if settings.has_key? 'port'
control_settings << " port #{settings['port']}"
end
control_settings << " allow { #{settings['address_match_list'].join('; ')}; }"
if settings.has_key? 'keys_list' and settings['keys_list'].is_a? Array
control_settings << " keys { #{settings['keys_list'].join('; ')}; }"
end
-%>
inet <%= inet %><%= control_settings %>;
<% end -%>
};

<% end -%>
<% if [email protected]? -%>
<% @keys.sort_by {|key, value| key}.each do |key,value| -%>
Expand Down