diff --git a/README.md b/README.md index c3bf49b..8973432 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,9 @@ opendkim::trusted_hosts: opendkim::keys: - domain: mydomain.com selector: default + hash_algorithms: "sha1256" publickey: "p=yourPublicKey" + publickeyextended: "secondLineofPublicKey" privatekey: | -----BEGIN RSA PRIVATE KEY----- Your Private Key diff --git a/manifests/config.pp b/manifests/config.pp index 4430b9e..664e40e 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -118,6 +118,14 @@ $domain = 'all' $publickey = $opendkim::publickey + if ($opendkim::publickeyextended) { + $publickeyextended = $opendkim::publickeyextended + } + + if ($opendkim::hash_algorithms) { + $hash_algorithms = $opendkim::hash_algorithms + } + file { "${opendkim::configdir}/keys/${opendkim::selector}.txt": ensure => 'file', content => template('opendkim/public-rsa-key.erb'), @@ -169,6 +177,14 @@ $domain = $key['domain'] $publickey = $key['publickey'] + if ($key['publickeyextended']) { + $publickeyextended = $key['publickeyextended'] + } + + if ($key['hash_algorithms']) { + $hash_algorithms = $key['hash_algorithms'] + } + file { "${opendkim::configdir}/keys/${key['domain']}/${key['selector']}.txt": ensure => 'file', content => template('opendkim/public-rsa-key.erb'), diff --git a/manifests/init.pp b/manifests/init.pp index 790c178..ba029a6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -31,16 +31,20 @@ Boolean $alldomain = $opendkim::params::alldomain, Optional[String] $selector = $opendkim::params::selector, Optional[String] $publickey = $opendkim::params::publickey, + Optional[String] $publickeyextended = $opendkim::params::publickeyextended, Optional[String] $privatekey = $opendkim::params::privatekey, + Optional[String] $hash_algorithms = $opendkim::params::hash_algorithms, Optional[String] $signaturealgorithm = $opendkim::params::signaturealgorithm, Optional[Integer] $minimumkeybits = $opendkim::params::minimumkeybits, Array[Struct[{ - domain => String, - selector => String, - publickey => String, - privatekey => Variant[String,Deferred], - signingdomains => Array[String], + domain => String, + selector => String, + hash_algorithms => Optional[String], + publickey => String, + publickeyextended => Optional[String], + privatekey => Variant[String,Deferred], + signingdomains => Array[String], }]] $keys = $opendkim::params::keys, Enum['running','stopped'] $service_ensure = $opendkim::params::service_ensure, diff --git a/manifests/params.pp b/manifests/params.pp index 44e2e30..9754baa 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -21,7 +21,9 @@ $alldomain = false $selector = undef $publickey = undef + $publickeyextended = undef $privatekey = undef + $hash_algorithms = undef $signaturealgorithm = undef $minimumkeybits = undef diff --git a/templates/public-rsa-key.erb b/templates/public-rsa-key.erb index c1e8f68..5bba897 100644 --- a/templates/public-rsa-key.erb +++ b/templates/public-rsa-key.erb @@ -1,2 +1,7 @@ -<%= @selector -%>._domainkey IN TXT ( "v=DKIM1; k=rsa; " +<%= @selector -%>._domainkey IN TXT ( "v=DKIM1; <% if @hash_algorithms -%>h=<%= @hash_algorithms -%>; <% end -%>k=rsa; " + <% if @publickey and @publickeyextended -%> + "<%= @publickey -%>" + "<%= @publickeyextended -%>" ) ; ----- DKIM key <%= @selector -%> for <%= @domain -%> + <% else -%> "<%= @publickey -%>" ) ; ----- DKIM key <%= @selector -%> for <%= @domain -%> + <% end -%>