Skip to content

A DNS TLSRPT ressource record and conformance test parser written in Python

License

Notifications You must be signed in to change notification settings

sys4/tlsrpt-rr-parser

Repository files navigation

tlsrpt-policy

Parse and validate SMTP TLS Reporting (RFC 8460) policies in Python.

RFC 8460 defines a mechanism for receiving reports about TLS misconfigurations and errors. In order to receive a report, mail server administors will add a special TXT-record (e.g. _smtp._tls.example.com) to their domain. This record is called the TLSRPT policy and looks something like this: TXT "v=TLSRPTv1; rua=mailto:smtp-tls-report@example.com".

The purpose of this module is to provide a parser and validator for these records in Python. It uses PyParsing to implement the grammar as specified in RFC 8460, section 3.

Installation

tlsrpt-policy is hosted on PyPI and you can install it in a virtual environment like this:

$ pip install tlsrpt-policy

How to use

parse_silent()

The function parse_silent() will not throw an error when parsing an invalid TLSRPT policy record. If the record is not well-formed then this function will simply return None.

Here is an example of how to use the silent parser:

>>> from tlsrpt_policy.tlsrpt_parsing import parse_silent
>>> TXT_RECORD = "v=TLSRPTv1; rua=https://reporting.example.com/v1/tlsrpt"
>>> tlsrpt_parsing.parse_silent(TXT_RECORD)
...

Developed With Support By

Credits

Based on the SPF parser of the Internet.nl project.

About

A DNS TLSRPT ressource record and conformance test parser written in Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published