Initial import of the 'spf' utility.

See https://www.netmeister.org/blog/spf.html for a longer discussion.

NAME
     spf - report on the given domain's use of SPF

SYNOPSIS
     spf [-Vhjv] [-r address] domain

DESCRIPTION
     The spf tool allows you to inspect the Sender Policy Framework DNS records
     for the given domain.

OPTIONS
     The following options are supported by spf:

     -V		 Print version information and exit.

     -h		 Display help and exit.

     -j		 Generate output in json format.

     -r address	 Explicitly query this resolver.

     -v		 Be verbose.  Can be specified multiple times.

DETAILS
     The Sender Policy Framework (SPF) defined in RFC7208 specifies the format
     for the SPF DNS entries a domain may choose to apply.  These entries can
     range from the straight forward to the complex, harboring certain surprises
     or unintenionally obscuring important information, such as when one domain
     includes the SPF records of another domain.

     spf can be used to report on the comprehensive ruleset derived from the DNS
     record.  It does that by counting CIDRs, resolving e.g., MX records, and
     recursively looking up SPF records of any included domains.

EXAMPLES
     The following examples illustrate common usage of this tool.

     To report on the SPF records for the domain netmeister.org:

	   spf netmeister.org

     To query Quad9's public resolver for the same SPF records and report the
     results in json format:

	   spf -r 2620:fe::fe -j netmeister.org

EXIT STATUS
     The spf utility exits 0 on success, and >0 if an error occurs.

SEE ALSO
     dig(1)

HISTORY
     spf was originally written by Jan Schaumann <[email protected]> in
     July 2022.

BUGS
     Please file bugs and feature requests by emailing the author.
This commit is contained in:
Jan Schaumann
2022-08-30 18:25:43 -04:00
commit 6f8fcff364
5 changed files with 1393 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
NAME=spf
PREFIX?=/usr/local
PERL!=which perl
help:
@echo "The following targets are available:"
@echo "clean remove temporary files"
@echo "install install ${NAME} under ${PREFIX}"
@echo "prep update the perl path in the source script"
@echo "readme generate the README after a manual page update"
prep: src/${NAME}
src/${NAME}: src/${NAME}.pl
sed -e "s|/usr/local/bin/perl|${PERL}|" $? >$@
install: prep
mkdir -p ${PREFIX}/bin ${PREFIX}/share/man/man1
install -c -m 555 src/${NAME} ${PREFIX}/bin/${NAME}
install -c -m 444 doc/${NAME}.1 ${PREFIX}/share/man/man1/${NAME}.1
clean:
rm -f src/${NAME}
man: doc/${NAME}.1.txt
doc/${NAME}.1.txt: doc/${NAME}.1
mandoc -c -O width=80 $? | col -b >$@
readme: man
sed -n -e '/^NAME/!p;//q' README.md >.readme
sed -n -e '/^NAME/,$$p' -e '/emailing/q' doc/${NAME}.1.txt >>.readme
echo '```' >>.readme
mv .readme README.md
+102
View File
@@ -0,0 +1,102 @@
# spf -- expand and report on a given domain's SPF policy
The syntax for the Sender Policy Framework (SPF)
definition via a DNS TXT record is complex and
expansion and inspection of the final ruleset requires
possibly multiple DNS lookups.
The `spf` utility can be used to easily expand a
domain's policy and report on its definition from the
command-line.
For a longer discussion of SPF, please see this blog
post:
https://www.netmeister.org/blog/spf.html
Requirements
============
`spf(1)` is written in Perl, and you will need
the following modules installed:
* JSON
* Net::DNS
* Net::Netmask
Installation
============
To install the command and manual page somewhere
convenient, run `make install`; the Makefile defaults
to '/usr/local' but you can change the PREFIX:
```
$ make PREFIX=~ install
```
Documentation
=============
Please see the manual page for all details:
```
NAME
spf - report on the given domain's use of SPF
SYNOPSIS
spf [-Vhjv] [-r address] domain
DESCRIPTION
The spf tool allows you to inspect the Sender Policy Framework DNS records
for the given domain.
OPTIONS
The following options are supported by spf:
-V Print version information and exit.
-h Display help and exit.
-j Generate output in json format.
-r address Explicitly query this resolver.
-v Be verbose. Can be specified multiple times.
DETAILS
The Sender Policy Framework (SPF) defined in RFC7208 specifies the format
for the SPF DNS entries a domain may choose to apply. These entries can
range from the straight forward to the complex, harboring certain surprises
or unintenionally obscuring important information, such as when one domain
includes the SPF records of another domain.
spf can be used to report on the comprehensive ruleset derived from the DNS
record. It does that by counting CIDRs, resolving e.g., MX records, and
recursively looking up SPF records of any included domains.
EXAMPLES
The following examples illustrate common usage of this tool.
To report on the SPF records for the domain netmeister.org:
spf netmeister.org
To query Quad9's public resolver for the same SPF records and report the
results in json format:
spf -r 2620:fe::fe -j netmeister.org
EXIT STATUS
The spf utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
dig(1)
HISTORY
spf was originally written by Jan Schaumann <[email protected]> in
July 2022.
BUGS
Please file bugs and feature requests by emailing the author.
```
+75
View File
@@ -0,0 +1,75 @@
.\"
.Dd August 09, 2022
.Dt spf 1
.Os
.Sh NAME
.Nm spf
.Nd report on the given domain's use of SPF
.Sh SYNOPSIS
.Nm
.Op Fl Vhjv
.Op Fl r Ar address
.Ar domain
.Sh DESCRIPTION
The
.Nm
tool allows you to inspect the Sender Policy Framework
DNS records for the given domain.
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width r_address_
.It Fl V
Print version information and exit.
.It Fl h
Display help and exit.
.It Fl j
Generate output in json format.
.It Fl r Ar address
Explicitly query this resolver.
.It Fl v
Be verbose.
Can be specified multiple times.
.El
.Sh DETAILS
The Sender Policy Framework (SPF) defined in RFC7208
specifies the format for the SPF DNS entries a domain
may choose to apply.
These entries can range from the straight forward to
the complex, harboring certain surprises or
unintenionally obscuring important information, such
as when one domain includes the SPF records of another
domain.
.Pp
.Nm
can be used to report on the comprehensive ruleset
derived from the DNS record.
It does that by counting CIDRs, resolving e.g., MX
records, and recursively looking up SPF records of any
included domains.
.Sh EXAMPLES
The following examples illustrate common usage of this tool.
.Pp
To report on the SPF records for the domain
netmeister.org:
.Bd -literal -offset indent
spf netmeister.org
.Ed
.Pp
To query Quad9's public resolver for the same SPF
records and report the results in json format:
.Bd -literal -offset indent
spf -r 2620:fe::fe -j netmeister.org
.Ed
.Sh EXIT STATUS
.Ex -std
.Sh SEE ALSO
.Xr dig 1
.Sh HISTORY
.Nm
was originally written by
.An Jan Schaumann
.Aq [email protected]
in July 2022.
.Sh BUGS
Please file bugs and feature requests by emailing the author.
+62
View File
@@ -0,0 +1,62 @@
spf(1) General Commands Manual spf(1)
NAME
spf - report on the given domain's use of SPF
SYNOPSIS
spf [-Vhjv] [-r address] domain
DESCRIPTION
The spf tool allows you to inspect the Sender Policy Framework DNS records
for the given domain.
OPTIONS
The following options are supported by spf:
-V Print version information and exit.
-h Display help and exit.
-j Generate output in json format.
-r address Explicitly query this resolver.
-v Be verbose. Can be specified multiple times.
DETAILS
The Sender Policy Framework (SPF) defined in RFC7208 specifies the format
for the SPF DNS entries a domain may choose to apply. These entries can
range from the straight forward to the complex, harboring certain surprises
or unintenionally obscuring important information, such as when one domain
includes the SPF records of another domain.
spf can be used to report on the comprehensive ruleset derived from the DNS
record. It does that by counting CIDRs, resolving e.g., MX records, and
recursively looking up SPF records of any included domains.
EXAMPLES
The following examples illustrate common usage of this tool.
To report on the SPF records for the domain netmeister.org:
spf netmeister.org
To query Quad9's public resolver for the same SPF records and report the
results in json format:
spf -r 2620:fe::fe -j netmeister.org
EXIT STATUS
The spf utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
dig(1)
HISTORY
spf was originally written by Jan Schaumann <[email protected]> in
July 2022.
BUGS
Please file bugs and feature requests by emailing the author.
NetBSD 8.0 August 9, 2022 NetBSD 8.0
Executable
+1119
View File
File diff suppressed because it is too large Load Diff