6 use POSIX
qw(strftime);
7 my $now = strftime
"%Y%m%d%H%M%S", gmtime;
11 $d =~ s
{(....)(..)(..)(..)(..)(..)}
12 {$1-$2-$3.$4:$5:$6+0000};
19 m{\s+(\d+)\s+(\d+)\s+(\d+)\s+[(]\s*$};
30 m{ alg = (\S+); key id = (\d+)};
39 return sprintf "%16s tag %s", $k->{name
}, $k->{id
};
44 if ($a->{removehd
} ne "19700101000000") {
45 printf " untrusted and to be removed at %s\n", ext8601
$a->{removehd
};
46 } elsif ($a->{addhd
} lt $now) {
49 printf " waiting for %s\n", ext8601
$a->{addhd
};
56 open my $d, "-|", qw{dig
+multiline DNSKEY
}, $name;
58 next unless m{^([a-z0-9.-]*)\s+\d+\s+IN\s+DNSKEY\s+};
59 next unless $name eq $1;
60 push @
$keys, getkey
$d, { name
=> $name };
68 next unless m{^([a-z0-9.-]*)\s+KEYDATA\s+(\d+)\s+(\d+)\s+(\d+)\s+};
69 my $k = getkey
*ARGV
, {
75 if ($k->{name
} eq "") {
80 $k->{name
} =~ s{[.]*$}{.};
81 push @
{$anchor->{$k->{name
}}}, $k;
84 for my $name (keys %$anchor) {
85 my $keys = digkeys
$name;
86 my $anchors = $anchor->{$name};
88 if ($k->{flags
} & 1) {
89 printf "%s %s", fmtkey
$k, $k->{alg
};
94 if ($k->{flags
} & 512) {
98 for my $t (@
$anchors) {
99 if ($t->{data
} eq $k->{data
} and
100 $t->{protocol
} eq $k->{protocol
} and
101 $t->{algorithm
} eq $k->{algorithm
}) {
107 if (not defined $a) {
108 print " no trust anchor\n";
113 for my $a (@
$anchors) {
114 next if $a->{matched
};
115 printf "%s %s missing;", fmtkey
$a, $a->{alg
};
126 check5011 - summarize DNSSEC trust anchor status
130 check5011 <I<managed-keys.bind>>
134 The BIND managed-keys file contains DNSSEC trust anchors
135 that can be automatically updated according to RFC 5011. The
136 B<check5011> program reads this file and prints a summary of the
137 status of the trust anchors. It fetches the corresponding
138 DNSKEY records using B<dig> and compares them to the trust anchors.
140 Each key is printed on a line with its name, its tag, and its
141 algorithm, followed by a summary of its status.
147 The key is currently trusted.
149 =item C<waiting for ...>
151 The key is new, and B<named> is waiting for the "add hold-down" period
152 to pass before the key will be trusted.
154 =item C<untrusted and to be removed at ...>
156 The key was revoked and will be removed at the stated time.
158 =item C<no trust anchor>
160 The key is present in the DNS but not in the managed-keys file.
164 The key has its revoked flag set. This is printed before the key's
165 trust anchor status which should normally be C<untrusted...> if
166 B<named> has observed the revocation.
170 There is no DNSKEY record for this trust anchor. This is printed
171 before the key's trust anchor status.
175 By default the managed keys are stored in a file called
176 F<managed-keys.bind> in B<named>'s working directory. This location
177 can be changed with B<named>'s B<managed-keys-directory> option. If
178 you are using views the file may be named with the SHA256 hash of a
179 view name with a F<.mkeys> extension added.
185 =item Written by Tony Finch <fanf2@cam.ac.uk> <dot@dotat.at>
187 =item at the University of Cambridge Computing Service.
189 =item You may do anything with this. It has no warranty.
191 =item L<http://creativecommons.org/publicdomain/zero/1.0/>