File: dmarc_httpd

package info (click to toggle)
libmail-dmarc-perl 1.20240314-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,852 kB
  • sloc: perl: 4,944; xml: 13; makefile: 10; sh: 1
file content (102 lines) | stat: -rwxr-xr-x 2,135 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
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/perl
use strict;
use warnings;

use lib 'lib';
use Mail::DMARC;
use Mail::DMARC::HTTP;

my $dmarc = Mail::DMARC->new();
$dmarc->is_public_suffix('tnpi.net');
my $report = $dmarc->report;
my $http = Mail::DMARC::HTTP->new;
$http->dmarc_httpd($report);
exit;

__END__

=pod

=head1 NAME

dmarc_httpd: a web server for DMARC validation and report viewing

=head1 SYNOPSIS

A HTTP interface for:

=over 4

=item * local DMARC reports

=item * DMARC validator service

=back

Start the HTTP server:

    dmarc_httpd

Connect with a web browser to L<http://localhost:8080|http://localhost:8080/>.

=head1 DESCRIPTION

The HTTP server handles 4 types of requests:

=over 4

=item * /

Serves files stored in the perl share directory of the Mail::DMARC module.
This presently entails one HTML file and a handful of CSS and JS files for
the report viewing feature.

=item * /dmarc/json/validate - DMARC validation requests

Accepts a JSON encoded HTTP POST request. Validates the request, performs a
DMARC validation and returns a JSON encoded result object. This is the API
for non-perl applications to utilize Mail::DMARC.

See the dmarc_http_client app for a usage example.

=item * /dmarc/json/report

Accepts AJAX requests from the browser and returns JSON encoded DMARC reports.

=item * /dmarc/json/row

Accepts AJAX requests from the browser and returns JSON encoded DMARC report rows.

=back

An implementation that uses the http validation service is the included <dmarc_http_client> and another is the dmarc plugin in the <Haraka mail server|http://haraka.github.io>.

A L<Sample Report|http://search.cpan.org/dist/Mail-DMARC/example/report_cgi.png> is available which shows the web interface. It is implemented almost entirely in JavaScript, using jQuery, jQueryUI, and jqGrid.

Web server settings are in the [http] and [https] sections of mail-dmarc.ini.

=head1 THANKS

jQuery - http://www.jquery.com/

jqGrid - http://www.trirand.com/blog/

=head1 AUTHORS

=over 4

=item *

Matt Simerson <msimerson@cpan.org>

=item *

Davide Migliavacca <shari@cpan.org>

=item *

Marc Bradshaw <marc@marcbradshaw.net>

=back

=cut