File: getkeyset

package info (click to toggle)
libnet-dns-sec-perl 1.26-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 1,425; makefile: 5
file content (85 lines) | stat: -rw-r--r-- 2,137 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/perl
#$Id: getkeyset 1862 2021-12-24 10:09:08Z willem $

use strict;
use warnings;
use Net::DNS::SEC;
use Net::DNS::SEC::Keyset;


my $domain = shift || die "At least one argument needed";
my $nameserver = shift;


my $res = Net::DNS::Resolver->new;
$res->dnssec(1);
$res->nameservers($nameserver) if defined $nameserver;

my $packet = $res->query( $domain, 'DNSKEY', 'IN' )
		|| die "No results for query $domain DNSKEY";

my $keyset = Net::DNS::SEC::Keyset->new($packet)
		|| die $Net::DNS::SEC::Keyset::keyset_err;


# Print DS records to STD out
#
my @ds = $keyset->extract_ds;
foreach my $ds (@ds) {
	$ds->print;
}

# write keyset in current dir.
#
$keyset->writekeyset;

1;

__END__


=head1 NAME

getkeyset.pl - DS extraction demo

=head1 SYNOPSIS

getkeyset.pl <domain> [auth_nameserver]

=head1 DESCRIPTION

The program queries for the key-set of 'domain'. Spits out the DS
records and writes the keyset to the current directory.

If the second argument is specified the query is performed to that
nameserver.


=head1 TODO

This is only a demonstration program to show how the interface can be used.


=head1 COPYRIGHT

Copyright (c) 2002 RIPE NCC.  Author Olaf M. Kolkman

All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided
that the original copyright notices appear in all copies and that both
copyright notice and this permission notice appear in supporting
documentation, and that the name of the author not be used in advertising
or publicity pertaining to distribution of the software without specific
prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

=cut