smtpd-tls
An extension to the python 2.x smtpd standard library implementing implicit/explicit (STARTTLS) SSL/TLS support
added STARTTLS handling
added implicit tls
just pass a configured ssl.context (certs, keys, protocols, auth, …) to smtpd-tls.SMTPServer()
original smtpd pydoc: https://docs.python.org/2/library/smtpd.html
Requires Python 2.7 or higher
Install
from pip
pip install smtpd-tls
from source
python setup.py install
verify:
#> python -c "import smtpd_tls; print smtpd_tls" #> python -m smtpd_tls --help
Example
STARTTLS via smtp port 25:
#> python -m smtpd_tls --debug -c DebuggingServer --starttls --keyfile=../server.pem 0.0.0.0:25
DebuggingServer started at Thu Feb 4 16:57:06 2016
Local addr: ('0.0.0.0', 25)
Remote addr:('mail.somehost.com', 25)
TLS Mode: explicit (plaintext until STARTTLS)
TLS Context: <ssl.SSLContext object at 0x7f8fd8adbbb0>
Incoming connection from ('192.168.139.1', 39983)
Peer: ('192.168.139.1', 39983)
Data: 'ehlo [192.168.139.1]'
Data: 'STARTTLS'
Peer: ('192.168.139.1', 39983) - negotiated TLS: ('ECDHE-RSA-AES256-GCM-SHA384', 'TLSv1/SSLv3', 256)
Data: 'ehlo [192.168.139.1]'
Data: 'mail FROM:<sender@example.com>'
===> MAIL FROM:<sender@example.com>
sender: sender@example.com
Data: 'rcpt TO:<user@example.com>'
===> RCPT TO:<user@example.com>
recips: ['user@example.com']
Data: 'data'
Data: "From: sender@example.com\r\nTo: user@example.com\r\nSubject: Hello!\r\n\r\nThis message was sent with Python's smtplib."
---------- MESSAGE FOLLOWS ----------
From: sender@example.com
To: user@example.com
Subject: Hello!
X-Peer: 192.168.139.1
This message was sent with Python's smtplib.
------------ END MESSAGE ------------
Data: 'quit'
Implicit TLS via smtp port 465:
#> python -m smtpd_tls --debug -c DebuggingServer --tls --keyfile=../server.pem 0.0.0.0:465
DebuggingServer started at Thu Feb 4 17:00:53 2016
Local addr: ('0.0.0.0', 465)
Remote addr:('mail.somehost.com', 25)
TLS Mode: implicit (encrypted from the beginning)
TLS Context: <ssl.SSLContext object at 0x7fee6ec36bb0>
Incoming connection from ('192.168.139.1', 40028)
Peer: ('192.168.139.1', 40028) - negotiated TLS: ('ECDHE-RSA-AES256-GCM-SHA384', 'TLSv1/SSLv3', 256)
Peer: ('192.168.139.1', 40028)
Data: 'ehlo [192.168.139.1]'
Data: 'mail FROM:<sender@example.com>'
===> MAIL FROM:<sender@example.com>
sender: sender@example.com
Data: 'rcpt TO:<user@example.com>'
===> RCPT TO:<user@example.com>
recips: ['user@example.com']
Data: 'data'
Data: "From: sender@example.com\r\nTo: user@example.com\r\nSubject: Hello!\r\n\r\nThis message was sent with Python's smtplib."
---------- MESSAGE FOLLOWS ----------
From: sender@example.com
To: user@example.com
Subject: Hello!
X-Peer: 192.168.139.1
This message was sent with Python's smtplib.
------------ END MESSAGE ------------
Data: 'quit'
Metadata
Release files for smtpd-tls 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| smtpd-tls-0.1.tar.gz | 6.1 kB | Without provenance | Details for smtpd-tls-0.1.tar.gz |
Release files / smtpd-tls-0.1.tar.gz
| Download URL | smtpd-tls-0.1.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b406b4364c3ea3a77b71179b3e217de34414893bcad65294bc52ca2cd6fd5f85
|
|
BLAKE2b-256 checksum How to use checksums |
1c424c3f3625edcae5432c84b38fe8bab095c8a1ed95607093c5fb2706f4b81d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for smtpd-tls 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.