Skip to content

Commit e46af94

Browse files
committed
Add sufficient>good separate status for cipher order
1 parent 3b59db8 commit e46af94

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

checks/categories.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,11 @@ def result_na(self):
10961096
self.verdict = "detail web tls cipher-order verdict na"
10971097
self.tech_data = ""
10981098

1099+
def result_sufficient_above_good(self):
1100+
self._status(STATUS_INFO)
1101+
self.verdict = "detail web tls cipher-order verdict sufficient-above-good"
1102+
self.tech_data = ""
1103+
10991104

11001105
class WebTlsVersion(Subtest):
11011106
def __init__(self):
@@ -1695,6 +1700,11 @@ def result_na(self):
16951700
self.verdict = "detail mail tls cipher-order verdict na"
16961701
self.tech_data = ""
16971702

1703+
def result_sufficient_above_good(self):
1704+
self._status(STATUS_INFO)
1705+
self.verdict = "detail web tls cipher-order verdict sufficient-above-good"
1706+
self.tech_data = ""
1707+
16981708

16991709
class MailTlsVersion(Subtest):
17001710
def __init__(self):

checks/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class CipherOrderStatus(Enum):
120120
not_prescribed = 2
121121
not_seclevel = 3
122122
na = 4 # Don't care about order; only GOOD ciphers.
123+
sufficient_above_good = 5
123124

124125

125126
class TLSExtendedMasterSecretStatus(Enum):

checks/tasks/tls/scans.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -974,6 +974,7 @@ def test_cipher_order(
974974
This is tested at all levels that the server supported.
975975
"""
976976
cipher_order_violation = []
977+
status = CipherOrderStatus.good
977978
if (
978979
not cipher_evaluation.ciphers_bad
979980
and not cipher_evaluation.ciphers_phase_out
@@ -989,14 +990,19 @@ def test_cipher_order(
989990

990991
order_tuples = [
991992
(
993+
CipherOrderStatus.sufficient_above_good,
992994
cipher_evaluation.ciphers_bad + cipher_evaluation.ciphers_phase_out + cipher_evaluation.ciphers_sufficient,
993995
# Make sure we do not mix in TLS 1.3 ciphers, all TLS 1.3 ciphers are good.
994996
cipher_evaluation.ciphers_good_no_tls13,
995997
),
996-
(cipher_evaluation.ciphers_bad + cipher_evaluation.ciphers_phase_out, cipher_evaluation.ciphers_sufficient),
997-
(cipher_evaluation.ciphers_bad, cipher_evaluation.ciphers_phase_out),
998+
(
999+
CipherOrderStatus.bad,
1000+
cipher_evaluation.ciphers_bad + cipher_evaluation.ciphers_phase_out,
1001+
cipher_evaluation.ciphers_sufficient,
1002+
),
1003+
(CipherOrderStatus.bad, cipher_evaluation.ciphers_bad, cipher_evaluation.ciphers_phase_out),
9981004
]
999-
for expected_less_preferred, expected_more_preferred_list in order_tuples:
1005+
for fail_status, expected_less_preferred, expected_more_preferred_list in order_tuples:
10001006
if cipher_order_violation:
10011007
break
10021008
# Sort CHACHA as later in the list, in case SSL_OP_PRIORITIZE_CHACHA is enabled #461
@@ -1009,16 +1015,17 @@ def test_cipher_order(
10091015
)
10101016
if preferred_suite != expected_more_preferred:
10111017
cipher_order_violation = [preferred_suite.name, expected_more_preferred.name]
1018+
status = fail_status
10121019
log.info(
10131020
f"found cipher order violation for {server_connectivity_info.server_location.hostname}:"
1014-
f" preferred {preferred_suite.name} instead of {expected_more_preferred.name}"
1021+
f" preferred {preferred_suite.name} instead of {expected_more_preferred.name}, status {fail_status}"
10151022
)
10161023
break
10171024

10181025
return TLSCipherOrderEvaluation(
10191026
violation=cipher_order_violation,
1020-
status=CipherOrderStatus.bad if cipher_order_violation else CipherOrderStatus.good,
1021-
score=scoring.WEB_TLS_CIPHER_ORDER_BAD if cipher_order_violation else scoring.WEB_TLS_CIPHER_ORDER_GOOD,
1027+
status=status,
1028+
score=scoring.WEB_TLS_CIPHER_ORDER_BAD if status == CipherOrderStatus.bad else scoring.WEB_TLS_CIPHER_ORDER_GOOD
10221029
)
10231030

10241031

checks/tasks/tls/tasks_reports.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ def annotate_and_combine_all(good_items, sufficient_items, bad_items, phaseout_i
444444
category.subtests["tls_cipher_order"].result_bad(dttls.cipher_order_violation)
445445
elif dttls.cipher_order == CipherOrderStatus.na:
446446
category.subtests["tls_cipher_order"].result_na()
447+
elif dttls.cipher_order == CipherOrderStatus.sufficient_above_good:
448+
category.subtests["tls_cipher_order"].result_sufficient_above_good()
447449
else:
448450
category.subtests["tls_cipher_order"].result_good()
449451

@@ -602,6 +604,8 @@ def annotate_and_combine_all(good_items, sufficient_items, bad_items, phaseout_i
602604
category.subtests["tls_cipher_order"].result_bad(dttls.cipher_order_violation)
603605
elif dttls.cipher_order == CipherOrderStatus.na:
604606
category.subtests["tls_cipher_order"].result_na()
607+
elif dttls.cipher_order == CipherOrderStatus.sufficient_above_good:
608+
category.subtests["tls_cipher_order"].result_sufficient_above_good()
605609
else:
606610
category.subtests["tls_cipher_order"].result_good()
607611

interface/batch/openapi.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,15 @@ components:
628628
enumClass: CipherOrderStatus
629629
description: |
630630
Cipher order preference of the server:
631-
* `bad` - The server does not enforce his own preference.
632-
* `good` - The server enforces his own preference.
631+
* `bad` - The server does not enforce good and sufficient over weaker ciphers.
632+
* `good` - The server enforces his own preference in a correct order.
633633
* `not_prescribed` - The server enforces his own preference but
634634
the cipher order is not based on prescribed ordering.
635635
* `not_seclevel` - The server enforces his own preference but
636636
the configured order is not based on security level.
637637
* `na` - The server only supports GOOD ciphers; cipher order is
638638
not relevant.
639+
* `sufficient_above_good` - the server prefers sufficient ciphers over good.
639640
cipher_order_violation:
640641
type: array
641642
description: |

0 commit comments

Comments
 (0)