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

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

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c22de4c
Switch TLS to sslyze/nassl based reimplementation
mxsasha May 2, 2023
83ff544
Add CAMELLIA as sufficient
mxsasha May 9, 2024
e70d5ce
Add CCM
mxsasha May 9, 2024
7d56e8f
Update nassl to fe914c0+sigalgs
mxsasha Jul 1, 2024
2428281
Fix incorrect order detection when mixing in TLS 1.3 ciphers and usin…
mxsasha Jul 2, 2024
ab660f0
Fix FFDHE generator detection
mxsasha Jul 3, 2024
ad6d1cf
Fix detection of sufficient FFDHE primes
mxsasha Aug 13, 2024
329bd74
Update to latest sslyze patch
mxsasha Aug 8, 2024
8bdaa71
Parallelise sslyze part of mail TLS scan
mxsasha Aug 22, 2024
ad5d4b3
Precheck supported TLS versions to reduce sslyze scan scope
mxsasha Aug 27, 2024
6232430
update sslyze fork, set correct ehlo name
mxsasha Aug 28, 2024
82bdb16
error catching adj
mxsasha Sep 2, 2024
8dee8cc
bump to new sslyze
mxsasha Sep 2, 2024
d3e1c6a
upd error handling
mxsasha Sep 2, 2024
ff92bd7
Update to sslyze patch 6, apply session reneg setting
mxsasha Sep 3, 2024
7062052
Network timeout to 10s
mxsasha Sep 6, 2024
8e1215f
Fix handling of nxdomain mx hosts
mxsasha Sep 19, 2024
9fd09b2
Do not terminate test for some obscure cipher ordering limitations
mxsasha Sep 20, 2024
2cf55a6
little hack to selectively increase connlimit
mxsasha Sep 20, 2024
ec674dc
small cleanup
mxsasha Oct 7, 2024
e2fd8e8
improve TLS version precheck speed
mxsasha Oct 7, 2024
9e6f4e8
docs, minor fixes
mxsasha Oct 16, 2024
a1722b4
tweaks
mxsasha Oct 18, 2024
3b83d92
cleanup
mxsasha Oct 18, 2024
14cd0d2
cleanup
mxsasha Oct 18, 2024
d7b674f
f?
mxsasha Oct 18, 2024
c145c4d
docs updates
mxsasha Nov 25, 2024
0316d66
Apply suggestions from code review
mxsasha Nov 25, 2024
aa9aba5
cleanup
mxsasha Nov 25, 2024
b379215
Clean up dependencies
mxsasha Nov 25, 2024
9bb6c41
Only show IANA cipher names
mxsasha Nov 25, 2024
e9e1fd0
Improve detection of missing SHA2 key exchange
mxsasha Dec 9, 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 @@ -1082,24 +1082,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 @@ -1629,28 +1614,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 @@ -413,7 +413,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 @@ -445,7 +445,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 @@ -518,7 +518,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 @@ -542,7 +544,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