Skip to content

Commit 703e50d

Browse files
committed
Show bad/phase out kex hash funcs in techtable
1 parent 5650bec commit 703e50d

File tree

6 files changed

+35
-12
lines changed

6 files changed

+35
-12
lines changed

checks/categories.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,23 +1510,23 @@ def result_good(self):
15101510
self.verdict = "detail web tls kex-hash-func verdict good"
15111511
self.tech_data = "detail tech data good"
15121512

1513-
def result_bad(self):
1513+
def result_bad(self, tech_data):
15141514
self.was_tested()
15151515
self._status(STATUS_FAIL)
15161516
self.verdict = "detail web tls kex-hash-func verdict bad"
1517-
self.tech_data = "detail tech data insufficient"
1517+
self.tech_data = tech_data
15181518

15191519
def result_unknown(self):
15201520
self.was_tested()
15211521
self._status(STATUS_INFO)
15221522
self.verdict = "detail web tls kex-hash-func verdict other"
15231523
self.tech_data = "detail tech data not-applicable"
15241524

1525-
def result_phase_out(self):
1525+
def result_phase_out(self, tech_data):
15261526
self.was_tested()
15271527
self._status(STATUS_NOTICE)
15281528
self.verdict = "detail web tls kex-hash-func verdict phase-out"
1529-
self.tech_data = "detail tech data phase-out"
1529+
self.tech_data = tech_data
15301530

15311531

15321532
class WebTLSExtendedMasterSecret(Subtest):
@@ -2138,23 +2138,23 @@ def result_good(self):
21382138
self.verdict = "detail mail tls kex-hash-func verdict good"
21392139
self.tech_data = "detail tech data good"
21402140

2141-
def result_bad(self):
2141+
def result_bad(self, tech_data):
21422142
self.was_tested()
21432143
self._status(STATUS_FAIL)
21442144
self.verdict = "detail mail tls kex-hash-func verdict bad"
2145-
self.tech_data = "detail tech data insufficient"
2145+
self.tech_data = tech_data
21462146

21472147
def result_unknown(self):
21482148
self.was_tested()
21492149
self._status(STATUS_INFO)
21502150
self.verdict = "detail mail tls kex-hash-func verdict other"
21512151
self.tech_data = "detail tech data not-applicable"
21522152

2153-
def result_phase_out(self):
2153+
def result_phase_out(self, tech_data):
21542154
self.was_tested()
21552155
self._status(STATUS_NOTICE)
21562156
self.verdict = "detail mail tls kex-hash-func verdict phase-out"
2157-
self.tech_data = "detail tech data phase-out"
2157+
self.tech_data = tech_data
21582158

21592159

21602160
class MailTLSExtendedMasterSecret(Subtest):
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from django.db import migrations, models
2+
3+
4+
class Migration(migrations.Migration):
5+
dependencies = [
6+
("checks", "0020_domaintesttls_extended_master_secret_and_more"),
7+
]
8+
9+
operations = [
10+
migrations.AddField(
11+
model_name="domaintesttls",
12+
name="kex_hash_func_bad_hash",
13+
field=models.CharField(default=None, max_length=255, null=True),
14+
),
15+
]

checks/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ class DomainTestTls(BaseTestModel):
542542

543543
kex_hash_func = EnumField(KexHashFuncStatus, default=KexHashFuncStatus.bad)
544544
kex_hash_func_score = models.IntegerField(null=True)
545+
kex_hash_func_bad_hash = models.CharField(max_length=255, null=True, default=None)
545546

546547
extended_master_secret = EnumField(TLSExtendedMasterSecretStatus, default=TLSExtendedMasterSecretStatus.unknown)
547548
extended_master_secret_score = models.IntegerField(null=True)

checks/tasks/tls/evaluation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class KeyExchangeHashFunctionEvaluation:
318318

319319
status: KexHashFuncStatus
320320
score: scoring.Score
321+
found_hash: Optional[str] = None
321322

322323

323324
@dataclass(frozen=True)

checks/tasks/tls/scans.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ def check_mail_tls(
689689
),
690690
kex_hash_func=key_exchange_hash_evaluation.status,
691691
kex_hash_func_score=key_exchange_hash_evaluation.score,
692+
kex_hash_func_bad_hash=key_exchange_hash_evaluation.found_hash,
692693
extended_master_secret=extended_master_secret_evaluation.status,
693694
extended_master_secret_score=extended_master_secret_evaluation.score,
694695
)
@@ -813,6 +814,7 @@ def check_web_tls(url, af_ip_pair=None, *args, **kwargs):
813814
ocsp_stapling_score=ocsp_evaluation.score,
814815
kex_hash_func=key_exchange_hash_evaluation.status,
815816
kex_hash_func_score=key_exchange_hash_evaluation.score,
817+
kex_hash_func_bad_hash=key_exchange_hash_evaluation.found_hash,
816818
extended_master_secret=extended_master_secret_evaluation.status,
817819
extended_master_secret_score=extended_master_secret_evaluation.score,
818820
)
@@ -888,6 +890,7 @@ def test_key_exchange_hash(
888890
return KeyExchangeHashFunctionEvaluation(
889891
status=KexHashFuncStatus.bad,
890892
score=scoring.WEB_TLS_KEX_HASH_FUNC_BAD,
893+
found_hash=bad_hash_result.name,
891894
)
892895

893896
phase_out_hash_result = _test_connection_with_limited_sigalgs(
@@ -898,6 +901,7 @@ def test_key_exchange_hash(
898901
return KeyExchangeHashFunctionEvaluation(
899902
status=KexHashFuncStatus.phase_out,
900903
score=scoring.WEB_TLS_KEX_HASH_FUNC_OK,
904+
found_hash=phase_out_hash_result.name,
901905
)
902906

903907
return KeyExchangeHashFunctionEvaluation(

checks/tasks/tls/tasks_reports.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def save_results(model, results, addr, domain, category):
275275
model.ocsp_stapling_score = result.get("ocsp_stapling_score")
276276
model.kex_hash_func = result.get("kex_hash_func")
277277
model.kex_hash_func_score = result.get("kex_hash_func_score")
278+
model.kex_hash_func_bad_hash = result.get("kex_hash_func_bad_hash")
278279
model.extended_master_secret = result.get("extended_master_secret")
279280
model.extended_master_secret_score = result.get("extended_master_secret_score")
280281

@@ -352,6 +353,7 @@ def save_results(model, results, addr, domain, category):
352353
# model.ocsp_stapling_score = result.get("ocsp_stapling_score")
353354
model.kex_hash_func = result.get("kex_hash_func")
354355
model.kex_hash_func_score = result.get("kex_hash_func_score")
356+
model.kex_hash_func_bad_hash = result.get("kex_hash_func_bad_hash")
355357
model.extended_master_secret = result.get("extended_master_secret")
356358
model.extended_master_secret_score = result.get("extended_master_secret_score")
357359
if result.get("tls_cert"):
@@ -570,11 +572,11 @@ def annotate_and_combine_all(good_items, sufficient_items, bad_items, phaseout_i
570572
if dttls.kex_hash_func == KexHashFuncStatus.good:
571573
category.subtests["kex_hash_func"].result_good()
572574
elif dttls.kex_hash_func == KexHashFuncStatus.bad:
573-
category.subtests["kex_hash_func"].result_bad()
575+
category.subtests["kex_hash_func"].result_bad(dttls.kex_hash_func_bad_hash)
574576
elif dttls.kex_hash_func == KexHashFuncStatus.unknown:
575577
category.subtests["kex_hash_func"].result_unknown()
576578
elif dttls.kex_hash_func == KexHashFuncStatus.phase_out:
577-
category.subtests["kex_hash_func"].result_phase_out()
579+
category.subtests["kex_hash_func"].result_phase_out(dttls.kex_hash_func_bad_hash)
578580

579581
category.subtests["extended_master_secret"].save_result(dttls.extended_master_secret)
580582

@@ -732,11 +734,11 @@ def annotate_and_combine_all(good_items, sufficient_items, bad_items, phaseout_i
732734
if dttls.kex_hash_func == KexHashFuncStatus.good:
733735
category.subtests["kex_hash_func"].result_good()
734736
elif dttls.kex_hash_func == KexHashFuncStatus.bad:
735-
category.subtests["kex_hash_func"].result_bad()
737+
category.subtests["kex_hash_func"].result_bad(dttls.kex_hash_func_bad_hash)
736738
elif dttls.kex_hash_func == KexHashFuncStatus.unknown:
737739
category.subtests["kex_hash_func"].result_unknown()
738740
elif dttls.kex_hash_func == KexHashFuncStatus.phase_out:
739-
category.subtests["kex_hash_func"].result_phase_out()
741+
category.subtests["kex_hash_func"].result_phase_out(dttls.kex_hash_func_bad_hash)
740742

741743
category.subtests["extended_master_secret"].save_result(dttls.extended_master_secret)
742744

0 commit comments

Comments
 (0)