/[pdpsoft]/nl.nikhef.pdp.fetchcrl/trunk/fetch-crl3.pl.cin
ViewVC logotype

Diff of /nl.nikhef.pdp.fetchcrl/trunk/fetch-crl3.pl.cin

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/fetchcrl/fetch-crl3.pl revision 1767 by davidg, Fri Jun 11 19:44:35 2010 UTC nl.nikhef.pdp.fetchcrl/trunk/fetch-crl3.pl revision 2305 by davidg, Sun Jun 12 20:59:58 2011 UTC
# Line 78  $::cnf->{_}->{"infodir"} and do { Line 78  $::cnf->{_}->{"infodir"} and do {
78    foreach my $fn (    foreach my $fn (
79        map { glob ( $::cnf->{_}->{"infodir"} . "/$_" ); } "*.info", "*.crl_url"        map { glob ( $::cnf->{_}->{"infodir"} . "/$_" ); } "*.info", "*.crl_url"
80      ) {      ) {
81        next if $::cnf->{_}->{nosymlinks} and -l $fn;
82      $fn =~ /.*\/([^\/]+)(\.crl_url|\.info)$/;      $fn =~ /.*\/([^\/]+)(\.crl_url|\.info)$/;
83      push @metafiles, $1 unless grep /$1/,@metafiles or not defined $1;      push @metafiles, $1 unless grep /^$1$/,@metafiles or not defined $1;
84    }    }
85  };  };
86    
# Line 111  sub init_configuration() { Line 112  sub init_configuration() {
112    my $debuglevel;    my $debuglevel;
113    my $parallelism=0;    my $parallelism=0;
114    my $randomwait;    my $randomwait;
115      my $nosymlinks;
116      my $cfgdir;
117    
118    $log = FCLog->new("qualified");    $log = FCLog->new("qualified");
119    
# Line 119  sub init_configuration() { Line 122  sub init_configuration() {
122      "l|infodir=s" => \$infodir,      "l|infodir=s" => \$infodir,
123      "cadir=s" => \$cadir,      "cadir=s" => \$cadir,
124      "s|statedir=s" => \$statedir,      "s|statedir=s" => \$statedir,
125        "cfgdir=s" => \$cfgdir,
126      "T|httptimeout=i" => \$httptimeout,      "T|httptimeout=i" => \$httptimeout,
127      "o|output=s" => \$output,      "o|output=s" => \$output,
128      "format=s@" => \@formats,      "format=s@" => \@formats,
# Line 127  sub init_configuration() { Line 131  sub init_configuration() {
131      "q|quiet+" => \$quiet,      "q|quiet+" => \$quiet,
132      "d|debug+" => \$debuglevel,      "d|debug+" => \$debuglevel,
133      "p|parallelism=i" => \$parallelism,      "p|parallelism=i" => \$parallelism,
134        "nosymlinks+" => \$nosymlinks,
135      "a|agingtolerance=i" => \$agingtolerance,      "a|agingtolerance=i" => \$agingtolerance,
136      "r|randomwait=i" => \$randomwait,      "r|randomwait=i" => \$randomwait,
137      ) or &help and exit(1);      ) or &help and exit(1);
138    
139    $help and &help and exit(0);    $help and &help and exit(0);
140    
141      $configfile ||= ( -e "/etc/fetch-crl.conf" and "/etc/fetch-crl.conf" );
142    $configfile ||= ( -e "/etc/fetch-crl.cnf" and "/etc/fetch-crl.cnf" );    $configfile ||= ( -e "/etc/fetch-crl.cnf" and "/etc/fetch-crl.cnf" );
143    ($quiet > 0) and $verbosity = -$quiet;    ($quiet > 0) and $verbosity = -$quiet;
144    
# Line 141  sub init_configuration() { Line 147  sub init_configuration() {
147      $cnf->read($configfile) || die "Invalid config file $configfile:\n  " .      $cnf->read($configfile) || die "Invalid config file $configfile:\n  " .
148                                     $cnf->errstr . "\n";                                     $cnf->errstr . "\n";
149    
150      ( defined $cnf->{_}->{cfgdir} and $cfgdir = $cnf->{_}->{cfgdir} )
151        unless defined $cfgdir;
152      $cfgdir ||= "/etc/fetch-crl.d";
153      if ( defined $cfgdir and -d $cfgdir and opendir(my $dh,$cfgdir) ) {
154        while ( my $fn = readdir $dh ) {
155          -f "$cfgdir/$fn" and -r "$cfgdir/$fn" and $cnf->read("$cfgdir/$fn");
156        }
157        close $dh;
158      }
159    
160    # command-line option overrides    # command-line option overrides
161    $cnf->{_}->{agingtolerance} = $agingtolerance if defined $agingtolerance;    $cnf->{_}->{agingtolerance} = $agingtolerance if defined $agingtolerance;
162    $cnf->{_}->{infodir}        = $infodir if defined $infodir;    $cnf->{_}->{infodir}        = $infodir if defined $infodir;
# Line 150  sub init_configuration() { Line 166  sub init_configuration() {
166    $cnf->{_}->{verbosity}      = $verbosity if defined $verbosity;    $cnf->{_}->{verbosity}      = $verbosity if defined $verbosity;
167    $cnf->{_}->{debuglevel}     = $debuglevel if defined $debuglevel;    $cnf->{_}->{debuglevel}     = $debuglevel if defined $debuglevel;
168    $cnf->{_}->{output}         = $output if defined $output;    $cnf->{_}->{output}         = $output if defined $output;
169    $cnf->{_}->{formats}        = join "&",@formats if @formats;    $cnf->{_}->{formats}        = join "\001",@formats if @formats;
170    $cnf->{_}->{parallelism}    = $parallelism if $parallelism;    $cnf->{_}->{parallelism}    = $parallelism if $parallelism;
171    $cnf->{_}->{randomwait}     = $randomwait if defined $randomwait;    $cnf->{_}->{randomwait}     = $randomwait if defined $randomwait;
172      $cnf->{_}->{nosymlinks}     = $nosymlinks if defined $nosymlinks;
173    
174    # key default values    # key default values
175    defined $cnf->{_}->{version}  or $cnf->{_}->{version}    = "3+";    defined $cnf->{_}->{version}  or $cnf->{_}->{version}    = "3+";
# Line 171  sub init_configuration() { Line 188  sub init_configuration() {
188    defined $cnf->{_}->{nametemplate_pem} or    defined $cnf->{_}->{nametemplate_pem} or
189      $cnf->{_}->{nametemplate_pem} = "\@ANCHORNAME\@.\@R\@.crl.pem";      $cnf->{_}->{nametemplate_pem} = "\@ANCHORNAME\@.\@R\@.crl.pem";
190    defined $cnf->{_}->{catemplate} or    defined $cnf->{_}->{catemplate} or
191      $cnf->{_}->{catemplate} = "\@ALIAS\@.pem&".      $cnf->{_}->{catemplate} = "\@ALIAS\@.pem\001".
192                                "\@ALIAS\@.\@R\@&\@ANCHORNAME\@.\@R\@";                                "\@ALIAS\@.\@R\@\001\@ANCHORNAME\@.\@R\@";
193    
194    $cnf->{_}->{nonssverify}    ||= 0;    $cnf->{_}->{nonssverify}    ||= 0;
195    $cnf->{_}->{nocache}        ||= 0;    $cnf->{_}->{nocache}        ||= 0;
196      $cnf->{_}->{nosymlinks}     ||= 0;
197    $cnf->{_}->{verbosity}      ||= 0;    $cnf->{_}->{verbosity}      ||= 0;
198    $cnf->{_}->{debuglevel}     ||= 0;    $cnf->{_}->{debuglevel}     ||= 0;
199    
# Line 183  sub init_configuration() { Line 201  sub init_configuration() {
201    
202    # expand array keys in config    # expand array keys in config
203    defined $cnf->{_}->{formats} and    defined $cnf->{_}->{formats} and
204      @{$cnf->{_}->{formats_}} = split(/[&;,\s]+/,$cnf->{_}->{formats});      @{$cnf->{_}->{formats_}} = split(/[\001;,\s]+/,$cnf->{_}->{formats});
205    
206    # sanity check on configuration    # sanity check on configuration
207    $cnf->{_}->{statedir} and ! -d $cnf->{_}->{statedir} and    $cnf->{_}->{statedir} and ! -d $cnf->{_}->{statedir} and
# Line 194  sub init_configuration() { Line 212  sub init_configuration() {
212    # initialize logging    # initialize logging
213    $log->flush;    $log->flush;
214    $cnf->{_}->{logmode} and $log->destremove("qualified") and do {    $cnf->{_}->{logmode} and $log->destremove("qualified") and do {
215      foreach ( split(/[,&]+/,$cnf->{_}->{logmode}) ) {      foreach ( split(/[,\001]+/,$cnf->{_}->{logmode}) ) {
216        if ( /^syslog$/ ) { $log->destadd($_,$cnf->{_}->{syslogfacility}); }        if ( /^syslog$/ ) { $log->destadd($_,$cnf->{_}->{syslogfacility}); }
217        elsif ( /^(direct|qualified|cache)$/ ) { $log->destadd($_); }        elsif ( /^(direct|qualified|cache)$/ ) { $log->destadd($_); }
218        else { die "Invalid log destination $_, exiting.\n"; }        else { die "Invalid log destination $_, exiting.\n"; }
# Line 218  files. It will install these for use wit Line 236  files. It will install these for use wit
236    
237  Usage: $name [-c|--config configfile] [-l|--infodir path]  Usage: $name [-c|--config configfile] [-l|--infodir path]
238    [--cadir path] [-s|--statedir path] [-o|--output path] [--format \@formats]    [--cadir path] [-s|--statedir path] [-o|--output path] [--format \@formats]
239    [-T|--httptimeout seconds] [-p|--parallelism n]    [-T|--httptimeout seconds] [-p|--parallelism n] [--nosymlinks]
240    [-a|--agingtolerance hours] [-r|--randomwait seconds]    [-a|--agingtolerance hours] [-r|--randomwait seconds]
241    [-v|--verbose] [-h|--help] [-q|--quiet] [-d|--debug level]    [-v|--verbose] [-h|--help] [-q|--quiet] [-d|--debug level]
242    
243  Options:  Options:
244   -c | --config path   -c | --config path
245          Read configuration data from path, default: /etc/fetch-crl.cnf          Read configuration data from path, default: /etc/fetch-crl.conf
246   -l | --infodir path   -l | --infodir path
247          Location of the trust anchor meta-data files (crl_url or info),          Location of the trust anchor meta-data files (crl_url or info),
248          default: /etc/grid-security/certificates          default: /etc/grid-security/certificates
# Line 238  Options: Line 256  Options:
256          Location of the CRLs written (global default, defaults to infodir          Location of the CRLs written (global default, defaults to infodir
257   --format \@formats   --format \@formats
258          Format(s) in which the CRLs will be written (openssl, pem, der, nss)          Format(s) in which the CRLs will be written (openssl, pem, der, nss)
259     --nosymlinks
260            Do not include meta-data files that are symlinks
261   -v | --verbose   -v | --verbose
262          Become more talkative          Become more talkative
263   -q | --quiet   -q | --quiet

Legend:
Removed from v.1767  
changed lines
  Added in v.2305

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28