Repository navigation
Conversation
Validate MgmtGatewaySpec.virtual_ip to ensure it contains a valid IPv4 or IPv6 address. This prevents invalid values such as hostnames or CIDR notation from being accepted and later causing TLS/SAN mismatches in the mgmt-gateway internal endpoint. Adds unit tests for valid and invalid virtual_ip values. Fixes: https://tracker.ceph.com/issues/80644 Assisted-by: ChatGPT <chatgpt.com> Signed-off-by: Redouane Kachach <[email protected]> (cherry picked from commit ad5dae6)
Clarify that `mgmt-gateway.spec.virtual_ip` must be a plain IP address, while the ingress `virtual_ip` must use the same IP with the subnet prefix. This avoids implying that both values should be identical strings and makes the expected ingress CIDR format explicit. Fixes: https://tracker.ceph.com/issues/80644 Signed-off-by: Redouane Kachach <[email protected]> (cherry picked from commit c8d470e)
There was a problem hiding this comment.
Ceph Release Engineering Audit Report
Commit Parity Visualizer
| BACKPORT PR #72087 | SOURCE PR |
SOURCE STATUS |
|---|---|---|
| 3de1928 mgr/cephadm: validate mgmt-gateway virtual_ip | PR #71897 | ad5dae6 mgr/cephadm: validate mgmt-gateway virtual_ip |
| 7c71358 doc/cephadm: clarify mgmt-gateway virtual_ip format | c8d470e doc/cephadm: clarify mgmt-gateway virtual_ip format |
Automated Backport Parity Review - Cherry-Pick Conflicts / Deviations
A conflict or deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
This does not necessarily indicate an issue but a maintainer should review.
**Click to expand conflict summaries.**
Deviation in Backport 3de1928 (cherry-pick of ad5dae6)
Affected File(s)
src/python-common/ceph/deployment/service_spec.pysrc/python-common/ceph/deployment/utils.pysrc/python-common/ceph/tests/test_service_spec.py
Range Diff
Click to expand
--- Original (ad5dae6a)
+++ Backport (3de19284)
@@ -12,3 +12,4 @@
Fixes: https://tracker.ceph.com/issues/80644
Assisted-by: ChatGPT <chatgpt.com>
Signed-off-by: Redouane Kachach <[email protected]>
+(cherry picked from commit ad5dae6ab045cadc161ce18b348727634f488483)
================================================================================
RANGE DIFF
================================================================================
1: ad5dae6ab04 ! 1: 3de19284b16 mgr/cephadm: validate mgmt-gateway virtual_ip
@@ Commit message
Fixes: https://tracker.ceph.com/issues/80644
Assisted-by: ChatGPT <chatgpt.com>
Signed-off-by: Redouane Kachach <[email protected]>
+ (cherry picked from commit ad5dae6ab045cadc161ce18b348727634f488483)
## src/python-common/ceph/deployment/service_spec.py ##
-@@ src/python-common/ceph/deployment/service_spec.py: from ceph.deployment.hostspec import (
+@@ src/python-common/ceph/deployment/service_spec.py: import yaml
+ from ceph.deployment.hostspec import HostSpec, SpecValidationError, assert_valid_host
from ceph.deployment.utils import unwrap_ipv6, valid_addr, verify_non_negative_int
from ceph.deployment.utils import verify_positive_int, verify_non_negative_number
- from ceph.deployment.utils import verify_boolean, verify_enum, verify_int, verify_non_empty_string
--from ceph.deployment.utils import verify_size_with_units, validate_port, validate_unique_ports
-+from ceph.deployment.utils import verify_size_with_units, validate_port, validate_unique_ports, \
-+ validate_ip
- from ceph.cephadm.d3n_types import D3NCacheSpec, D3NCacheError
+-from ceph.deployment.utils import verify_boolean, verify_enum, verify_int
++from ceph.deployment.utils import verify_boolean, verify_enum, verify_int, validate_ip
from ceph.utils import is_hex
from ceph.smb import constants as smbconst
+
@@ src/python-common/ceph/deployment/service_spec.py: class MgmtGatewaySpec(ServiceSpec):
def validate(self) -> None:
super(MgmtGatewaySpec, self).validate()
- validate_port(self.port, 'port')
+ self._validate_port(self.port)
+ validate_ip(self.virtual_ip)
self._validate_certificate(self.ssl_cert, "ssl_cert")
self._validate_private_key(self.ssl_key, "ssl_key")
self._validate_boolean_switch(self.ssl_prefer_server_ciphers, "ssl_prefer_server_ciphers")
## src/python-common/ceph/deployment/utils.py ##
-@@ src/python-common/ceph/deployment/utils.py: def verify_non_empty_string(field: Any, field_name: str) -> None:
- # isinstance first so we never call .strip() on None or non-str
- if not isinstance(field, str) or not field.strip():
- raise SpecValidationError(f"Invalid {field_name}: Must be a non-empty string.")
-+
+@@ src/python-common/ceph/deployment/utils.py: def verify_enum(field: Any, field_name: str, allowed: list) -> None:
+ if field.lower() not in allowed_lower:
+ raise SpecValidationError(
+ f'Invalid {field_name}. Valid values are: {", ".join(allowed)}')
+
+def validate_ip(ip_addr: Optional[str]) -> None:
+ if ip_addr is None:
@@ src/python-common/ceph/deployment/utils.py: def verify_non_empty_string(field: A
## src/python-common/ceph/tests/test_service_spec.py ##
@@ src/python-common/ceph/tests/test_service_spec.py: from ceph.deployment.service_spec import (
+ RGWSpec,
ServiceSpec,
YamlLiteralString,
- TunedProfileSpec,
+ MgmtGatewaySpec,
)
from ceph.deployment.drive_group import DriveGroupSpec
from ceph.deployment.hostspec import SpecValidationError
-@@ src/python-common/ceph/tests/test_service_spec.py: def test_tuned_profile_spec_profile_name_validation(spec_yaml, expect_error, err
- assert spec.placement is not None
- # round-trip
- assert TunedProfileSpec.from_json(spec.to_json()).profile_name == spec.profile_name
+@@ src/python-common/ceph/tests/test_service_spec.py: spec:
+
+ assert 'ssl_cert: |' in dumped
+ assert 'ssl_key: |' in dumped
++
+
[email protected](
+ "virtual_ip, valid",How to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
|
This PR has been added to wip-yuri14-testing-20261021.151926-tentacle. |
|
jenkins test make check |
|
jenkins test make check |
backport tracker: https://tracker.ceph.com/issues/80820
backport of #71897
parent tracker: https://tracker.ceph.com/issues/80644
this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh