From 6d4af3cf0c0b63cc75ab0a8220a131330b3a7aad Mon Sep 17 00:00:00 2001 From: missytake Date: Tue, 17 Dec 2024 17:28:58 +0100 Subject: [PATCH] DNS: fix _mta-sts TXT record on initial setup --- cmdeploy/src/cmdeploy/remote/rdns.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmdeploy/src/cmdeploy/remote/rdns.py b/cmdeploy/src/cmdeploy/remote/rdns.py index 77093503..7da689df 100644 --- a/cmdeploy/src/cmdeploy/remote/rdns.py +++ b/cmdeploy/src/cmdeploy/remote/rdns.py @@ -10,6 +10,7 @@ All functions of this module - can freely call each other. """ +import datetime import re from .rshell import CalledProcessError, shell @@ -34,7 +35,10 @@ def perform_initial_checks(mail_domain): # parse out sts-id if exists, example: "v=STSv1; id=2090123" parts = query_dns("TXT", f"_mta-sts.{mail_domain}").split("id=") - res["sts_id"] = parts[1].rstrip('"') if len(parts) == 2 else "" + if len(parts) == 2 and len(parts[1]) > 1: + res["sts_id"] = parts[1].rstrip('"') + else: + res["sts_id"] = datetime.datetime.now().strftime("%Y%m%d%H%M") return res