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
|
#!/usr/bin/perl
#
# Copyright 2004-2012 SPARTA, Inc. All rights reserved. See the COPYING
# file distributed with this software for details
#
#
# This script performs a very simple test of the DNSSEC-Tools config module.
# It parses the config file, using parseconfig(), and prints the parsed
# keyword/value pairs to the screen. A simple config file will be created
# in the current directory for testing.
#
# This is a simple test in that the results are displayed to the screen
# and the tester is left the responsibility of ensuring that all worked
# as expected. Automatic testing would be great, and it may come RSN.
#
use strict;
use Net::DNS::SEC::Tools::conf;
# my $conf = "/usr/local/etc/dnssec/dnssec-tools.conf";
my $conf = "./dnssec-tools.conf";
create_conffile();
test_parseconfig();
exit 0;
############################################################################
sub test_parseconfig
{
my %dnssec_conf;
%dnssec_conf = parseconfig($conf);
print "keywords\tvalues\n";
print "--------\t------\n";
foreach my $k (sort(keys(%dnssec_conf)))
{
print "<$k> <$dnssec_conf{$k}>\n";
}
}
############################################################################
sub create_conffile
{
open(CNF,"> $conf");
print CNF <<EOF;
#
# key management tools configuration
#
#
# Settings for dnssec-keygen.
#
algorithm rsasha1
ksklength 1024
zsklength 512
#
# Settings for dnssec-signzone.
#
endtime +259200 # RRSIGs good for three days.
EOF
close(CNF);
}
|