define dnsextras::entry (
$zone,
- $label,
- $rrtype,
- $rrdata,
+ $content,
) {
@@concat::fragment { "dns-extra-${zone}-${::fqdn}-${name}":
target => "/srv/dns.debian.org/puppet-extra/include-${zone}",
- content => "; ${::fqdn} ${name}\n${label}. IN ${rrtype} ${rrdata}\n",
+ content => "; ${::fqdn} ${name}\n${content}\n",
tag => 'dnsextra',
}
}
--- /dev/null
+define dnsextras::tlsa_record (
+ $zone,
+ $certfile,
+ $hostname,
+ $port,
+) {
+ $snippet = gen_tlsa_entry($certfile, $hostname, $port)
+ dnsextras::entry{ "$name":
+ zone => "$zone",
+ content => $snippet,
+ }
+}
domain => 'ip6',
rule => "&SERVICE_RANGE(tcp, $mail_port, \$SMTP_V6_SOURCES)"
}
- dnsextras::entry{ "tlsa-mailport":
+ dnsextras::tlsa_record{ "tlsa-mailport":
zone => 'debian.org',
- label => "_${mail_port}._tcp.${::fqdn}",
- rrtype => 'TXT',
- rrdata => 'testing' }
+ certfile => "/etc/puppet/modules/exim/files/certs/${::fqdn}.crt",
+ port => "$mail_port",
+ hostname => "$::fqdn",
+ }
# Do we actually want this? I'm only doing it because it's harmless
# and makes the logs quiet. There are better ways of making logs quiet,
domain => 'ip6',
rule => '&SERVICE_RANGE(tcp, submission, $SMTP_V6_SOURCES)',
}
- dnsextras::entry{ "tlsa-submission":
+ dnsextras::tlsa_record{ "tlsa-submission":
zone => 'debian.org',
- label => "_587._tcp.${::fqdn}",
- rrtype => 'TXT',
- rrdata => 'testing' }
-
+ certfile => "/etc/puppet/modules/exim/files/certs/${::fqdn}.crt",
+ port => 587,
+ hostname => "$::fqdn",
+ }
package { 'nagios-plugins-standard':
ensure => installed,
}
--- /dev/null
+module Puppet::Parser::Functions
+ newfunction(:gen_tlsa_entry, :type => :rvalue) do |args|
+ certfile = args.shift()
+ hostname = args.shift()
+ port = args.shift()
+
+ if File.exist?(certfile)
+ cmd = ['swede', 'create', '--usage=3', '--selector=1', '--mtype=1', '--certificate', certfile, '--port', port.to_s, hostname]
+ IO.popen(cmd, "r") {|i|
+ return i.read
+ }
+ else
+ return "; certfile #{certfile} did not exist to create TLSA record for #{hostname}:#{port}."
+ end
+ end
+end