-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
caclmgrd: correct IP2ME address logic #9826
Conversation
This comment has been minimized.
This comment has been minimized.
/AzurePipelines run |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
This comment has been minimized.
This comment has been minimized.
Commenter does not have sufficient privileges for PR 9826 in repo Azure/sonic-buildimage |
This comment has been minimized.
This comment has been minimized.
PR is missing the unit tests |
Tests added |
This comment has been minimized.
This comment has been minimized.
e5dcf8a
to
acc9b95
Compare
dockers/docker-dhcp-relay/cli-plugin-tests/test_show_dhcpv6_helper.py
Outdated
Show resolved
Hide resolved
@prsunny the change looks good to me. The only thing is that I am not sure if relaxing mgmt cacl aligns with our design? |
To be clear, this PR does not relax the cacls for MGMT in practice - unless I am missing something. My assessment is that the previous MGMT cacls never worked as intended and wouldn't block any traffic unless these very specific scenarios were met:
I would be very surprised if anyone used SONiC in these scenarios - and if they did, they would have no way to SSH into the switch as the default factory configuration would block SSH on the MGMT interface. It stands to reason they would have reported an issue. |
Thanks for the clarifications! |
Let's merge #9903 before this PR. |
I'm not sure I understand the case here. Currently we install drop rules as below:
Our requirement is to block kernel accepting any packet to the gw IPs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check comment
Sure,
Can you explain why these cases are formulated this way? I suspect these are not the true requirements, but rather a misstaken way to block the IPs configured on the switch. As I explained above, the current behavior does not make any sense as it would be almost impossible for it to block packets in real life scenarios. It does not protect the control plane currently in practice, so the scenario does not make sense as currently formulated in the code. To avoid talking in circles, we can break it down if we look at the original PR (#4412) these are the relevant scenarios:
These were broken before this PR and only supported
This one is a bit more difficult. The only interpretation I can make of this sentence that make sense is that the assumption that the SONiC switch is the gateway. Thus we can simplify the sentence to be like the other interfaces above; "Add iptables rules to drop all packets destined for VLAN interface IP addresses". In the case where we are not the gateway, the packets would never enter the Is that answer to your question @prsunny ? |
It seems the current tests on master is a bit unstable. I rebased against latest master in an attempt to see if the tests were fixed but now they appear to be even more broken. Before the rebase the test results can be found here. It appears that issue happens on other PRs as well (like this one) so it seems to have nothing to do with the code here. Earlier test runs of this PR were fine before adding the .1 logic, FWIW. |
@prsunny What are the next steps here? The tests seems to be failing in the current master branch already, so I cannot provide a PR with all tests working. Do you want to wait until somebody fixes the master branch before merging these, or are you fine accepting this patch with the tests broken in master? |
@bluecmd , would you please rebase to latest? |
Done! EDIT: Whoops, accidentally clicked "comment and close", Reopened it again. |
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
Ensure that the destination IP that is permitted is the interface IP only, and not the whole subnet. Signed-off-by: Christian Svensson <blue@cmd.nu>
Signed-off-by: Christian Svensson <blue@cmd.nu>
Signed-off-by: Christian Svensson <blue@cmd.nu>
It was decided to keep this current behavior for now. Signed-off-by: Christian Svensson <blue@cmd.nu>
I will move this PR to https://github.com/sonic-net/sonic-host-services now when this code has moved. |
See sonic-net/sonic-host-services#4 for the first part of this "version 2" attempt :-) |
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Currently the first IP on the VLAN subnet is used, regardless of whatever IP is actually assigned to the control plane. This fix uses the correct IP. See earlier work: - sonic-net/sonic-buildimage#9826 - sonic-net/sonic-buildimage#7178 - sonic-net/sonic-buildimage#7008 Signed-off-by: Christian Svensson <blue@cmd.nu>
Why I did it
Fixes #7008.
Ensure that the destination IP that is permitted is the interface IP.
Currently the logic does not handle IP interfaces correctly and only produces correct results for
/32
or/128
subnets.See
iptables -vnL
How I did it
Corrected the logic and the iptables commands executed.
It is likely that the initial implementation was only ever tested on L3 interfaces with
/32
and VLAN-interfaces where the switch had the first IP in the network (e.g.192.168.0.1/24
).How to verify it
iptables -vnL
You will see something like this:
Note that MGMT_INTERFACEs are not blocked by default.
Which release branch to backport (provide reason below if selected)
Description for the changelog
caclmgrd: handle IP2ME subnets
A picture of a cute animal (not mandatory but encouraged)
Note: The original code was added in #4412