Lines Matching +full:sub +full:- +full:modules
1 #! @PATH_PERL@ -w
21 # Core modules
29 # External modules
44 # HTTPS - (default)
45 # https://www.ietf.org/timezones/data/leap-seconds
46 # HTTP - No TLS/SSL - (not recommended)
47 # http://www.ietf.org/timezones/data/leap-seconds.list
49 my $LEAPSRC = 'https://www.ietf.org/timezones/data/leap-seconds.list';
119 # Logging - Default is to use syslog(3) if STDOUT isn't
121 if ($SYSLOG || !-t STDOUT) {
130 log_fatal(LOG_ERR, '-q and -v options mutually exclusive');
134 log_fatal(LOG_ERR, '-L and -f options mutually exclusive');
172 -s $LEAPFILE || logger(LOG_DEBUG, "Leapfile $LEAPFILE is empty");
176 # 2. invoked w/ force flag (-F)
180 if ( !-e $LEAPFILE || $FORCE || ! verifySHA($LEAPFILE) ||
196 logger(LOG_ERR, "Downloaded file $TMP_FILE rejected -- saved for diagnosis");
197 move_file($TMP_FILE, 'leap-seconds.list_corrupt');
218 ######## SUB ROUTINES #########
219 sub move_file {
232 sub signal_catcher {
240 sub log_fatal {
246 sub logger {
281 sub retrieve_file {
287 $http = HTTP::Tiny->new(%SSL_ATTRS);
288 (my $ok, my $why) = $http->can_ssl;
292 $http = HTTP::Tiny->new();
295 my $reply = $http->get($LEAPSRC);
297 if ($reply->{success}) {
299 print $fh $reply->{content} ||
311 # Validate a leap-seconds file checksum
317 # #h hex hex hex hex hex : the SHA-1 checksum of the data & dates,
328 sub verifySHA {
348 $EXPIRES = $_ - 2208988800;
395 sub show_help {
400 Verifies and if necessary, updates leap-second definition file
403 -C Absolute path to CA Cert (see SSL/TLS Considerations)
404 -D Path to a CAdir (see SSL/TLS Considerations)
405 -e Specify how long (in days) before expiration the file is to be
408 -F Force update even if current file is OK and not close to expiring.
409 -f Absolute path ntp.conf file (default /etc/ntp.conf)
411 -h show help
412 -i Specify number of minutes between retries
414 -L Absolute path to leapfile on the local system
416 -l Specify the syslog(3) facility for logging
418 -q Only report errors (cannot be used with -v)
419 -r Specify number of attempts to retrieve file
421 -s Send output to syslog(3) - implied if STDOUT has no tty or redirected
422 -t Send output to terminal - implied if STDOUT attached to terminal
423 -u Specify the URL of the master copy to download
425 -v Verbose - show debug messages (cannot be used with -q)
428 -4 Use only IPv4
429 -6 Use only IPv6
430 -c Command to restart NTP after installing a new file
431 <none> - ntpd checks file daily
432 -p 4|6
439 command line with the -L flag.
453 -----------------------
454 The perl modules can usually locate the CA certificate used to verify
458 Linux, the location is typically a path to a CAdir - a directory of
461 The -C or -D options are available to pass in a location if no CA cert
465 ---------------------
466 The following perl modules are required:
467 HTTP::Tiny - version >= 0.056
468 IO::Socket::SSL - version >= 1.56
469 NET::SSLeay - version >= 1.49