Skip to content

Commit

Permalink
http: migrate disable_sni
Browse files Browse the repository at this point in the history
CMK-21248

Change-Id: I117e4e0e21f6ca089e3c18231b494ba1556df98e
  • Loading branch information
SoloJacobs committed Feb 2, 2025
1 parent 39cc5d7 commit eba2556
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmk/update_config/http/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class V1Value(BaseModel, extra="forbid"):
name: str
host: V1Host
mode: tuple[Literal["url"], V1Url] | tuple[Literal["cert"], V1Cert]
disable_sni: Literal[True, None] = None


def _migratable_url_params(url_params: V1Url) -> bool:
Expand Down Expand Up @@ -158,6 +159,8 @@ def _migratable(rule_value: Mapping[str, object]) -> bool:
# This might have some issues, since customers can put a port, uri, and really mess with
# us in a multitude of ways.
return False
if value.disable_sni:
return False
if isinstance(value.mode[1], V1Cert):
return True
return _migratable_url_params(value.mode[1])
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/cmk/update_config/http/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,13 @@
"mode": ("url", {"expect_response_header": "a:b\r\nyes:no"}),
}

EXAMPLE_75: Mapping[str, object] = {
"name": "cert_no_levels",
"host": {"address": ("direct", "[::1]")},
"mode": ("cert", {"cert_days": ("no_levels", None)}),
"disable_sni": True,
}


@pytest.mark.parametrize(
"rule_value",
Expand Down Expand Up @@ -879,6 +886,7 @@ def test_migrate_ssl(rule_value: Mapping[str, object], expected: str) -> None:
EXAMPLE_62,
EXAMPLE_63,
EXAMPLE_74,
EXAMPLE_75,
],
)
def test_non_migrateable_rules(rule_value: Mapping[str, object]) -> None:
Expand Down

0 comments on commit eba2556

Please sign in to comment.