Skip to content
This repository has been archived by the owner on Sep 12, 2020. It is now read-only.

Commit

Permalink
initialize kasp and generate signing policy. refs #3
Browse files Browse the repository at this point in the history
  • Loading branch information
tobru committed Nov 25, 2015
1 parent 63ce39d commit f357310
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 11 deletions.
33 changes: 24 additions & 9 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
class knot::config {

# get variables from the toplevel manifest for usage in the template
$config_file = $::knot::main_config_file
$zones_file = $::knot::zones_config_file
$zone_storage = $::knot::zone_storage
$config_file = $::knot::main_config_file
$dnssec_enable = $::knot::dnssec_enable
$dnssec_keydir = $::knot::dnssec_keydir
$service_user = $::knot::service_user
$manage_zones = $::knot::manage_zones
$service_group = $::knot::service_group
$service_user = $::knot::service_user
$signing_policies = $::knot::signing_policies
$zone_defaults = $::knot::zone_defaults
$zone_options = $::knot::zone_options
$manage_zones = $::knot::manage_zones
$zone_options = $::knot::zone_options
$zone_storage = $::knot::zone_storage
$zones_file = $::knot::zones_config_file

# knot configuration sections
$acls = $::knot::acls
Expand Down Expand Up @@ -60,10 +61,24 @@
}

if $dnssec_enable {
$_signing_policy_names = keys($signing_policies)

file { $dnssec_keydir:
ensure => directory,
owner => $service_user,
group => $service_group,
ensure => directory,
owner => $service_user,
group => $service_group,
recurse => true,
} ->
exec { 'initialize_kasp':
command => '/usr/sbin/keymgr init',
creates => "${dnssec_keydir}/keys",
cwd => $dnssec_keydir,
} ->
::knot::signing_policy { $_signing_policy_names:
data => $signing_policies,
dnssec_keydir => $dnssec_keydir,
user => $service_user,
group => $service_group,
}
}

Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@
$server = $::knot::params::server,
$templates = undef,
$zones = {},
# DNSSEC
$signing_policies = {}
) inherits ::knot::params {

# package installation handling
Expand Down
4 changes: 2 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

# knot configuration defaults
# coming from the package installation
$dnssec_enable = false
$dnssec_enable = true
$main_config_file = '/etc/knot/knot.conf'
$zones_config_file = '/etc/knot/zones.conf'
$server = {
Expand All @@ -70,7 +70,7 @@
},
}
$zone_storage = '/var/lib/knot'
$dnssec_keydir = '/etc/knot/dnssec_keys.d'
$dnssec_keydir = '/var/lib/knot/kasp'
$manage_zones = true

}
21 changes: 21 additions & 0 deletions manifests/signing_policy.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
define knot::signing_policy (
$data,
$dnssec_keydir,
$user,
$group,
) {

$_algorithm = $data[$name]['algorithm']
$_zsk_size = $data[$name]['zsk-size']
$_ksk_size = $data[$name]['ksk-size']

exec { "create_signing_policy_${name}":
command => "/usr/sbin/keymgr policy add ${name} algorithm ${_algorithm} zsk-size ${_zsk_size} ksk-size ${_ksk_size}",
creates => "${dnssec_keydir}/policy_${name}.json",
cwd => $dnssec_keydir,
user => $user,
group => $group,
}

}

0 comments on commit f357310

Please sign in to comment.