3 /****************************************************************
5 ** @(#) zconf.c -- configuration file parser for dnssec.conf
7 ** Most of the code is from the SixXS Heartbeat Client
8 ** written by Jeroen Massar <jeroen@sixxs.net>
10 ** New config types and some slightly code changes by Holger Zuleger
12 ** Copyright (c) Aug 2005, Jeroen Massar, Holger Zuleger.
13 ** All rights reserved.
15 ** This software is open source.
17 ** Redistribution and use in source and binary forms, with or without
18 ** modification, are permitted provided that the following conditions
21 ** Redistributions of source code must retain the above copyright notice,
22 ** this list of conditions and the following disclaimer.
24 ** Redistributions in binary form must reproduce the above copyright notice,
25 ** this list of conditions and the following disclaimer in the documentation
26 ** and/or other materials provided with the distribution.
28 ** Neither the name of Jeroen Masar or Holger Zuleger nor the
29 ** names of its contributors may be used to endorse or promote products
30 ** derived from this software without specific prior written permission.
32 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
34 ** TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
35 ** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
36 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 ** POSSIBILITY OF SUCH DAMAGE.
44 ****************************************************************/
45 # include <sys/types.h>
59 # include "config_zkt.h"
67 # define ISTRUE(val) (strcasecmp (val, "yes") == 0 || \
68 strcasecmp (val, "true") == 0 )
69 # define ISCOMMENT(cp) (*(cp) == '#' || *(cp) == ';' || \
70 (*(cp) == '/' && *((cp)+1) == '/') )
71 # define ISDELIM(c) ( isspace (c) || (c) == ':' || (c) == '=' )
87 /*****************************************************************
88 ** private (static) variables
89 *****************************************************************/
90 static zconf_t def
= {
92 PRINTTIME
, PRINTAGE
, LJUST
,
93 SIG_VALIDITY
, MAX_TTL
, KEY_TTL
, PROPTIME
, Incremental
,
95 KEY_ALGO
, ADDITIONAL_KEY_ALGO
,
96 KSK_LIFETIME
, KSK_BITS
, KSK_RANDOM
,
97 ZSK_LIFETIME
, ZSK_BITS
, ZSK_RANDOM
,
99 NULL
, /* viewname cmdline parameter */
100 0, /* noexec cmdline parameter */
101 LOGFILE
, LOGLEVEL
, SYSLOGFACILITY
, SYSLOGLEVEL
, VERBOSELOG
, 0,
102 DNSKEYFILE
, ZONEFILE
, KEYSETDIR
,
104 SIG_RANDOM
, SIG_PSEUDO
, SIG_GENDS
, SIG_PARAM
,
105 DIST_CMD
, /* defaults to NULL which means to run "rndc reload" */
110 char *label
; /* the name of the paramter */
111 int cmdline
; /* is this a command line parameter ? */
112 ctype_t type
; /* the parameter type */
113 void *var
; /* pointer to the parameter variable */
116 static zconf_para_t confpara
[] = {
117 { "", 0, CONF_COMMENT
, ""},
118 { "", 0, CONF_COMMENT
, "\t@(#) dnssec.conf " ZKT_VERSION
},
119 { "", 0, CONF_COMMENT
, ""},
120 { "", 0, CONF_COMMENT
, NULL
},
122 { "", 0, CONF_COMMENT
, "dnssec-zkt options" },
123 { "Zonedir", 0, CONF_STRING
, &def
.zonedir
},
124 { "Recursive", 0, CONF_BOOL
, &def
.recursive
},
125 { "PrintTime", 0, CONF_BOOL
, &def
.printtime
},
126 { "PrintAge", 0, CONF_BOOL
, &def
.printage
},
127 { "LeftJustify", 0, CONF_BOOL
, &def
.ljust
},
129 { "", 0, CONF_COMMENT
, NULL
},
130 { "", 0, CONF_COMMENT
, "zone specific values" },
131 { "ResignInterval", 0, CONF_TIMEINT
, &def
.resign
},
132 { "Sigvalidity", 0, CONF_TIMEINT
, &def
.sigvalidity
},
133 { "Max_TTL", 0, CONF_TIMEINT
, &def
.max_ttl
},
134 { "Propagation", 0, CONF_TIMEINT
, &def
.proptime
},
135 { "KEY_TTL", 0, CONF_TIMEINT
, &def
.key_ttl
},
136 #if defined (DEF_TTL)
137 { "def_ttl", 0, CONF_TIMEINT
, &def
.def_ttl
},
139 { "Serialformat", 0, CONF_SERIAL
, &def
.serialform
},
141 { "", 0, CONF_COMMENT
, NULL
},
142 { "", 0, CONF_COMMENT
, "signing key parameters"},
143 { "Key_algo", 0, CONF_ALGO
, &def
.k_algo
}, /* now used as general KEY algoritjm (KSK & ZSK) */
144 { "AddKey_algo", 0, CONF_ALGO
, &def
.k2_algo
}, /* second key algorithm added (v0.99) */
145 { "KSK_lifetime", 0, CONF_TIMEINT
, &def
.k_life
},
146 { "KSK_algo", 1, CONF_ALGO
, &def
.k_algo
}, /* old KSK value changed to key algorithm */
147 { "KSK_bits", 0, CONF_INT
, &def
.k_bits
},
148 { "KSK_randfile", 0, CONF_STRING
, &def
.k_random
},
149 { "ZSK_lifetime", 0, CONF_TIMEINT
, &def
.z_life
},
150 /* { "ZSK_algo", 1, CONF_ALGO, &def.z_algo }, ZSK algo removed (set to same as ksk) */
151 { "ZSK_algo", 1, CONF_ALGO
, &def
.k2_algo
}, /* if someone using it already, map the algo to the additional key algorithm */
152 { "ZSK_bits", 0, CONF_INT
, &def
.z_bits
},
153 { "ZSK_randfile", 0, CONF_STRING
, &def
.z_random
},
154 { "SaltBits", 0, CONF_INT
, &def
.saltbits
},
156 { "", 0, CONF_COMMENT
, NULL
},
157 { "", 0, CONF_COMMENT
, "dnssec-signer options"},
158 { "--view", 1, CONF_STRING
, &def
.view
},
159 { "--noexec", 1, CONF_BOOL
, &def
.noexec
},
160 { "LogFile", 0, CONF_STRING
, &def
.logfile
},
161 { "LogLevel", 0, CONF_LEVEL
, &def
.loglevel
},
162 { "SyslogFacility", 0, CONF_FACILITY
, &def
.syslogfacility
},
163 { "SyslogLevel", 0, CONF_LEVEL
, &def
.sysloglevel
},
164 { "VerboseLog", 0, CONF_INT
, &def
.verboselog
},
165 { "-v", 1, CONF_INT
, &def
.verbosity
},
166 { "Keyfile", 0, CONF_STRING
, &def
.keyfile
},
167 { "Zonefile", 0, CONF_STRING
, &def
.zonefile
},
168 { "KeySetDir", 0, CONF_STRING
, &def
.keysetdir
},
169 { "DLV_Domain", 0, CONF_STRING
, &def
.lookaside
},
170 { "Sig_Randfile", 0, CONF_STRING
, &def
.sig_random
},
171 { "Sig_Pseudorand", 0, CONF_BOOL
, &def
.sig_pseudo
},
172 { "Sig_GenerateDS", 0, CONF_BOOL
, &def
.sig_gends
},
173 { "Sig_Parameter", 0, CONF_STRING
, &def
.sig_param
},
174 { "Distribute_Cmd", 0, CONF_STRING
, &def
.dist_cmd
},
175 { "NamedChrootDir", 0, CONF_STRING
, &def
.chroot_dir
},
177 { NULL
, 0, CONF_END
, NULL
},
180 /*****************************************************************
181 ** private (static) function deklaration and definition
182 *****************************************************************/
183 static const char *bool2str (int val
)
185 return val
? "True" : "False";
188 static const char *timeint2str (ulong val
)
190 static char str
[20+1];
193 snprintf (str
, sizeof (str
), "%lu", val
/ YEARSEC
);
194 else if ( val
% YEARSEC
== 0 )
195 snprintf (str
, sizeof (str
), "%luy", val
/ YEARSEC
);
196 else if ( val
% WEEKSEC
== 0 )
197 snprintf (str
, sizeof (str
), "%luw", val
/ WEEKSEC
);
198 else if ( val
% DAYSEC
== 0 )
199 snprintf (str
, sizeof (str
), "%lud", val
/ DAYSEC
);
200 else if ( val
% HOURSEC
== 0 )
201 snprintf (str
, sizeof (str
), "%luh", val
/ HOURSEC
);
202 else if ( val
% MINSEC
== 0 )
203 snprintf (str
, sizeof (str
), "%lum", val
/ MINSEC
);
205 snprintf (str
, sizeof (str
), "%lus", val
);
210 static int set_varptr (char *entry
, void *ptr
)
214 for ( c
= confpara
; c
->label
; c
++ )
215 if ( strcasecmp (entry
, c
->label
) == 0 )
223 static void set_all_varptr (zconf_t
*cp
)
225 set_varptr ("zonedir", &cp
->zonedir
);
226 set_varptr ("recursive", &cp
->recursive
);
227 set_varptr ("printage", &cp
->printage
);
228 set_varptr ("printtime", &cp
->printtime
);
229 set_varptr ("leftjustify", &cp
->ljust
);
231 set_varptr ("resigninterval", &cp
->resign
);
232 set_varptr ("sigvalidity", &cp
->sigvalidity
);
233 set_varptr ("max_ttl", &cp
->max_ttl
);
234 set_varptr ("key_ttl", &cp
->key_ttl
);
235 set_varptr ("propagation", &cp
->proptime
);
236 #if defined (DEF_TTL)
237 set_varptr ("def_ttl", &cp
->def_ttl
);
239 set_varptr ("serialformat", &cp
->serialform
);
241 set_varptr ("key_algo", &cp
->k_algo
);
242 set_varptr ("addkey_algo", &cp
->k2_algo
);
243 set_varptr ("ksk_lifetime", &cp
->k_life
);
244 set_varptr ("ksk_algo", &cp
->k_algo
); /* to be removed in next release */
245 set_varptr ("ksk_bits", &cp
->k_bits
);
246 set_varptr ("ksk_randfile", &cp
->k_random
);
248 set_varptr ("zsk_lifetime", &cp
->z_life
);
249 // set_varptr ("zsk_algo", &cp->z_algo);
250 set_varptr ("zsk_algo", &cp
->k2_algo
);
251 set_varptr ("zsk_bits", &cp
->z_bits
);
252 set_varptr ("zsk_randfile", &cp
->z_random
);
253 set_varptr ("saltbits", &cp
->saltbits
);
255 set_varptr ("--view", &cp
->view
);
256 set_varptr ("--noexec", &cp
->noexec
);
257 set_varptr ("logfile", &cp
->logfile
);
258 set_varptr ("loglevel", &cp
->loglevel
);
259 set_varptr ("syslogfacility", &cp
->syslogfacility
);
260 set_varptr ("sysloglevel", &cp
->sysloglevel
);
261 set_varptr ("verboselog", &cp
->verboselog
);
262 set_varptr ("-v", &cp
->verbosity
);
263 set_varptr ("keyfile", &cp
->keyfile
);
264 set_varptr ("zonefile", &cp
->zonefile
);
265 set_varptr ("keysetdir", &cp
->keysetdir
);
266 set_varptr ("dlv_domain", &cp
->lookaside
);
267 set_varptr ("sig_randfile", &cp
->sig_random
);
268 set_varptr ("sig_pseudorand", &cp
->sig_pseudo
);
269 set_varptr ("sig_generateds", &cp
->sig_gends
);
270 set_varptr ("sig_parameter", &cp
->sig_param
);
271 set_varptr ("distribute_cmd", &cp
->dist_cmd
);
272 set_varptr ("namedchrootdir", &cp
->chroot_dir
);
275 static void parseconfigline (char *buf
, unsigned int line
, zconf_t
*z
)
279 unsigned int len
, found
;
282 assert (buf
[0] != '\0');
284 p
= &buf
[strlen(buf
)-1]; /* Chop off white space at eol */
285 while ( p
>= buf
&& isspace (*p
) )
288 for (p
= buf
; isspace (*p
); p
++ ) /* Ignore leading white space */
291 /* Ignore comments and emtpy lines */
292 if ( *p
== '\0' || ISCOMMENT (p
) )
296 /* Get the end of the first argument */
297 end
= &buf
[strlen(buf
)-1];
298 while ( p
< end
&& !ISDELIM (*p
) ) /* Skip until delim */
300 *p
++ = '\0'; /* Terminate this argument */
301 dbg_val1 ("Parsing \"%s\"\n", tag
);
304 while ( p
< end
&& ISDELIM (*p
) ) /* Skip delim chars */
307 val
= p
; /* Start of the value */
308 dbg_val1 ("\tgot value \"%s\"\n", val
);
310 /* If starting with quote, skip until next quote */
311 if ( *p
== '"' || *p
== '\'' )
313 p
++; /* Find next quote */
314 while ( p
<= end
&& *p
&& *p
!= *val
)
317 val
++; /* Skip the first quote */
319 else /* Otherwise check if there is any comment char at the end */
321 while ( p
< end
&& *p
&& !ISCOMMENT(p
) )
325 do /* Chop off white space before comment */
327 while ( p
>= val
&& isspace (*p
) );
331 /* Otherwise it is already terminated above */
335 while ( !found
&& c
->type
!= CONF_END
)
337 len
= strlen (c
->label
);
338 if ( strcasecmp (tag
, c
->label
) == 0 )
350 str
= (char **)c
->var
;
352 str_untaint (*str
); /* remove "bad" characters */
355 sscanf (val
, "%d", (int *)c
->var
);
359 sscanf (val
, "%ld%c", &lval
, &quantity
);
360 if ( quantity
== 'm' )
362 else if ( quantity
== 'h' )
364 else if ( quantity
== 'd' )
366 else if ( quantity
== 'w' )
368 else if ( quantity
== 'y' )
370 (*(long *)c
->var
) = lval
;
373 if ( strcasecmp (val
, "rsa") == 0 || strcasecmp (val
, "rsamd5") == 0 )
374 *((int *)c
->var
) = DK_ALGO_RSA
;
375 else if ( strcasecmp (val
, "dsa") == 0 )
376 *((int *)c
->var
) = DK_ALGO_DSA
;
377 else if ( strcasecmp (val
, "rsasha1") == 0 )
378 *((int *)c
->var
) = DK_ALGO_RSASHA1
;
379 else if ( strcasecmp (val
, "nsec3dsa") == 0 ||
380 strcasecmp (val
, "n3dsa") == 0 )
381 *((int *)c
->var
) = DK_ALGO_NSEC3DSA
;
382 else if ( strcasecmp (val
, "nsec3rsasha1") == 0 ||
383 strcasecmp (val
, "n3rsasha1") == 0 )
384 *((int *)c
->var
) = DK_ALGO_NSEC3RSASHA1
;
386 error ("Illegal algorithm \"%s\" "
387 "in line %d.\n" , val
, line
);
390 if ( strcasecmp (val
, "unixtime") == 0 )
391 *((serial_form_t
*)c
->var
) = Unixtime
;
392 else if ( strcasecmp (val
, "incremental") == 0 )
393 *((serial_form_t
*)c
->var
) = Incremental
;
395 error ("Illegal serial no format \"%s\" "
396 "in line %d.\n" , val
, line
);
399 *((int *)c
->var
) = ISTRUE (val
);
402 fatal ("Illegal configuration type in line %d.\n", line
);
408 error ("Unknown configuration statement: %s \"%s\"\n", tag
, val
);
412 static void printconfigline (FILE *fp
, zconf_para_t
*cp
)
424 fprintf (fp
, "# %s\n", (char *)cp
->var
);
430 if ( *(char **)cp
->var
!= NULL
)
432 if ( **(char **)cp
->var
!= '\0' )
436 fprintf (fp
, "%s:\t", cp
->label
);
437 for ( p
= *(char **)cp
->var
; *p
; p
++ )
438 putc (toupper (*p
), fp
);
442 fprintf (fp
, "%s:\tNONE", cp
->label
);
446 if ( *(char **)cp
->var
)
447 fprintf (fp
, "%s:\t\"%s\"\n", cp
->label
, *(char **)cp
->var
);
450 fprintf (fp
, "%s:\t%s\n", cp
->label
, bool2str ( *(int*)cp
->var
));
453 lval
= *(ulong
*)cp
->var
; /* in that case it should be of type ulong */
454 fprintf (fp
, "%s:\t%s", cp
->label
, timeint2str (lval
));
456 fprintf (fp
, "\t# (%ld seconds)", lval
);
463 fprintf (fp
, "%s:\t%s", cp
->label
, dki_algo2str (i
));
464 fprintf (fp
, "\t# (Algorithm ID %d)\n", i
);
468 fprintf (fp
, "%s:\t", cp
->label
);
469 if ( *(serial_form_t
*)cp
->var
== Unixtime
)
470 fprintf (fp
, "unixtime\n");
472 fprintf (fp
, "incremental\n");
475 fprintf (fp
, "%s:\t%d\n", cp
->label
, *(int *)cp
->var
);
483 /*****************************************************************
484 ** public function definition
485 *****************************************************************/
487 /*****************************************************************
488 ** loadconfig (file, conf)
489 ** Loads a config file into the "conf" structure pointed to by "z".
490 ** If "z" is NULL then a new conf struct will be dynamically
492 ** If no filename is given the conf struct will be initialized
493 ** by the builtin default config
494 *****************************************************************/
495 zconf_t
*loadconfig (const char *filename
, zconf_t
*z
)
501 if ( z
== NULL
) /* allocate new memory for zconf_t */
503 if ( (z
= calloc (1, sizeof (zconf_t
))) == NULL
)
506 if ( filename
&& *filename
)
507 memcpy (z
, &def
, sizeof (zconf_t
)); /* init new struct with defaults */
510 if ( filename
== NULL
|| *filename
== '\0' ) /* no file name given... */
512 dbg_val0("loadconfig (NULL)\n");
513 memcpy (z
, &def
, sizeof (zconf_t
)); /* ..then init with defaults */
517 dbg_val1 ("loadconfig (%s)\n", filename
);
520 if ( (fp
= fopen(filename
, "r")) == NULL
)
521 fatal ("Could not open config file \"%s\"\n", filename
);
524 while (fgets(buf
, sizeof(buf
), fp
))
525 parseconfigline (buf
, ++line
, z
);
531 # define STRCONFIG_DELIMITER ";\r\n"
532 zconf_t
*loadconfig_fromstr (const char *str
, zconf_t
*z
)
540 if ( (z
= calloc (1, sizeof (zconf_t
))) == NULL
)
542 memcpy (z
, &def
, sizeof (zconf_t
)); /* init with defaults */
545 if ( str
== NULL
|| *str
== '\0' )
547 dbg_val0("loadconfig_fromstr (NULL)\n");
548 memcpy (z
, &def
, sizeof (zconf_t
)); /* init with defaults */
552 dbg_val1 ("loadconfig_fromstr (\"%s\")\n", str
);
555 /* str is const, so we have to copy it into a new buffer */
556 if ( (buf
= strdup (str
)) == NULL
)
557 fatal ("loadconfig_fromstr: Out of memory");
560 tok
= strtok_r (buf
, STRCONFIG_DELIMITER
, &toksave
);
564 parseconfigline (tok
, line
, z
);
565 tok
= strtok_r (NULL
, STRCONFIG_DELIMITER
, &toksave
);
571 /*****************************************************************
572 ** dupconfig (config)
573 ** duplicate config struct and return a ptr to the new struct
574 *****************************************************************/
575 zconf_t
*dupconfig (const zconf_t
*conf
)
579 assert (conf
!= NULL
);
581 if ( (z
= calloc (1, sizeof (zconf_t
))) == NULL
)
584 memcpy (z
, conf
, sizeof (zconf_t
));
589 /*****************************************************************
590 ** setconfigpar (entry, pval)
591 *****************************************************************/
592 int setconfigpar (zconf_t
*config
, char *entry
, const void *pval
)
597 set_all_varptr (config
);
599 for ( c
= confpara
; c
->type
!= CONF_END
; c
++ )
600 if ( strcasecmp (entry
, c
->label
) == 0 )
609 str
= strdup ((char *)pval
);
610 str_untaint (str
); /* remove "bad" characters */
614 *((char **)c
->var
) = str
;
621 *((int *)c
->var
) = *((int *)pval
);
624 *((long *)c
->var
) = *((long *)pval
);
627 *((serial_form_t
*)c
->var
) = *((serial_form_t
*)pval
);
639 /*****************************************************************
640 ** printconfig (fname, config)
641 *****************************************************************/
642 int printconfig (const char *fname
, const zconf_t
*z
)
651 if ( fname
&& *fname
)
653 if ( strcmp (fname
, "stdout") == 0 )
655 else if ( strcmp (fname
, "stderr") == 0 )
657 else if ( (fp
= fopen(fname
, "w")) == NULL
)
659 error ("Could not open config file \"%s\" for writing\n", fname
);
664 set_all_varptr ((zconf_t
*)z
);
666 for ( cp
= confpara
; cp
->type
!= CONF_END
; cp
++ ) /* loop through all parameter */
667 if ( !cp
->cmdline
) /* if this is not a command line parameter ? */
668 printconfigline (fp
, cp
); /* print it out */
670 if ( fp
&& fp
!= stdout
&& fp
!= stderr
)
677 /*****************************************************************
678 ** printconfigdiff (fname, conf_a, conf_b)
679 *****************************************************************/
680 int printconfigdiff (const char *fname
, const zconf_t
*ref
, const zconf_t
*z
)
685 if ( ref
== NULL
|| z
== NULL
)
689 if ( fname
&& *fname
)
691 if ( strcmp (fname
, "stdout") == 0 )
693 else if ( strcmp (fname
, "stderr") == 0 )
695 else if ( (fp
= fopen(fname
, "w")) == NULL
)
697 error ("Could not open config file \"%s\" for writing\n", fname
);
702 set_all_varptr ((zconf_t
*)z
);
704 for ( cp
= confpara
; cp
->type
!= CONF_END
; cp
++ ) /* loop through all parameter */
710 printconfigline (fp
, cp
); /* print it out */
713 if ( fp
&& fp
!= stdout
&& fp
!= stderr
)
720 /*****************************************************************
721 ** checkconfig (config)
722 *****************************************************************/
723 int checkconfig (const zconf_t
*z
)
728 if ( z
->saltbits
< 4 )
729 fprintf (stderr
, "Saltlength must be at least 4 bits\n");
730 if ( z
->saltbits
> 128 )
732 fprintf (stderr
, "While the maximum is 520 bits of salt, it's not recommended to use more than 128 bits.\n");
733 fprintf (stderr
, "The current value is %d bits\n", z
->saltbits
);
736 if ( z
->sigvalidity
< (1 * DAYSEC
) || z
->sigvalidity
> (12 * WEEKSEC
) )
738 fprintf (stderr
, "Signature should be valid for at least 1 day and no longer than 3 month (12 weeks)\n");
739 fprintf (stderr
, "The current value is %s\n", timeint2str (z
->sigvalidity
));
742 if ( z
->resign
> (z
->sigvalidity
*5/6) - (z
->max_ttl
+ z
->proptime
) )
744 fprintf (stderr
, "Re-signing interval (%s) should be less than ", timeint2str (z
->resign
));
745 fprintf (stderr
, "5/6 of sigvalidity\n");
747 if ( z
->resign
< (z
->max_ttl
+ z
->proptime
) )
749 fprintf (stderr
, "Re-signing interval (%s) should be ", timeint2str (z
->resign
));
750 fprintf (stderr
, "greater than max_ttl (%ld) plus ", z
->max_ttl
);
751 fprintf (stderr
, "propagation time (%ld)\n", z
->proptime
);
754 if ( z
->max_ttl
>= z
->sigvalidity
)
755 fprintf (stderr
, "Max TTL (%ld) should be less than signature validity (%ld)\n",
756 z
->max_ttl
, z
->sigvalidity
);
758 if ( z
->z_life
> (12 * WEEKSEC
) * (z
->z_bits
/ 512.) )
760 fprintf (stderr
, "Lifetime of zone signing key (%s) ", timeint2str (z
->z_life
));
761 fprintf (stderr
, "seems a little bit high ");
762 fprintf (stderr
, "(In respect of key size (%d))\n", z
->z_bits
);
765 if ( z
->k_life
> 0 && z
->k_life
<= z
->z_life
)
767 fprintf (stderr
, "Lifetime of key signing key (%s) ", timeint2str (z
->k_life
));
768 fprintf (stderr
, "should be greater than lifetime of zsk\n");
770 if ( z
->k_life
> 0 && z
->k_life
> (26 * WEEKSEC
) * (z
->k_bits
/ 512.) )
772 fprintf (stderr
, "Lifetime of key signing key (%s) ", timeint2str (z
->k_life
));
773 fprintf (stderr
, "seems a little bit high ");
774 fprintf (stderr
, "(In respect of key size (%d))\n", z
->k_bits
);
781 const char *progname
;
782 static zconf_t
*config
;
784 main (int argc
, char *argv
[])
791 config
= loadconfig ("", (zconf_t
*) NULL
); /* load built in defaults */
793 while ( --argc
>= 1 )
796 config
= loadconfig_fromstr (optstr
, config
);
800 setconfigpar (config
, "-v", &val
);
802 setconfigpar (config
, "verboselog", &val
);
804 setconfigpar (config
, "recursive", &val
);
806 setconfigpar (config
, "propagation", &val
);
808 printconfig ("stdout", config
);