[caclmgrd] Own the redfish docker0 syslog INPUT exception - #429
Conversation
Signed-off-by: shreyansh-nexthop <shreyansh@nexthop.ai>
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
…log tests caclmgrd_redfish_acl_test.py already drives handle_feature_state_events through the same four cases: enable transition, disable transition, unrelated key ignored, and same-state no-op. The copy added alongside the syslog tests called the pre-rename name and duplicated coverage that already exists. Signed-off-by: Shreyansh Jain <shreyansh@nexthop.ai>
|
/azp run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
rebuild-source: sonic-net#429 @ nexthop-ai/sonic-host-services 48324e6 [case: upstream:open]
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
yxieca
left a comment
There was a problem hiding this comment.
Approve.
Makes caclmgrd own the redfish docker0 syslog (RELP tcp/2514) INPUT exception, consolidating the previously dhcp_server-only rule into a per-feature loop. Since redfish is bridge-networked, its rsyslog arrives on docker0 rather than lo and would otherwise be swept into the control-plane catch-all DROP.
Verified:
- Fail-closed:
RedfishAlloweddefaults False and is seeded from FEATURE state, so the port only opens when redfish is explicitly enabled. - The exception is re-emitted on every rebuild immediately before the catch-all DROP, so there's no rebuild window where a DROP exists without it (covered by
test_rule_reinserted_before_catch_all_drop). - Runtime enable/disable reprograms the rule via the FEATURE-table event handler; dhcp_server semantics are unchanged.
- The test's rule constant is pinned byte-for-byte to the container-side
-Ccheck, keeping the caclmgrd/container contract in sync.
Non-blocking: the exception accepts any bridge container's RELP to docker0:2514, not strictly redfish's rsyslog — inherent to the shared docker0 bridge and identical to the existing dhcp_server exception, scoped by feature-enable.
Reviewed with AI assistance on behalf of Ying.
rebuild-source: sonic-net#429 @ nexthop-ai/sonic-host-services 48324e6 [case: upstream:open]
rebuild-source: sonic-net#429 @ nexthop-ai/sonic-host-services 48324e6 [case: upstream:open]
|
The label |
|
The change is not in msft-202608 yet. @shreyansh-nexthop, please manually create the cherry pick PR for branch msft-202608. ---Powered by SONiC BuildBot
|
|
This PR has backport request label(s) for branch(es): msft-202608, but is missing required test information. Please make sure you tick the tested branch(es) in the Tested branch section and provide test evidence (e.g., 202608: <test result>) in the Test result section as well in your PR description. ---Powered by SONiC BuildBot
|
|
Hi @shreyansh-nexthop , Could you help resolve the cherry-pick conflict to 202608 branch |
Have raised manual PR for 202608: Azure/sonic-host-services.msft#23 and Azure/sonic-buildimage-msft#3137. Thanks! |
Why I did it
redfishruns bridge-networked on platforms that enable it, so its rsyslog forwards to the docker0 gateway over RELP (tcp/2514) rather than to127.0.0.1.caclmgrdflushes and rebuilds theINPUTchain on every control-plane ACL change and appends a catch-allDROP. That forwarded syslog arrives ondocker0, notlo, so it is not covered by the loopback ACCEPT and gets swept into the catch-all DROP. Logs emitted inside theredfishcontainer never reach the host/var/log/syslog, including a process going FATAL at startup, which is exactly when they are most needed.Installing the exception from the container start script does not work, for two independent reasons:
caclmgrdowns theINPUTchain and flushes it on every reconcile, so a rawiptables -Iis wiped on the next control-plane ACL change.redfish.serviceruns as thesonicadminuser, soiptablesinExecStartPrefails with "you must be root" and the rule is never installed at all.This mirrors the
dhcp_serverdocker0 syslog exception added in #412, which resolved the same problem for that container.How I did it
Generalize the existing single
dhcp_serverexception into a loop over the bridged-container features, socaclmgrdowns the rule and re-emits it on every rebuild.iptables -A INPUT -i docker0 -p tcp --dport 2514 -j ACCEPT -m comment --comment redfish_sysloginget_acl_rules_and_translate_to_iptables_commands(), immediately after the loopback ACCEPTs and therefore before the catch-all DROP.docker0exists only in the host namespace.RedfishAllowedflag, which is already seeded fromFEATURE|redfishstate at init and updated on FEATURE-table events, so no new flag or event plumbing is needed.--comment redfish_syslogso the rule is identifiable iniptables -Sand can be matched by a container-sideiptables -Cpresence check.Unit tests cover flag seeding from feature state, the rule being emitted when enabled and absent when disabled or when the FEATURE entry is missing, ordering strictly before the catch-all DROP, host-namespace-only emission, and the FEATURE-table event transitions across a runtime feature toggle.
How to verify it
On a platform with
redfishenabled:caclmgrdprograms its catch-all DROP), then confirm the exception is ordered above the DROP:ESTABLISHEDentry cannot mask the result, then probe end to end:Verified on a platform with a CTRLPLANE ACL configured so
caclmgrdprograms its catch-all DROP:redfish_syslogACCEPT present and owned bycaclmgrd.systemctl restart caclmgrd, still at line 4 with the DROP at line 18.docker exec redfish loggerwas delivered to the host/var/log/syslog.REDFISHCTRLPLANE ACL table was exercised in the same run and produced its expected-A INPUT -s 10.0.0.0/8 -p tcp --dport 443 -j ACCEPT.Note that this change alone does not make redfish syslog work. It only opens the firewall path. A companion
sonic-buildimagechange is required for delivery, pointingSYSLOG_TARGET_IPat the docker0 gateway and adding the host rsyslog docker0 listener.Which release branch to port
Description for the changelog
[caclmgrd] Own the redfish docker0 syslog (RELP tcp/2514) INPUT exception so it survives the control-plane ACL flush-and-rebuild.
Link to config_db schema for YANG module changes
N/A, no schema change.