Skip to content

Commit

Permalink
internetstandards#881 add database model fields for tlsrpt checks, co…
Browse files Browse the repository at this point in the history
…rrect translation markers, add tlsrpt callback
  • Loading branch information
uwekamper committed Feb 10, 2024
1 parent bc46910 commit e7c43d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions checks/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -2263,12 +2263,12 @@ def __init__(self):

def result_good(self, tech_data):
self._status(STATUS_SUCCESS)
self.verdict = "detail mail auth spf verdict good"
self.verdict = "detail mail auth tlsrpt verdict good"
self.tech_data = [[tech_data]]

def result_bad(self, tech_data):
self._status(STATUS_FAIL)
self.verdict = "detail mail auth spf verdict bad"
self.verdict = "detail mail auth tlsrp verdict bad"
if tech_data:
# More than one spf record. Show the records.
self.tech_data = [[tech_data]]
Expand Down
6 changes: 6 additions & 0 deletions checks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,9 @@ class MailTestAuth(BaseTestModel):
spf_policy_status = EnumIntegerField(SpfPolicyStatus, null=True)
spf_policy_score = models.IntegerField(null=True)
spf_policy_records = ListField(null=True)
tlsrpt_score = models.IntegerField(null=True)
tlsrpt_available = models.BooleanField(null=True, default=False)
tlsrpt_record = ListField(default=[])
score = models.IntegerField(null=True)
max_score = models.IntegerField(null=True)

Expand All @@ -1032,6 +1035,9 @@ def __dir__(self):
"spf_policy_status",
"spf_policy_score",
"spf_policy_records",
"tlsrpt_score",
"tlsrpt_available",
"tlsrpt_record",
"score",
"max_score",
]
Expand Down
6 changes: 6 additions & 0 deletions checks/tasks/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ def callback(results, addr, category):

else:
subtests["spf"].result_bad(spf_record)
elif testname == "tlsrpt":
tlsrpt_available = result.get("available")
tlsrpt_record = result.get("record")
tlsrpt_score = result.get("score")
# TODO: Pass results to mtauth and subtests
print("This is the callback for TLS-RPT.")

if skip_dkim_for_non_sending_domain(mtauth):
mtauth.dkim_score = scoring.MAIL_AUTH_DKIM_PASS
Expand Down

0 comments on commit e7c43d8

Please sign in to comment.