File: dmarc_update_public_suffix_list

package info (click to toggle)
libmail-dmarc-perl 1.20211209-4
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 1,724 kB
  • sloc: perl: 4,937; xml: 13; makefile: 10; sh: 1
file content (91 lines) | stat: -rwxr-xr-x 1,863 bytes parent folder | download | duplicates (2)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/perl
use strict;
use warnings;

use Getopt::Long;
use HTTP::Tiny;
use Mail::DMARC;
use Pod::Usage;

my $dryrun = 0;
my $random = 0;

GetOptions (
    'dryrun' => \$dryrun,
    'help'   => \my $help,
    'random' => \$random,
    'config-file=s' => \my $config_file,
);

pod2usage if $help;

if ( $random ) {
    my $sleep_for = int(rand(60*60));
    sleep $sleep_for;
}

Mail::DMARC->new(
    (defined $config_file ? (config_file => $config_file) : ())
)->update_psl_file($dryrun);

__END__

=pod

=head1 NAME

dmarc_update_public_suffix_list - command line tool to download updated public suffix list

=head1 SYNOPSIS

  dmarc_update_public_suffix_list [ --option=value ]

=head1 DESCRIPTION

Downloads a new Public Suffix List to the location specified by /etc/mail-dmarc.ini

The PSL is maintained by the Mozilla Foundation. It is updated a few times per
month, you are requested to download no more than once per day.

The URL of the file is https://publicsuffix.org/list/effective_tld_names.dat
More details can be found at https://publicsuffix.org/

=head2 Options

  dmarc_update_public_suffix_list [ --dryrun --help ]

    dryrun       - show what would be done without overwriting file
    random       - introduce a random delay to spread server load
                   intended for use when running from crontab
    config-file  - alternate config file path
    help         - print this syntax guide

=head1 EXAMPLES

To check that a new file can be downloaded without error but not download the file:

  dmarc_update_public_suffix_list --dryrun

To download a new Public Suffix List to the location specified my mail-dmarc.ini

  dmarc_update_public_suffix_list

=head1 AUTHORS

=over 4

=item *

Matt Simerson <msimerson@cpan.org>

=item *

Davide Migliavacca <shari@cpan.org>

=item *

Marc Bradshaw <marc@marcbradshaw.net>

=back

=cut