forked from mtusi2026/mtusi2026lab7
fix: address storage-tls verify findings
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,18 +65,22 @@ def client_tls_problems(
|
||||
) -> list[str]:
|
||||
"""Имена неверных полей для старта процесса (без значений и путей).
|
||||
|
||||
`client_tls.ca_file` — пусто, не читается или не PEM сертификата;
|
||||
`<секция>.host` — IP-адрес вместо имени хранилища, к которому ходит
|
||||
процесс."""
|
||||
`client_tls.ca_file` — пусто, не читается, не PEM или без сертификата
|
||||
CA (только CRL, только leaf: контекст загрузится, но доверять в нём
|
||||
нечему — verify S1); `<секция>.host` — IP-адрес вместо имени
|
||||
хранилища, к которому ходит процесс."""
|
||||
problems: list[str] = []
|
||||
ca_file = settings.client_tls.ca_file
|
||||
if not ca_file:
|
||||
problems.append("client_tls.ca_file")
|
||||
else:
|
||||
try:
|
||||
build_client_context(ca_file)
|
||||
context = build_client_context(ca_file)
|
||||
except (OSError, ssl.SSLError, ValueError):
|
||||
problems.append("client_tls.ca_file")
|
||||
else:
|
||||
if context.cert_store_stats()["x509_ca"] == 0:
|
||||
problems.append("client_tls.ca_file")
|
||||
problems += [
|
||||
f"{name}.host"
|
||||
for name in storages
|
||||
|
||||
Reference in New Issue
Block a user