Skip to content

Commit 80bc4ef

Browse files
committed
gSwitch TLS to sslyze/nassl based reimplementation
1 parent b9f06b6 commit 80bc4ef

37 files changed

+5454
-43786
lines changed

.gitmodules

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
[submodule "vendor/unbound"]
22
path = vendor/unbound
33
url = https://github.com/internetstandards/unbound.git
4-
[submodule "vendor/nassl"]
5-
path = vendor/nassl
6-
url = https://github.com/internetstandards/nassl.git
7-
[submodule "vendor/openssl-1.0.2e"]
8-
path = vendor/openssl-1.0.2e
9-
url = https://github.com/PeterMosmans/openssl.git
10-
[submodule "vendor/openssl-master"]
11-
path = vendor/openssl-master
12-
url = https://github.com/openssl/openssl.git
4+
[submodule "vendor/nassl6"]
5+
path = vendor/nassl6
6+
url = https://github.com/mxsasha/nassl
7+
branch = sigalg

checks/categories.py

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,24 +1073,9 @@ def result_good(self):
10731073
self.verdict = "detail web tls cipher-order verdict good"
10741074
self.tech_data = ""
10751075

1076-
def result_bad(self):
1076+
def result_bad(self, cipher_order_violation):
10771077
self._status(STATUS_FAIL)
10781078
self.verdict = "detail web tls cipher-order verdict bad"
1079-
self.tech_data = ""
1080-
1081-
def result_seclevel_bad(self, cipher_order_violation):
1082-
self._status(STATUS_FAIL)
1083-
self.verdict = "detail web tls cipher-order verdict seclevel-bad"
1084-
self.tech_data = cipher_order_violation
1085-
1086-
def result_score_warning(self, cipher_order_violation):
1087-
self._status(STATUS_NOTICE)
1088-
self.verdict = "detail web tls cipher-order verdict warning"
1089-
self.tech_data = cipher_order_violation
1090-
1091-
def result_score_info(self, cipher_order_violation):
1092-
self._status(STATUS_INFO)
1093-
self.verdict = "detail web tls cipher-order verdict warning"
10941079
self.tech_data = cipher_order_violation
10951080

10961081
def result_na(self):
@@ -1620,28 +1605,10 @@ def result_good(self):
16201605
self.verdict = "detail mail tls cipher-order verdict good"
16211606
self.tech_data = ""
16221607

1623-
def result_bad(self):
1608+
def result_bad(self, cipher_order_violation):
16241609
self.was_tested()
16251610
self._status(STATUS_FAIL)
16261611
self.verdict = "detail mail tls cipher-order verdict bad"
1627-
self.tech_data = ""
1628-
1629-
def result_seclevel_bad(self, cipher_order_violation):
1630-
self.was_tested()
1631-
self._status(STATUS_FAIL)
1632-
self.verdict = "detail mail tls cipher-order verdict seclevel-bad"
1633-
self.tech_data = cipher_order_violation
1634-
1635-
def result_warning(self, cipher_order_violation):
1636-
self.was_tested()
1637-
self._status(STATUS_NOTICE)
1638-
self.verdict = "detail mail tls cipher-order verdict warning"
1639-
self.tech_data = cipher_order_violation
1640-
1641-
def result_info(self, cipher_order_violation):
1642-
self.was_tested()
1643-
self._status(STATUS_INFO)
1644-
self.verdict = "detail mail tls cipher-order verdict warning"
16451612
self.tech_data = cipher_order_violation
16461613

16471614
def result_na(self):

checks/http_client.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter
1111

1212
from checks.tasks import SetupUnboundContext
13-
from checks.tasks.tls_connection import DEFAULT_TIMEOUT
14-
from checks.tasks.tls_connection_exceptions import NoIpError
1513
from django.conf import settings
1614
from interface.views.shared import ub_resolve_with_timeout
1715
from internetnl import log
@@ -20,6 +18,13 @@
2018
urllib3.disable_warnings()
2119

2220

21+
DEFAULT_TIMEOUT = 10
22+
23+
24+
class NoIpError(Exception):
25+
pass
26+
27+
2328
def _do_request(args, headers, kwargs, session, url):
2429
"""
2530
This small wrapper helps with handling of redirects.

checks/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ def __init__(self, *args, **kwargs):
1919
def from_db_value(self, value, expression, connection, context="Null"):
2020
if value is None:
2121
return value
22-
return ast.literal_eval(value)
22+
try:
23+
return ast.literal_eval(value)
24+
except ValueError:
25+
raise ValueError(f"Failed literal_eval on value: {value}")
2326

2427
def to_python(self, value):
2528
if not value:

checks/probes.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from checks.tasks import mail
4242

4343
if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
44-
from checks.tasks import tls
44+
from checks.tasks.tls import tasks_reports as tls_tasks
4545

4646
if settings.INTERNET_NL_CHECK_SUPPORT_APPSECPRIV:
4747
from checks.tasks import appsecpriv
@@ -410,7 +410,7 @@ def get_max_score(self, modelobj, maxscore):
410410
)
411411

412412
if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
413-
web_probe_tls = Probe("tls", "site", model=WebTestTls, category=categories.WebTls, taskset=tls.web_registered)
413+
web_probe_tls = Probe("tls", "site", model=WebTestTls, category=categories.WebTls, taskset=tls_tasks.web_registered)
414414

415415
if settings.INTERNET_NL_CHECK_SUPPORT_APPSECPRIV:
416416
web_probe_appsecpriv = Probe(
@@ -442,7 +442,7 @@ def get_max_score(self, modelobj, maxscore):
442442

443443
if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
444444
batch_web_probe_tls = Probe(
445-
"tls", "site", model=WebTestTls, category=categories.WebTls, taskset=tls.batch_web_registered
445+
"tls", "site", model=WebTestTls, category=categories.WebTls, taskset=tls_tasks.batch_web_registered
446446
)
447447

448448
if settings.INTERNET_NL_CHECK_SUPPORT_APPSECPRIV:
@@ -515,7 +515,9 @@ def get_max_score(self, modelobj, maxscore):
515515
)
516516

517517
if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
518-
mail_probe_tls = Probe("tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls.mail_registered)
518+
mail_probe_tls = Probe(
519+
"tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls_tasks.mail_registered
520+
)
519521

520522
if settings.INTERNET_NL_CHECK_SUPPORT_RPKI:
521523
mail_probe_rpki = Probe(
@@ -539,7 +541,7 @@ def get_max_score(self, modelobj, maxscore):
539541

540542
if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
541543
batch_mail_probe_tls = Probe(
542-
"tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls.batch_mail_registered
544+
"tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls_tasks.batch_mail_registered
543545
)
544546

545547
if settings.INTERNET_NL_CHECK_SUPPORT_RPKI:

checks/scoring.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
22
# SPDX-License-Identifier: Apache-2.0
3+
from typing import NewType
4+
5+
Status = NewType("Status", int)
6+
Score = NewType("Score", int)
37

48
# --- STATUSES
59
#
610
# Do not change these values.
711
# You can append statuses and then change the ORDERED_STATUSES below.
8-
STATUS_FAIL = 0
9-
STATUS_SUCCESS = 1
10-
STATUS_NOTICE = 2
11-
STATUS_GOOD_NOT_TESTED = 3
12-
STATUS_NOT_TESTED = 4
13-
STATUS_INFO = 5
14-
STATUS_ERROR = 6
12+
13+
STATUS_FAIL = Status(0)
14+
STATUS_SUCCESS = Status(1)
15+
STATUS_NOTICE = Status(2)
16+
STATUS_GOOD_NOT_TESTED = Status(3)
17+
STATUS_NOT_TESTED = Status(4)
18+
STATUS_INFO = Status(5)
19+
STATUS_ERROR = Status(6)
1520

1621
STATUS_MAX = STATUS_SUCCESS
1722

@@ -42,10 +47,10 @@
4247

4348
# --- SCORES
4449
#
45-
FULL_WEIGHT_POINTS = 10 # These are three levels of weighing results.
46-
HALF_WEIGHT_POINTS = 5 # All three can be used for passed tests, the
47-
LESS_WEIGHT_POINTS = 2 # difference is the effect on the overall score.
48-
NO_POINTS = 0
50+
FULL_WEIGHT_POINTS = Score(10) # These are three levels of weighing results.
51+
HALF_WEIGHT_POINTS = Score(5) # All three can be used for passed tests, the
52+
LESS_WEIGHT_POINTS = Score(2) # difference is the effect on the overall score.
53+
NO_POINTS = Score(0)
4954

5055

5156
# You can edit the below values to change the scoring for the subtests.

0 commit comments

Comments
 (0)