diff --git a/CHANGES b/CHANGES index cd2b6441f7..95b5c7e1cb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ + --- 9.7.0a1 released --- + +2612. [func] Add default values for the arguments to + dnssec-keygen. Without arguments, it will now + generate a 1024-bit RSASHA1 zone-signing key, + or with the -f KSK option, a 2048-bit RSASHA1 + key-signing key. [RT #19300] + +2611. [func] Add -l option to dnssec-dsfromkey to generate + DLV records instead of DS records. [RT #19300] + 2610. [port] sunos: Change #2363 was not complete. [RT #19796] 2609. [func] Simplify the configuration of dynamic zones: diff --git a/README b/README index a3d663ca30..a613a31bbd 100644 --- a/README +++ b/README @@ -45,23 +45,27 @@ BIND 9 BIND 9.7.0 BIND 9.7.0 includes a number of changes from BIND 9.6 and earlier - releases, including: + releases. Most are intended to simplify DNSSEC configuration. + New features include: - Support for RFC 5011, automated trust anchor maintenance. + - Simplified configuration of DNSSEC Lookaside Validation (DLV). + - Simplified configuration of Dynamic DNS, using the "ddns-confgen" + command line tool or the "ddns-autoconf" zone option. (As a side + effect, this also makes it easier to configure automatic zone + re-signing.) + - New named option "attach-cache" that allows multiple views to + share a single cache. + - New logging category "query-errors" to provide detailed + internal information about query failures, especially about + server failures. + - DNS rebinding attack prevention. + - New default values for dnssec-keygen parameters. - Simplified configuration of DNSSEC Lookaside Validation (DLV). + Planned but not complete in alpha: - Simplified configuration of Dynamic DNS using the "ddns-confgen" - command line tool or the "ddns-autoconf" zone option. - - New named option "attach-cache" that allows multiple views to - share a single cache. - - New logging category "query-errors" to provide detailed - internal information about query failures, especially about - server failures. - - DNS rebinding attack prevention. + - Support for RFC 5011 (automated trust anchor maintenance) + - Simplified tools for zone signing and key maintenance + - Fully automatic signing of zones by "named" BIND 9.6.0 diff --git a/bin/dnssec/dnssec-dsfromkey.8 b/bin/dnssec/dnssec-dsfromkey.8 index 4d4cbc96d1..7b81638169 100644 --- a/bin/dnssec/dnssec-dsfromkey.8 +++ b/bin/dnssec/dnssec-dsfromkey.8 @@ -1,124 +1,96 @@ -.\" Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC") -.\" -.\" Permission to use, copy, modify, and/or distribute this software for any +.\" Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC") +.\" +.\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +.\" AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id: dnssec-dsfromkey.8,v 1.5 2008/11/08 01:11:47 tbox Exp $ +.\" $Id: dnssec-dsfromkey.8,v 1.6 2009/06/17 06:51:43 each Exp $ .\" .hy 0 .ad l -.\" Title: dnssec\-dsfromkey -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 -.\" Date: November 29, 2008 -.\" Manual: BIND9 -.\" Source: BIND9 -.\" -.TH "DNSSEC\-DSFROMKEY" "8" "November 29, 2008" "BIND9" "BIND9" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -dnssec\-dsfromkey \- DNSSEC DS RR generation tool +.\"Generated by db2man.xsl. Don't modify this, modify the source. +.de Sh \" Subsection +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH "DNSSEC-DSFROMKEY" 8 "November 29, 2008" "" "" +.SH NAME +dnssec-dsfromkey \- DNSSEC DS RR generation tool .SH "SYNOPSIS" .HP 17 -\fBdnssec\-dsfromkey\fR [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-1\fR] [\fB\-2\fR] [\fB\-a\ \fR\fB\fIalg\fR\fR] {keyfile} +\fBdnssec\-dsfromkey\fR [\fB\-v\ \fIlevel\fR\fR] [\fB\-1\fR] [\fB\-2\fR] [\fB\-a\ \fIalg\fR\fR] {keyfile} .HP 17 -\fBdnssec\-dsfromkey\fR {\-s} [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-1\fR] [\fB\-2\fR] [\fB\-a\ \fR\fB\fIalg\fR\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-d\ \fR\fB\fIdir\fR\fR] {dnsname} +\fBdnssec\-dsfromkey\fR {\-s} [\fB\-v\ \fIlevel\fR\fR] [\fB\-1\fR] [\fB\-2\fR] [\fB\-a\ \fIalg\fR\fR] [\fB\-c\ \fIclass\fR\fR] [\fB\-d\ \fIdir\fR\fR] {dnsname} .SH "DESCRIPTION" .PP -\fBdnssec\-dsfromkey\fR -outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s). +\fBdnssec\-dsfromkey\fR outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s)\&. .SH "OPTIONS" -.PP +.TP \-1 -.RS 4 -Use SHA\-1 as the digest algorithm (the default is to use both SHA\-1 and SHA\-256). -.RE -.PP +Use SHA\-1 as the digest algorithm (the default is to use both SHA\-1 and SHA\-256)\&. +.TP \-2 -.RS 4 -Use SHA\-256 as the digest algorithm. -.RE -.PP +Use SHA\-256 as the digest algorithm\&. +.TP \-a \fIalgorithm\fR -.RS 4 -Select the digest algorithm. The value of -\fBalgorithm\fR -must be one of SHA\-1 (SHA1) or SHA\-256 (SHA256). These values are case insensitive. -.RE -.PP +Select the digest algorithm\&. The value of \fBalgorithm\fR must be one of SHA\-1 (SHA1) or SHA\-256 (SHA256)\&. These values are case insensitive\&. +.TP \-v \fIlevel\fR -.RS 4 -Sets the debugging level. -.RE -.PP +Sets the debugging level\&. +.TP +\-l \fIdomain\fR +Generate a DLV set instead of a DS set\&. The specified \fBdomain\fR is appended to the name for each record in the set\&. +.TP \-s -.RS 4 -Keyset mode: in place of the keyfile name, the argument is the DNS domain name of a keyset file. Following options make sense only in this mode. -.RE -.PP +Keyset mode: in place of the keyfile name, the argument is the DNS domain name of a keyset file\&. Following options make sense only in this mode\&. +.TP \-c \fIclass\fR -.RS 4 -Specifies the DNS class (default is IN), useful only in the keyset mode. -.RE -.PP +Specifies the DNS class (default is IN), useful only in the keyset mode\&. +.TP \-d \fIdirectory\fR -.RS 4 -Look for -\fIkeyset\fR -files in -\fBdirectory\fR -as the directory, ignored when not in the keyset mode. -.RE +Look for \fIkeyset\fR files in \fBdirectory\fR as the directory, ignored when not in the keyset mode\&. .SH "EXAMPLE" .PP -To build the SHA\-256 DS RR from the -\fBKexample.com.+003+26160\fR -keyfile name, the following command would be issued: +To build the SHA\-256 DS RR from the \fBKexample\&.com\&.+003+26160\fR keyfile name, the following command would be issued: .PP -\fBdnssec\-dsfromkey \-2 Kexample.com.+003+26160\fR +\fBdnssec\-dsfromkey \-2 Kexample\&.com\&.+003+26160\fR .PP The command would print something like: .PP -\fBexample.com. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0 C5EA0B94\fR +\fBexample\&.com\&. IN DS 26160 5 2 3A1EADA7A74B8D0BA86726B0C227AA85AB8BBD2B2004F41A868A54F0 C5EA0B94\fR .SH "FILES" .PP -The keyfile can be designed by the key identification -\fIKnnnn.+aaa+iiiii\fR -or the full file name -\fIKnnnn.+aaa+iiiii.key\fR -as generated by -dnssec\-keygen(8). +The keyfile can be designed by the key identification \fIKnnnn\&.+aaa+iiiii\fR or the full file name \fIKnnnn\&.+aaa+iiiii\&.key\fR as generated by dnssec\-keygen(8)\&. .PP -The keyset file name is built from the -\fBdirectory\fR, the string -\fIkeyset\-\fR -and the -\fBdnsname\fR. +The keyset file name is built from the \fBdirectory\fR, the string \fIkeyset\-\fR and the \fBdnsname\fR\&. .SH "CAVEAT" .PP -A keyfile error can give a "file not found" even if the file exists. +A keyfile error can give a "file not found" even if the file exists\&. .SH "SEE ALSO" .PP -\fBdnssec\-keygen\fR(8), -\fBdnssec\-signzone\fR(8), -BIND 9 Administrator Reference Manual, -RFC 3658, -RFC 4509. +\fBdnssec\-keygen\fR(8), \fBdnssec\-signzone\fR(8), BIND 9 Administrator Reference Manual, RFC 3658, RFC 4509\&. .SH "AUTHOR" .PP -Internet Systems Consortium -.SH "COPYRIGHT" -Copyright \(co 2008 Internet Systems Consortium, Inc. ("ISC") -.br +Internet Systems Consortium diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index faf67a8080..8ffba7b531 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-dsfromkey.c,v 1.6 2009/05/07 09:33:52 fdupont Exp $ */ +/* $Id: dnssec-dsfromkey.c,v 1.7 2009/06/17 06:51:43 each Exp $ */ /*! \file */ @@ -52,19 +52,19 @@ const char *program = "dnssec-dsfromkey"; int verbose; static dns_rdataclass_t rdclass; -static dns_fixedname_t fixed; -static dns_name_t *name = NULL; -static dns_db_t *db = NULL; -static dns_dbnode_t *node = NULL; -static dns_rdataset_t keyset; -static isc_mem_t *mctx = NULL; +static dns_fixedname_t fixed; +static dns_name_t *name = NULL; +static dns_db_t *db = NULL; +static dns_dbnode_t *node = NULL; +static dns_rdataset_t keyset; +static isc_mem_t *mctx = NULL; static void loadkeys(char *dirname, char *setname) { - isc_result_t result; - char filename[1024]; - isc_buffer_t buf; + isc_result_t result; + char filename[1024]; + isc_buffer_t buf; dns_rdataset_init(&keyset); dns_fixedname_init(&fixed); @@ -78,10 +78,18 @@ loadkeys(char *dirname, char *setname) isc_buffer_init(&buf, filename, sizeof(filename)); if (dirname != NULL) { + if (isc_buffer_availablelength(&buf) < strlen(dirname)) + fatal("directory name '%s' too long", dirname); isc_buffer_putstr(&buf, dirname); - if (dirname[strlen(dirname) - 1] != '/') + if (dirname[strlen(dirname) - 1] != '/') { + if (isc_buffer_availablelength(&buf) < 1) + fatal("directory name '%s' too long", dirname); isc_buffer_putstr(&buf, "/"); + } } + + if (isc_buffer_availablelength(&buf) < strlen("keyset-")) + fatal("directory name '%s' too long", dirname); isc_buffer_putstr(&buf, "keyset-"); result = dns_name_tofilenametext(name, ISC_FALSE, &buf); check_result(result, "dns_name_tofilenametext()"); @@ -161,7 +169,7 @@ logkey(dns_rdata_t *rdata) isc_result_t result; dst_key_t *key = NULL; isc_buffer_t buf; - char keystr[KEY_FORMATSIZE]; + char keystr[KEY_FORMATSIZE]; isc_buffer_init(&buf, rdata->data, rdata->length); isc_buffer_add(&buf, rdata->length); @@ -176,43 +184,63 @@ logkey(dns_rdata_t *rdata) } static void -emitds(unsigned int dtype, dns_rdata_t *rdata) +emit(unsigned int dtype, dns_rdata_t *rdata, char *lookaside) { - isc_result_t result; - unsigned char buf[DNS_DS_BUFFERSIZE]; - char text_buf[DST_KEY_MAXTEXTSIZE]; - char class_buf[10]; - isc_buffer_t textb, classb; - isc_region_t r; - dns_rdata_t ds; + isc_result_t result; + unsigned char buf[DNS_DS_BUFFERSIZE]; + char text_buf[DST_KEY_MAXTEXTSIZE]; + char name_buf[DNS_NAME_MAXWIRE]; + char class_buf[10]; + isc_buffer_t textb, nameb, classb; + isc_region_t r; + dns_rdata_t ds; isc_buffer_init(&textb, text_buf, sizeof(text_buf)); + isc_buffer_init(&nameb, name_buf, sizeof(name_buf)); isc_buffer_init(&classb, class_buf, sizeof(class_buf)); dns_rdata_init(&ds); result = dns_ds_buildrdata(name, rdata, dtype, buf, &ds); if (result != ISC_R_SUCCESS) - fatal("can't build DS"); + fatal("can't build record"); + + result = dns_name_totext(name, ISC_FALSE, &nameb); + if (result != ISC_R_SUCCESS) + fatal("can't print name"); + + /* Add lookaside origin, if set */ + if (lookaside != NULL) { + if (isc_buffer_availablelength(&nameb) < strlen(lookaside)) + fatal("DLV origin '%s' is too long", lookaside); + isc_buffer_putstr(&nameb, lookaside); + if (lookaside[strlen(lookaside) - 1] != '.') { + if (isc_buffer_availablelength(&nameb) < 1) + fatal("DLV origin '%s' is too long", lookaside); + isc_buffer_putstr(&nameb, "."); + } + } result = dns_rdata_totext(&ds, (dns_name_t *) NULL, &textb); if (result != ISC_R_SUCCESS) - fatal("can't print DS rdata"); + fatal("can't print rdata"); result = dns_rdataclass_totext(rdclass, &classb); if (result != ISC_R_SUCCESS) - fatal("can't print DS class"); + fatal("can't print class"); - result = dns_name_print(name, stdout); - if (result != ISC_R_SUCCESS) - fatal("can't print DS name"); + isc_buffer_usedregion(&nameb, &r); + fwrite(r.base, 1, r.length, stdout); putchar(' '); isc_buffer_usedregion(&classb, &r); fwrite(r.base, 1, r.length, stdout); - printf(" DS "); + if (lookaside == NULL) + printf(" DS "); + else + printf(" DLV "); isc_buffer_usedregion(&textb, &r); fwrite(r.base, 1, r.length, stdout); @@ -223,7 +251,7 @@ static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s options keyfile\n\n", program); - fprintf(stderr, " %s options [-c class] [-d dir] -s dnsname\n\n", + fprintf(stderr, " %s options [-c class] [-d dir] [-l lookaside] -s dnsname\n\n", program); fprintf(stderr, "Version: %s\n", VERSION); fprintf(stderr, "Options:\n"); @@ -233,25 +261,27 @@ usage(void) { fprintf(stderr, " -a algorithm: use algorithm\n"); fprintf(stderr, "Keyset options:\n"); fprintf(stderr, " -s: keyset mode\n"); + fprintf(stderr, " -l: add lookaside zone and print DLV records\n"); fprintf(stderr, " -c class\n"); fprintf(stderr, " -d directory\n"); - fprintf(stderr, "Output: DS RRs\n"); + fprintf(stderr, "Output: DS or DLV RRs\n"); exit (-1); } int main(int argc, char **argv) { - char *algname = NULL, *classname = NULL, *dirname = NULL; - char *endp; - int ch; - unsigned int dtype = DNS_DSDIGEST_SHA1; - isc_boolean_t both = ISC_TRUE; - isc_boolean_t usekeyset = ISC_FALSE; - isc_result_t result; - isc_log_t *log = NULL; - isc_entropy_t *ectx = NULL; - dns_rdata_t rdata; + char *algname = NULL, *classname = NULL, *dirname = NULL; + char *lookaside = NULL; + char *endp; + int ch; + unsigned int dtype = DNS_DSDIGEST_SHA1; + isc_boolean_t both = ISC_TRUE; + isc_boolean_t usekeyset = ISC_FALSE; + isc_result_t result; + isc_log_t *log = NULL; + isc_entropy_t *ectx = NULL; + dns_rdata_t rdata; dns_rdata_init(&rdata); @@ -267,7 +297,7 @@ main(int argc, char **argv) { isc_commandline_errprint = ISC_FALSE; while ((ch = isc_commandline_parse(argc, argv, - "12a:c:d:sv:Fh")) != -1) { + "12a:c:d:l:sv:Fh")) != -1) { switch (ch) { case '1': dtype = DNS_DSDIGEST_SHA1; @@ -286,6 +316,13 @@ main(int argc, char **argv) { break; case 'd': dirname = isc_commandline_argument; + if (strlen(dirname) == 0) + fatal("dir must be a non-empty string"); + break; + case 'l': + lookaside = isc_commandline_argument; + if (strlen(lookaside) == 0) + fatal("lookaside must be a non-empty string"); break; case 's': usekeyset = ISC_TRUE; @@ -357,10 +394,10 @@ main(int argc, char **argv) { logkey(&rdata); if (both) { - emitds(DNS_DSDIGEST_SHA1, &rdata); - emitds(DNS_DSDIGEST_SHA256, &rdata); + emit(DNS_DSDIGEST_SHA1, &rdata, lookaside); + emit(DNS_DSDIGEST_SHA256, &rdata, lookaside); } else - emitds(dtype, &rdata); + emit(dtype, &rdata, lookaside); } } else { unsigned char key_buf[DST_KEY_MAXSIZE]; @@ -369,10 +406,10 @@ main(int argc, char **argv) { DST_KEY_MAXSIZE, &rdata); if (both) { - emitds(DNS_DSDIGEST_SHA1, &rdata); - emitds(DNS_DSDIGEST_SHA256, &rdata); + emit(DNS_DSDIGEST_SHA1, &rdata, lookaside); + emit(DNS_DSDIGEST_SHA256, &rdata, lookaside); } else - emitds(dtype, &rdata); + emit(dtype, &rdata, lookaside); } if (dns_rdataset_isassociated(&keyset)) diff --git a/bin/dnssec/dnssec-dsfromkey.docbook b/bin/dnssec/dnssec-dsfromkey.docbook index c2c6b85305..b3f8e79970 100644 --- a/bin/dnssec/dnssec-dsfromkey.docbook +++ b/bin/dnssec/dnssec-dsfromkey.docbook @@ -17,7 +17,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + November 29, 2008 @@ -114,6 +114,17 @@ + + -l domain + + + Generate a DLV set instead of a DS set. The specified + is appended to the name for each + record in the set. + + + + -s diff --git a/bin/dnssec/dnssec-dsfromkey.html b/bin/dnssec/dnssec-dsfromkey.html index 72dfd3a55a..980079e19c 100644 --- a/bin/dnssec/dnssec-dsfromkey.html +++ b/bin/dnssec/dnssec-dsfromkey.html @@ -1,25 +1,24 @@ - - + dnssec-dsfromkey - +
@@ -33,14 +32,14 @@

dnssec-dsfromkey {-s} [-v level] [-1] [-2] [-a alg] [-c class] [-d dir] {dnsname}

-

DESCRIPTION

+

DESCRIPTION

dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).

-

OPTIONS

+

OPTIONS

-1

@@ -61,6 +60,12 @@

Sets the debugging level.

+
-l domain
+

+ Generate a DLV set instead of a DS set. The specified + domain is appended to the name for each + record in the set. +

-s

Keyset mode: in place of the keyfile name, the argument is @@ -81,7 +86,7 @@

-

EXAMPLE

+

EXAMPLE

To build the SHA-256 DS RR from the Kexample.com.+003+26160 @@ -96,7 +101,7 @@

-

FILES

+

FILES

The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name @@ -110,13 +115,13 @@

-

CAVEAT

+

CAVEAT

A keyfile error can give a "file not found" even if the file exists.

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -125,7 +130,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

diff --git a/bin/dnssec/dnssec-keygen.8 b/bin/dnssec/dnssec-keygen.8 index 13db3d9db1..189b69bb4c 100644 --- a/bin/dnssec/dnssec-keygen.8 +++ b/bin/dnssec/dnssec-keygen.8 @@ -13,188 +13,120 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id: dnssec-keygen.8,v 1.40 2008/10/15 01:11:35 tbox Exp $ +.\" $Id: dnssec-keygen.8,v 1.41 2009/06/17 06:51:43 each Exp $ .\" .hy 0 .ad l -.\" Title: dnssec\-keygen -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 -.\" Date: June 30, 2000 -.\" Manual: BIND9 -.\" Source: BIND9 -.\" -.TH "DNSSEC\-KEYGEN" "8" "June 30, 2000" "BIND9" "BIND9" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -dnssec\-keygen \- DNSSEC key generation tool +.\"Generated by db2man.xsl. Don't modify this, modify the source. +.de Sh \" Subsection +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH "DNSSEC-KEYGEN" 8 "June 30, 2000" "" "" +.SH NAME +dnssec-keygen \- DNSSEC key generation tool .SH "SYNOPSIS" .HP 14 -\fBdnssec\-keygen\fR {\-a\ \fIalgorithm\fR} {\-b\ \fIkeysize\fR} {\-n\ \fInametype\fR} [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-e\fR] [\fB\-f\ \fR\fB\fIflag\fR\fR] [\fB\-g\ \fR\fB\fIgenerator\fR\fR] [\fB\-h\fR] [\fB\-k\fR] [\fB\-p\ \fR\fB\fIprotocol\fR\fR] [\fB\-r\ \fR\fB\fIrandomdev\fR\fR] [\fB\-s\ \fR\fB\fIstrength\fR\fR] [\fB\-t\ \fR\fB\fItype\fR\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] {name} +\fBdnssec\-keygen\fR {\-a\ \fIalgorithm\fR} {\-b\ \fIkeysize\fR} {\-n\ \fInametype\fR} [\fB\-c\ \fIclass\fR\fR] [\fB\-e\fR] [\fB\-f\ \fIflag\fR\fR] [\fB\-g\ \fIgenerator\fR\fR] [\fB\-h\fR] [\fB\-k\fR] [\fB\-p\ \fIprotocol\fR\fR] [\fB\-r\ \fIrandomdev\fR\fR] [\fB\-s\ \fIstrength\fR\fR] [\fB\-t\ \fItype\fR\fR] [\fB\-v\ \fIlevel\fR\fR] {name} .SH "DESCRIPTION" .PP -\fBdnssec\-keygen\fR -generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with TSIG (Transaction Signatures), as defined in RFC 2845. +\fBdnssec\-keygen\fR generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034\&. It can also generate keys for use with TSIG (Transaction Signatures), as defined in RFC 2845\&. .SH "OPTIONS" -.PP +.TP \-a \fIalgorithm\fR -.RS 4 -Selects the cryptographic algorithm. The value of -\fBalgorithm\fR -must be one of RSAMD5 (RSA) or RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, DH (Diffie Hellman), or HMAC\-MD5. These values are case insensitive. -.sp -Note 1: that for DNSSEC, RSASHA1 is a mandatory to implement algorithm, and DSA is recommended. For TSIG, HMAC\-MD5 is mandatory. -.sp -Note 2: HMAC\-MD5 and DH automatically set the \-k flag. -.RE -.PP +Selects the cryptographic algorithm\&. The value of \fBalgorithm\fR must be one of RSAMD5 (RSA) or RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, DH (Diffie Hellman), or HMAC\-MD5\&. These values are case insensitive\&. The default is RSASHA1 for DNSSEC key generation\&. +Note 1: that for DNSSEC, RSASHA1 is a mandatory to implement algorithm, and DSA is recommended\&. For TSIG, HMAC\-MD5 is mandatory\&. +Note 2: HMAC\-MD5 and DH automatically set the \-k flag\&. +.TP \-b \fIkeysize\fR -.RS 4 -Specifies the number of bits in the key. The choice of key size depends on the algorithm used. RSAMD5 / RSASHA1 keys must be between 512 and 2048 bits. Diffie Hellman keys must be between 128 and 4096 bits. DSA keys must be between 512 and 1024 bits and an exact multiple of 64. HMAC\-MD5 keys must be between 1 and 512 bits. -.RE -.PP +Specifies the number of bits in the key\&. The choice of key size depends on the algorithm used\&. RSAMD5 / RSASHA1 keys must be between 512 and 2048 bits\&. Diffie Hellman keys must be between 128 and 4096 bits\&. DSA keys must be between 512 and 1024 bits and an exact multiple of 64\&. HMAC\-MD5 keys must be between 1 and 512 bits\&. + When generating a DNSSEC key with the default algorithm, this + value defaults to 1024, or 2048 if the KSK flag is set\&. +.TP \-n \fInametype\fR -.RS 4 -Specifies the owner type of the key. The value of -\fBnametype\fR -must either be ZONE (for a DNSSEC zone key (KEY/DNSKEY)), HOST or ENTITY (for a key associated with a host (KEY)), USER (for a key associated with a user(KEY)) or OTHER (DNSKEY). These values are case insensitive. Defaults to ZONE for DNSKEY generation. -.RE -.PP +Specifies the owner type of the key\&. The value of \fBnametype\fR must either be ZONE (for a DNSSEC zone key (KEY/DNSKEY)), HOST or ENTITY (for a key associated with a host (KEY)), USER (for a key associated with a user(KEY)) or OTHER (DNSKEY)\&. These values are case insensitive\&. Defaults to ZONE for DNSKEY generation\&. +.TP \-c \fIclass\fR -.RS 4 -Indicates that the DNS record containing the key should have the specified class. If not specified, class IN is used. -.RE -.PP +Indicates that the DNS record containing the key should have the specified class\&. If not specified, class IN is used\&. +.TP \-e -.RS 4 -If generating an RSAMD5/RSASHA1 key, use a large exponent. -.RE -.PP +If generating an RSAMD5/RSASHA1 key, use a large exponent\&. +.TP \-f \fIflag\fR -.RS 4 -Set the specified flag in the flag field of the KEY/DNSKEY record. The only recognized flag is KSK (Key Signing Key) DNSKEY. -.RE -.PP +Set the specified flag in the flag field of the KEY/DNSKEY record\&. The only recognized flag is KSK (Key Signing Key) DNSKEY\&. +.TP \-g \fIgenerator\fR -.RS 4 -If generating a Diffie Hellman key, use this generator. Allowed values are 2 and 5. If no generator is specified, a known prime from RFC 2539 will be used if possible; otherwise the default is 2. -.RE -.PP +If generating a Diffie Hellman key, use this generator\&. Allowed values are 2 and 5\&. If no generator is specified, a known prime from RFC 2539 will be used if possible; otherwise the default is 2\&. +.TP \-h -.RS 4 -Prints a short summary of the options and arguments to -\fBdnssec\-keygen\fR. -.RE -.PP +Prints a short summary of the options and arguments to \fBdnssec\-keygen\fR\&. +.TP \-k -.RS 4 -Generate KEY records rather than DNSKEY records. -.RE -.PP +Generate KEY records rather than DNSKEY records\&. +.TP \-p \fIprotocol\fR -.RS 4 -Sets the protocol value for the generated key. The protocol is a number between 0 and 255. The default is 3 (DNSSEC). Other possible values for this argument are listed in RFC 2535 and its successors. -.RE -.PP +Sets the protocol value for the generated key\&. The protocol is a number between 0 and 255\&. The default is 3 (DNSSEC)\&. Other possible values for this argument are listed in RFC 2535 and its successors\&. +.TP \-r \fIrandomdev\fR -.RS 4 -Specifies the source of randomness. If the operating system does not provide a -\fI/dev/random\fR -or equivalent device, the default source of randomness is keyboard input. -\fIrandomdev\fR -specifies the name of a character device or file containing random data to be used instead of the default. The special value -\fIkeyboard\fR -indicates that keyboard input should be used. -.RE -.PP +Specifies the source of randomness\&. If the operating system does not provide a \fI/dev/random\fR or equivalent device, the default source of randomness is keyboard input\&. \fIrandomdev\fR specifies the name of a character device or file containing random data to be used instead of the default\&. The special value \fIkeyboard\fR indicates that keyboard input should be used\&. +.TP \-s \fIstrength\fR -.RS 4 -Specifies the strength value of the key. The strength is a number between 0 and 15, and currently has no defined purpose in DNSSEC. -.RE -.PP +Specifies the strength value of the key\&. The strength is a number between 0 and 15, and currently has no defined purpose in DNSSEC\&. +.TP \-t \fItype\fR -.RS 4 -Indicates the use of the key. -\fBtype\fR -must be one of AUTHCONF, NOAUTHCONF, NOAUTH, or NOCONF. The default is AUTHCONF. AUTH refers to the ability to authenticate data, and CONF the ability to encrypt data. -.RE -.PP +Indicates the use of the key\&. \fBtype\fR must be one of AUTHCONF, NOAUTHCONF, NOAUTH, or NOCONF\&. The default is AUTHCONF\&. AUTH refers to the ability to authenticate data, and CONF the ability to encrypt data\&. +.TP \-v \fIlevel\fR -.RS 4 -Sets the debugging level. -.RE +Sets the debugging level\&. .SH "GENERATED KEYS" .PP -When -\fBdnssec\-keygen\fR -completes successfully, it prints a string of the form -\fIKnnnn.+aaa+iiiii\fR -to the standard output. This is an identification string for the key it has generated. -.TP 4 +When \fBdnssec\-keygen\fR completes successfully, it prints a string of the form \fIKnnnn\&.+aaa+iiiii\fR to the standard output\&. This is an identification string for the key it has generated\&. +.TP 3 \(bu -\fInnnn\fR -is the key name. -.TP 4 +\fInnnn\fR is the key name\&. +.TP \(bu -\fIaaa\fR -is the numeric representation of the algorithm. -.TP 4 +\fIaaa\fR is the numeric representation of the algorithm\&. +.TP \(bu -\fIiiiii\fR -is the key identifier (or footprint). +\fIiiiii\fR is the key identifier (or footprint)\&. +.LP .PP -\fBdnssec\-keygen\fR -creates two files, with names based on the printed string. -\fIKnnnn.+aaa+iiiii.key\fR -contains the public key, and -\fIKnnnn.+aaa+iiiii.private\fR -contains the private key. +\fBdnssec\-keygen\fR creates two files, with names based on the printed string\&. \fIKnnnn\&.+aaa+iiiii\&.key\fR contains the public key, and \fIKnnnn\&.+aaa+iiiii\&.private\fR contains the private key\&. .PP -The -\fI.key\fR -file contains a DNS KEY record that can be inserted into a zone file (directly or with a $INCLUDE statement). +The \fI\&.key\fR file contains a DNS KEY record that can be inserted into a zone file (directly or with a $INCLUDE statement)\&. .PP -The -\fI.private\fR -file contains algorithm\-specific fields. For obvious security reasons, this file does not have general read permission. +The \fI\&.private\fR file contains algorithm\-specific fields\&. For obvious security reasons, this file does not have general read permission\&. .PP -Both -\fI.key\fR -and -\fI.private\fR -files are generated for symmetric encryption algorithms such as HMAC\-MD5, even though the public and private key are equivalent. +Both \fI\&.key\fR and \fI\&.private\fR files are generated for symmetric encryption algorithms such as HMAC\-MD5, even though the public and private key are equivalent\&. .SH "EXAMPLE" .PP -To generate a 768\-bit DSA key for the domain -\fBexample.com\fR, the following command would be issued: +To generate a 768\-bit DSA key for the domain \fBexample\&.com\fR, the following command would be issued: .PP -\fBdnssec\-keygen \-a DSA \-b 768 \-n ZONE example.com\fR +\fBdnssec\-keygen \-a DSA \-b 768 \-n ZONE example\&.com\fR .PP The command would print a string of the form: .PP -\fBKexample.com.+003+26160\fR +\fBKexample\&.com\&.+003+26160\fR .PP -In this example, -\fBdnssec\-keygen\fR -creates the files -\fIKexample.com.+003+26160.key\fR -and -\fIKexample.com.+003+26160.private\fR. +In this example, \fBdnssec\-keygen\fR creates the files \fIKexample\&.com\&.+003+26160\&.key\fR and \fIKexample\&.com\&.+003+26160\&.private\fR\&. .SH "SEE ALSO" .PP -\fBdnssec\-signzone\fR(8), -BIND 9 Administrator Reference Manual, -RFC 2539, -RFC 2845, -RFC 4033. +\fBdnssec\-signzone\fR(8), BIND 9 Administrator Reference Manual, RFC 2539, RFC 2845, RFC 4033\&. .SH "AUTHOR" .PP -Internet Systems Consortium -.SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") -.br -Copyright \(co 2000\-2003 Internet Software Consortium. -.br +Internet Systems Consortium diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 2fe86e8729..9a61551da7 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-keygen.c,v 1.83 2009/05/07 23:47:44 tbox Exp $ */ +/* $Id: dnssec-keygen.c,v 1.84 2009/06/17 06:51:43 each Exp $ */ /*! \file */ @@ -67,6 +67,8 @@ static const char *algs = "RSA | RSAMD5 | DH | DSA | RSASHA1 | NSEC3DSA |" " HMAC-SHA1 | HMAC-SHA224 | HMAC-SHA256 |" " HMAC-SHA384 | HMAC-SHA512"; +#define DEFAULT_ALGORITHM "RSASHA1" + static isc_boolean_t dsa_size_ok(int size) { return (ISC_TF(size >= 512 && size <= 1024 && size % 64 == 0)); @@ -75,11 +77,12 @@ dsa_size_ok(int size) { static void usage(void) { fprintf(stderr, "Usage:\n"); - fprintf(stderr, " %s -a alg -b bits [-n type] [options] name\n\n", + fprintf(stderr, " %s [options] name\n\n", program); fprintf(stderr, "Version: %s\n", VERSION); - fprintf(stderr, "Required options:\n"); - fprintf(stderr, " -a algorithm: %s\n", algs); + fprintf(stderr, " name: owner of the key\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -a algorithm: %s (default RSASHA1)\n", algs); fprintf(stderr, " -b key size, in bits:\n"); fprintf(stderr, " RSAMD5:\t\t[512..%d]\n", MAX_RSA); fprintf(stderr, " RSASHA1:\t\t[512..%d]\n", MAX_RSA); @@ -93,10 +96,9 @@ usage(void) { fprintf(stderr, " HMAC-SHA256:\t[1..256]\n"); fprintf(stderr, " HMAC-SHA384:\t[1..384]\n"); fprintf(stderr, " HMAC-SHA512:\t[1..512]\n"); + fprintf(stderr, " (default 1024 for RSASHA1 ZSK, 2048 for KSK\n"); fprintf(stderr, " -n nametype: ZONE | HOST | ENTITY | USER | OTHER\n"); - fprintf(stderr, " (DNSKEY generation defaults to ZONE\n"); - fprintf(stderr, " name: owner of the key\n"); - fprintf(stderr, "Other options:\n"); + fprintf(stderr, " (DNSKEY generation defaults to ZONE)\n"); fprintf(stderr, " -c (default: IN)\n"); fprintf(stderr, " -d (0 => max, default)\n"); fprintf(stderr, " -e use large exponent (RSAMD5/RSASHA1 only)\n"); @@ -122,7 +124,7 @@ usage(void) { int main(int argc, char **argv) { - char *algname = NULL, *nametype = NULL, *type = NULL; + char *algname = NULL, *nametype = NULL, *type = NULL; char *classname = NULL; char *endp; dst_key_t *key = NULL, *oldkey; @@ -143,6 +145,7 @@ main(int argc, char **argv) { dns_rdataclass_t rdclass; int options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC; int dbits = 0; + isc_boolean_t use_default = ISC_FALSE; if (argc == 1) usage(); @@ -252,9 +255,15 @@ main(int argc, char **argv) { if (argc > isc_commandline_index + 1) fatal("extraneous arguments"); - if (algname == NULL) - fatal("no algorithm was specified"); - if (strcasecmp(algname, "RSA") == 0) { + if (algname == NULL) { + algname = strdup(DEFAULT_ALGORITHM); + use_default = ISC_TRUE; + if (verbose > 0) + fprintf(stderr, "no algorithm specified; " + "defaulting to %s\n", algname); + } + + if (strcasecmp(algname, "RSA") == 0) { fprintf(stderr, "The use of RSA (RSAMD5) is not recommended.\n" "If you still wish to use RSA (RSAMD5) please " "specify \"-a RSAMD5\"\n"); @@ -303,8 +312,16 @@ main(int argc, char **argv) { fatal("invalid type %s", type); } - if (size < 0) - fatal("key size not specified (-b option)"); + if (size < 0) { + if (use_default) { + size = (ksk != 0) ? 2048 : 1024; + if (verbose > 0) + fprintf(stderr, "key size not specified; " + "defaulting to %d\n", size); + } else { + fatal("key size not specified (-b option)"); + } + } switch (alg) { case DNS_KEYALG_RSAMD5: diff --git a/bin/dnssec/dnssec-keygen.docbook b/bin/dnssec/dnssec-keygen.docbook index c267a1b4c2..f2159cbd0d 100644 --- a/bin/dnssec/dnssec-keygen.docbook +++ b/bin/dnssec/dnssec-keygen.docbook @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + June 30, 2000 @@ -55,9 +55,9 @@ dnssec-keygen - -a algorithm - -b keysize - -n nametype + + + @@ -93,7 +93,8 @@ Selects the cryptographic algorithm. The value of must be one of RSAMD5 (RSA) or RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, DH (Diffie Hellman), or HMAC-MD5. - These values are case insensitive. + These values are case insensitive. The default is RSASHA1 for + DNSSEC key generation. Note 1: that for DNSSEC, RSASHA1 is a mandatory to implement @@ -112,12 +113,15 @@ Specifies the number of bits in the key. The choice of key size depends on the algorithm used. RSAMD5 / RSASHA1 keys must be - between - 512 and 2048 bits. Diffie Hellman keys must be between + between 512 and 2048 bits. Diffie Hellman keys must be between 128 and 4096 bits. DSA keys must be between 512 and 1024 bits and an exact multiple of 64. HMAC-MD5 keys must be between 1 and 512 bits. + When generating a DNSSEC key with the default algorithm, this + value defaults to 1024, or 2048 if the KSK flag is set. + +
@@ -160,7 +164,7 @@ Set the specified flag in the flag field of the KEY/DNSKEY record. - The only recognized flag is KSK (Key Signing Key) DNSKEY. + The only recognized flag is KSK (Key Signing Key) DNSKEY. diff --git a/bin/dnssec/dnssec-keygen.html b/bin/dnssec/dnssec-keygen.html index 696ef88c37..930accd10e 100644 --- a/bin/dnssec/dnssec-keygen.html +++ b/bin/dnssec/dnssec-keygen.html @@ -14,12 +14,12 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + dnssec-keygen - +
@@ -32,7 +32,7 @@

dnssec-keygen {-a algorithm} {-b keysize} {-n nametype} [-c class] [-e] [-f flag] [-g generator] [-h] [-k] [-p protocol] [-r randomdev] [-s strength] [-t type] [-v level] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with @@ -40,7 +40,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -48,7 +48,8 @@ Selects the cryptographic algorithm. The value of algorithm must be one of RSAMD5 (RSA) or RSASHA1, DSA, NSEC3RSASHA1, NSEC3DSA, DH (Diffie Hellman), or HMAC-MD5. - These values are case insensitive. + These values are case insensitive. The default is RSASHA1 for + DNSSEC key generation.

Note 1: that for DNSSEC, RSASHA1 is a mandatory to implement @@ -60,15 +61,20 @@

-b keysize
-

+

+

Specifies the number of bits in the key. The choice of key size depends on the algorithm used. RSAMD5 / RSASHA1 keys must be - between - 512 and 2048 bits. Diffie Hellman keys must be between + between 512 and 2048 bits. Diffie Hellman keys must be between 128 and 4096 bits. DSA keys must be between 512 and 1024 bits and an exact multiple of 64. HMAC-MD5 keys must be between 1 and 512 bits. -

+

+ When generating a DNSSEC key with the default algorithm, this + value defaults to 1024, or 2048 if the KSK flag is set. +

+

+
-n nametype

Specifies the owner type of the key. The value of @@ -91,7 +97,7 @@

-f flag

Set the specified flag in the flag field of the KEY/DNSKEY record. - The only recognized flag is KSK (Key Signing Key) DNSKEY. + The only recognized flag is KSK (Key Signing Key) DNSKEY.

-g generator

@@ -148,7 +154,7 @@

-

GENERATED KEYS

+

GENERATED KEYS

When dnssec-keygen completes successfully, @@ -194,7 +200,7 @@

-

EXAMPLE

+

EXAMPLE

To generate a 768-bit DSA key for the domain example.com, the following command would be @@ -215,7 +221,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-signzone(8), BIND 9 Administrator Reference Manual, RFC 2539, @@ -224,7 +230,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

diff --git a/lib/dns/dst_parse.c b/lib/dns/dst_parse.c index d2b3922e10..2fe626c561 100644 --- a/lib/dns/dst_parse.c +++ b/lib/dns/dst_parse.c @@ -31,7 +31,7 @@ /*% * Principal Author: Brian Wellington - * $Id: dst_parse.c,v 1.16 2009/03/02 23:47:43 tbox Exp $ + * $Id: dst_parse.c,v 1.17 2009/06/17 06:51:44 each Exp $ */ #include @@ -498,6 +498,12 @@ dst__privstruct_writefile(const dst_key_t *key, const dst_private_t *priv, case DST_ALG_HMACSHA512: fprintf(fp, "(HMAC_SHA512)\n"); break; + case DST_ALG_NSEC3DSA: + fprintf(fp, "(NSEC3DSA)\n"); + break; + case DST_ALG_NSEC3RSASHA1: + fprintf(fp, "(NSEC3RSASHA1)\n"); + break; default: fprintf(fp, "(?)\n"); break;