Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Fix #714 - Switch to (mainly) sslyze for TLS testing #1218

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7213cd9
Switch TLS to sslyze/nassl based reimplementation
mxsasha May 2, 2023
6c36c46
Add CAMELLIA as sufficient
mxsasha May 9, 2024
a14568f
Add CCM
mxsasha May 9, 2024
a285938
Update nassl to fe914c0+sigalgs
mxsasha Jul 1, 2024
ab84ddc
Fix incorrect order detection when mixing in TLS 1.3 ciphers and usin…
mxsasha Jul 2, 2024
27e5139
Fix FFDHE generator detection
mxsasha Jul 3, 2024
f01798b
Fix detection of sufficient FFDHE primes
mxsasha Aug 13, 2024
73d1182
Update to latest sslyze patch
mxsasha Aug 8, 2024
ee01da5
Parallelise sslyze part of mail TLS scan
mxsasha Aug 22, 2024
fbf6113
Precheck supported TLS versions to reduce sslyze scan scope
mxsasha Aug 27, 2024
f2d4edf
update sslyze fork, set correct ehlo name
mxsasha Aug 28, 2024
aa9a800
error catching adj
mxsasha Sep 2, 2024
03f3b93
bump to new sslyze
mxsasha Sep 2, 2024
ec95c58
upd error handling
mxsasha Sep 2, 2024
09978b5
Update to sslyze patch 6, apply session reneg setting
mxsasha Sep 3, 2024
66472ad
Network timeout to 10s
mxsasha Sep 6, 2024
330e473
Fix handling of nxdomain mx hosts
mxsasha Sep 19, 2024
68d9666
Do not terminate test for some obscure cipher ordering limitations
mxsasha Sep 20, 2024
02fc764
little hack to selectively increase connlimit
mxsasha Sep 20, 2024
a4fae4f
small cleanup
mxsasha Oct 7, 2024
22072e1
improve TLS version precheck speed
mxsasha Oct 7, 2024
96eb3fe
docs, minor fixes
mxsasha Oct 16, 2024
5a5bdb7
tweaks
mxsasha Oct 18, 2024
13a022d
cleanup
mxsasha Oct 18, 2024
3f7dd26
cleanup
mxsasha Oct 18, 2024
3d8b103
f?
mxsasha Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
[submodule "vendor/unbound"]
path = vendor/unbound
url = https://github.com/internetstandards/unbound.git
[submodule "vendor/nassl"]
path = vendor/nassl
url = https://github.com/internetstandards/nassl.git
[submodule "vendor/openssl-1.0.2e"]
path = vendor/openssl-1.0.2e
url = https://github.com/PeterMosmans/openssl.git
[submodule "vendor/openssl-master"]
path = vendor/openssl-master
url = https://github.com/openssl/openssl.git
[submodule "vendor/nassl6"]
path = vendor/nassl6
url = https://github.com/mxsasha/nassl
branch = sigalg
37 changes: 2 additions & 35 deletions checks/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,24 +1073,9 @@ def result_good(self):
self.verdict = "detail web tls cipher-order verdict good"
self.tech_data = ""

def result_bad(self):
def result_bad(self, cipher_order_violation):
self._status(STATUS_FAIL)
self.verdict = "detail web tls cipher-order verdict bad"
self.tech_data = ""

def result_seclevel_bad(self, cipher_order_violation):
self._status(STATUS_FAIL)
self.verdict = "detail web tls cipher-order verdict seclevel-bad"
self.tech_data = cipher_order_violation

def result_score_warning(self, cipher_order_violation):
self._status(STATUS_NOTICE)
self.verdict = "detail web tls cipher-order verdict warning"
self.tech_data = cipher_order_violation

def result_score_info(self, cipher_order_violation):
self._status(STATUS_INFO)
self.verdict = "detail web tls cipher-order verdict warning"
self.tech_data = cipher_order_violation

def result_na(self):
Expand Down Expand Up @@ -1620,28 +1605,10 @@ def result_good(self):
self.verdict = "detail mail tls cipher-order verdict good"
self.tech_data = ""

def result_bad(self):
def result_bad(self, cipher_order_violation):
self.was_tested()
self._status(STATUS_FAIL)
self.verdict = "detail mail tls cipher-order verdict bad"
self.tech_data = ""

def result_seclevel_bad(self, cipher_order_violation):
self.was_tested()
self._status(STATUS_FAIL)
self.verdict = "detail mail tls cipher-order verdict seclevel-bad"
self.tech_data = cipher_order_violation

def result_warning(self, cipher_order_violation):
self.was_tested()
self._status(STATUS_NOTICE)
self.verdict = "detail mail tls cipher-order verdict warning"
self.tech_data = cipher_order_violation

def result_info(self, cipher_order_violation):
self.was_tested()
self._status(STATUS_INFO)
self.verdict = "detail mail tls cipher-order verdict warning"
self.tech_data = cipher_order_violation

def result_na(self):
Expand Down
9 changes: 7 additions & 2 deletions checks/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from forcediphttpsadapter.adapters import ForcedIPHTTPSAdapter

from checks.tasks import SetupUnboundContext
from checks.tasks.tls_connection import DEFAULT_TIMEOUT
from checks.tasks.tls_connection_exceptions import NoIpError
from django.conf import settings
from interface.views.shared import ub_resolve_with_timeout
from internetnl import log
Expand All @@ -20,6 +18,13 @@
urllib3.disable_warnings()


DEFAULT_TIMEOUT = 10


class NoIpError(Exception):
pass


def _do_request(args, headers, kwargs, session, url):
"""
This small wrapper helps with handling of redirects.
Expand Down
5 changes: 4 additions & 1 deletion checks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def __init__(self, *args, **kwargs):
def from_db_value(self, value, expression, connection, context="Null"):
if value is None:
return value
return ast.literal_eval(value)
try:
return ast.literal_eval(value)
except ValueError:
raise ValueError(f"Failed literal_eval on value: {value}")

def to_python(self, value):
if not value:
Expand Down
12 changes: 7 additions & 5 deletions checks/probes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from checks.tasks import mail

if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
from checks.tasks import tls
from checks.tasks.tls import tasks_reports as tls_tasks

if settings.INTERNET_NL_CHECK_SUPPORT_APPSECPRIV:
from checks.tasks import appsecpriv
Expand Down Expand Up @@ -410,7 +410,7 @@ def get_max_score(self, modelobj, maxscore):
)

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

if settings.INTERNET_NL_CHECK_SUPPORT_APPSECPRIV:
web_probe_appsecpriv = Probe(
Expand Down Expand Up @@ -442,7 +442,7 @@ def get_max_score(self, modelobj, maxscore):

if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
batch_web_probe_tls = Probe(
"tls", "site", model=WebTestTls, category=categories.WebTls, taskset=tls.batch_web_registered
"tls", "site", model=WebTestTls, category=categories.WebTls, taskset=tls_tasks.batch_web_registered
)

if settings.INTERNET_NL_CHECK_SUPPORT_APPSECPRIV:
Expand Down Expand Up @@ -515,7 +515,9 @@ def get_max_score(self, modelobj, maxscore):
)

if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
mail_probe_tls = Probe("tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls.mail_registered)
mail_probe_tls = Probe(
"tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls_tasks.mail_registered
)

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

if settings.INTERNET_NL_CHECK_SUPPORT_TLS:
batch_mail_probe_tls = Probe(
"tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls.batch_mail_registered
"tls", "mail", model=MailTestTls, category=categories.MailTls, taskset=tls_tasks.batch_mail_registered
)

if settings.INTERNET_NL_CHECK_SUPPORT_RPKI:
Expand Down
27 changes: 16 additions & 11 deletions checks/scoring.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
# Copyright: 2022, ECP, NLnet Labs and the Internet.nl contributors
# SPDX-License-Identifier: Apache-2.0
from typing import NewType

Status = NewType("Status", int)
Score = NewType("Score", int)

# --- STATUSES
#
# Do not change these values.
# You can append statuses and then change the ORDERED_STATUSES below.
STATUS_FAIL = 0
STATUS_SUCCESS = 1
STATUS_NOTICE = 2
STATUS_GOOD_NOT_TESTED = 3
STATUS_NOT_TESTED = 4
STATUS_INFO = 5
STATUS_ERROR = 6

STATUS_FAIL = Status(0)
STATUS_SUCCESS = Status(1)
STATUS_NOTICE = Status(2)
STATUS_GOOD_NOT_TESTED = Status(3)
STATUS_NOT_TESTED = Status(4)
STATUS_INFO = Status(5)
STATUS_ERROR = Status(6)

STATUS_MAX = STATUS_SUCCESS

Expand Down Expand Up @@ -42,10 +47,10 @@

# --- SCORES
#
FULL_WEIGHT_POINTS = 10 # These are three levels of weighing results.
HALF_WEIGHT_POINTS = 5 # All three can be used for passed tests, the
LESS_WEIGHT_POINTS = 2 # difference is the effect on the overall score.
NO_POINTS = 0
FULL_WEIGHT_POINTS = Score(10) # These are three levels of weighing results.
HALF_WEIGHT_POINTS = Score(5) # All three can be used for passed tests, the
LESS_WEIGHT_POINTS = Score(2) # difference is the effect on the overall score.
NO_POINTS = Score(0)


# You can edit the below values to change the scoring for the subtests.
Expand Down
Loading
Loading