Skip to content

caclmgrd interface rules patch 1#197

Merged
qiluo-msft merged 3 commits intosonic-net:masterfrom
gupurush:caclmgrd-interface-rules-patch-1
Mar 26, 2025
Merged

caclmgrd interface rules patch 1#197
qiluo-msft merged 3 commits intosonic-net:masterfrom
gupurush:caclmgrd-interface-rules-patch-1

Conversation

@gupurush
Copy link
Copy Markdown
Contributor

@gupurush gupurush commented Dec 27, 2024

Added management port exclusion (!, -i, eth0) for data plane protocols in iptable rules. Data plane protocols like BGP, BFD, and VXLAN are restricted to data interfaces only, while management protocols (NTP, SNMP, SSH) retain management port access. This enforces proper traffic segregation between management and data plane.

What is the motivation for this PR?
To enhance security by properly segregating management and data plane traffic through iptable rules in caclmgrd.

How did you do it?
Added exclude_mgmt_port rule (!, -i, eth0)
Applied exclusion to data plane protocols (BGP, BFD, VXLAN)
Preserved management port access for management services (NTP, SNMP, SSH)
Implemented conditional exclusion for other ACL rules based on service type

@mssonicbld
Copy link
Copy Markdown

/azp run

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Dec 27, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@gupurush gupurush force-pushed the caclmgrd-interface-rules-patch-1 branch from 91e84f7 to 38f32c7 Compare December 27, 2024 03:32
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@gupurush gupurush force-pushed the caclmgrd-interface-rules-patch-1 branch from 38f32c7 to d131a47 Compare January 2, 2025 20:49
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@gupurush gupurush marked this pull request as ready for review January 7, 2025 20:08
@bingwang-ms
Copy link
Copy Markdown

@ZhaohuiS Could you help review?

scripts/caclmgrd Outdated
if (dst_port not in self.ACL_SERVICES["NTP"]["dst_ports"] and
dst_port not in self.ACL_SERVICES["SNMP"]["dst_ports"] and
dst_port not in self.ACL_SERVICES["SSH"]["dst_ports"]):
rule_cmd = self.exclude_mgmt_port(rule_cmd)
Copy link
Copy Markdown
Contributor

@ZhaohuiS ZhaohuiS Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For EXTERNAL_CLIENT, there is no DST_PORT setting for it, with your change, does it mean it will block restapi or gnmi traffic from eth0?

@qiluo-msft @prsunny could you please review this change? It will prohibit traffic from eth0 except NTP,SNMP and SSH.

        "EXTERNAL_CLIENT": {
            "ip_protocols": ["tcp"],
            "multi_asic_ns_to_host_fwd":True
        },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ZhaohuiS We can add the protocols in ACL_SERVICES that has to go through eth0, could we have the defined list of protocols?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I know, EXTERNAL_CLIENT is designed to be used for restapi and gnmi, and the port is not defined in ACL_SERVICES , we can define flexible ports for them in acl.json.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with @ZhaohuiS , this can break existing scenarios.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed check so EXTERNAL_CLIENT is not affected; Updated tests. Please help review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gupurush could you please also update test case, otherwise submodule advance PR test will fail,

https://github.com/sonic-net/sonic-mgmt/blob/master/tests/cacl/test_cacl_application.py

The best solution should be:

  1. skip test_cacl_application from PR test
  2. imagebuild PR get merged
  3. update test case
  4. add test_cacl_application back for PR test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gupurush could you please update test_cacl_application.py to support your change in this PR? And provide the test evidence here, just want to make sure the image code change could be verified and no regression will be introduced. Thanks.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gupurush please update the test_cacl_application and enable it for PR test.

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@gupurush gupurush requested review from ZhaohuiS and prsunny February 25, 2025 22:38
@qiluo-msft qiluo-msft merged commit 6006e05 into sonic-net:master Mar 26, 2025
5 checks passed
yejianquan pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jun 4, 2025
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jun 4, 2025
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
mssonicbld pushed a commit to sonic-net/sonic-mgmt that referenced this pull request Jun 4, 2025
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: Aharon Malkin <amalkin@nvidia.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: Guy Shemesh <gshemesh@nvidia.com>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Signed-off-by: Yael Tzur <ytzur@nvidia.com>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Mar 27, 2026
Description of PR
Summary:
Fixes # (issue)
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

Disable test_cacl_application in PR test temporarily for merging submodule PR.

>       pytest_assert(len(missing_iptables_rules) == 0, "Missing expected iptables rules: {}"
                      .format(repr(missing_iptables_rules)))
E       Failed: Missing expected iptables rules: {'-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT'}
For any changes in caclmgrd, if it will fail test_cacl_application case, need to follow the steps:

skip test_cacl_application from PR test
imagebuild PR get merged
update test case
add test_cacl_application back for PR test
Type of change
 Bug fix
 Testbed and Framework(new/improvement)
 New Test case
 Skipped for non-supported platforms
 Test case improvement
Back port request
 202205
 202305
 202311
 202405
 202411
 202505
Approach
What is the motivation for this PR?
sonic-net/sonic-host-services#197 added a new change for caclmgrd,
PR test for submodule advanced PR of sonic-host-services failed.

How did you do it?
Disable test_cacl_application in PR test temporarily for merging submodule PR.

How did you verify/test it?
Retrigger PR test for sonic-host-services submodule advance PR.

Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants