Skip to content

Commit 097319f

Browse files
authored
Merge pull request #111 from wietse-postfix/tlsrpt
Minimal support for TLSRPT in Postfix 3.10 and later
2 parents 3f68579 + 4044b87 commit 097319f

10 files changed

+13
-0
lines changed

config_examples/mta-sts-daemon.yml.internal

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ host: 127.0.0.1
22
port: 8461
33
reuse_port: true
44
shutdown_timeout: 20
5+
# tlsrpt: true
56
cache:
67
type: internal
78
options:

config_examples/mta-sts-daemon.yml.postgres

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ host: 127.0.0.1
22
port: 8461
33
reuse_port: true
44
shutdown_timeout: 20
5+
# tlsrpt: true
56
cache:
67
type: postgres
78
options:

config_examples/mta-sts-daemon.yml.redis

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ host: 127.0.0.1
22
port: 8461
33
reuse_port: true
44
shutdown_timeout: 20
5+
# tlsrpt: true
56
cache:
67
type: redis
78
options:

config_examples/mta-sts-daemon.yml.redis_sentinel

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ host: 127.0.0.1
22
port: 8461
33
reuse_port: true
44
shutdown_timeout: 20
5+
# tlsrpt: true
56
cache:
67
type: redis_sentinel
78
options:

config_examples/mta-sts-daemon.yml.sqlite

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ host: 127.0.0.1
22
port: 8461
33
reuse_port: true
44
shutdown_timeout: 20
5+
# tlsrpt: true
56
cache:
67
type: sqlite
78
options:

config_examples/mta-sts-daemon.yml.sqlite_unixsock

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
path: "/var/run/mta-sts.sock"
22
mode: 0666
33
shutdown_timeout: 20
4+
# tlsrpt: true
45
cache:
56
type: sqlite
67
options:

man/mta-sts-daemon.yml.5.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ The file is in YAML syntax with the following elements:
3030

3131
*shutdown_timeout*: (_float_) time limit granted to existing client sessions for finishing when server stops. Default: 20
3232

33+
*tlsrpt*: (_bool_) include response attributes for TLSRPT support (Postfix 3.10 and later). Default: false
34+
3335
*cache*::
3436

3537
* *type*: (_str_: _internal_|_sqlite_|_redis_|_redis_sentinel_|postgres) cache backend type. Default: internal

postfix_mta_sts_resolver/defaults.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
PORT = 8461
55
REUSE_PORT = True
66
TIMEOUT = 4
7+
TLSRPT = False
78
SHUTDOWN_TIMEOUT = 20
89
STRICT_TESTING = False
910
CONFIG_LOCATION = "/etc/mta-sts-daemon.yml"

postfix_mta_sts_resolver/responder.py

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def __init__(self, cfg, loop, cache):
3333
self._port = cfg['port']
3434
self._reuse_port = cfg['reuse_port']
3535
self._shutdown_timeout = cfg['shutdown_timeout']
36+
self._tlsrpt = cfg['tlsrpt']
3637
self._grace = cfg['cache_grace']
3738

3839
# Construct configurations and resolvers for every socketmap name
@@ -225,6 +226,8 @@ async def process_request(self, raw_req):
225226
resp = "OK secure match=" + ":".join(mxlist)
226227
if zone_cfg.require_sni:
227228
resp += " servername=hostname"
229+
if self._tlsrpt:
230+
resp += " policy_type=sts policy_domain=" + domain
228231
return netstring.encode(resp.encode('utf-8'))
229232
else:
230233
return netstring.encode(b'NOTFOUND ')

postfix_mta_sts_resolver/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ def populate_cfg_defaults(cfg):
8787
cfg['reuse_port'] = cfg.get('reuse_port', defaults.REUSE_PORT)
8888
cfg['shutdown_timeout'] = cfg.get('shutdown_timeout',
8989
defaults.SHUTDOWN_TIMEOUT)
90+
cfg['tlsrpt'] = cfg.get('tlsrpt', defaults.TLSRPT)
9091
cfg['cache_grace'] = cfg.get('cache_grace', defaults.CACHE_GRACE)
9192

9293
if 'proactive_policy_fetching' not in cfg:

0 commit comments

Comments
 (0)