Skip to content
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

feat(preflights): add arp filtering related preflights #1454

Conversation

JGAntunes
Copy link
Member

@JGAntunes JGAntunes commented Nov 5, 2024

What this PR does / why we need it:

Keeping the PR in draft mode as we try to create sysctl specifc preflights instead:

Changes have been merged, I'll work on releasing troubleshoot and testing the spec.

Docs for reference - https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html

Which issue(s) this PR fixes:

https://app.shortcut.com/replicated/story/114999/add-preflights-for-arp-filter-and-arp-ignore-kernel-parameters

Does this PR require a test?

Simple spec change, but run a test locally:

root@node0:/replicatedhq/embedded-cluster# output/bin/embedded-cluster install run-preflights --no-prompt --license local-dev/Joao.yaml
✔  Host files materialized!
✔  Host preflights succeeded!
Host preflights completed successfully
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.default.arp_filter=1
net.ipv4.conf.default.arp_filter = 1
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.default.arp_ignore = 1
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.all.arp_filter=1
net.ipv4.conf.all.arp_filter = 1
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.all.arp_ignore = 1
root@node0:/replicatedhq/embedded-cluster# output/bin/embedded-cluster install run-preflights --no-prompt --license local-dev/Joao.yaml
✔  Host files materialized!
✗  4 host preflights failed

 •  ARP filtering is enabled by default for newly created interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.default.arp_filter=0` followed by running `sudo sysctl -p`.
 •  ARP ignore is enabled by default for newly created interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.default.arp_ignore=0` followed by running `sudo sysctl -p`.
 •  ARP filtering is enabled for all interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.all.arp_filter=0` followed by running `sudo sysctl -p`.
 •  ARP ignore is enabled for all interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.all.arp_ignore=0` followed by running `sudo sysctl -p`.

Please address these issues and try again.

Does this PR require a release note?

Adds preflight checks for the `arp_ignore` and `arp_filter` kernel parameters

Does this PR require documentation?

NONE

@JGAntunes JGAntunes self-assigned this Nov 5, 2024
Copy link
Contributor

@ricardomaraschini ricardomaraschini left a comment

Choose a reason for hiding this comment

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

Shouldn't we use the collector introduced by #1449 ?

@JGAntunes
Copy link
Member Author

@ricardomaraschini we're keeping this on pause while we look into:

But yeah, if we end up going with this PR we should use the collector you introduced.

@ricardomaraschini
Copy link
Contributor

@ricardomaraschini we're keeping this on pause while we look into:

But yeah, if we end up going with this PR we should use the collector you introduced.

Oh, nice. In the end we would migrate this (and mine) to use the new collector and analyzer. Thanks.

Copy link

github-actions bot commented Nov 8, 2024

This PR has been released (on staging) and is available for download with a embedded-cluster-smoke-test-staging-app license ID.

Online Installer:

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci/appver-dev-3735481" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Airgap Installer (may take a few minutes before the airgap bundle is built):

curl "https://staging.replicated.app/embedded/embedded-cluster-smoke-test-staging-app/ci-airgap/appver-dev-3735481?airgap=true" -H "Authorization: $EC_SMOKE_TEST_LICENSE_ID" -o embedded-cluster-smoke-test-staging-app-ci.tgz

Happy debugging!

@JGAntunes JGAntunes force-pushed the jgantunes/sc-114999/add-preflights-for-arp-filter-and-arp-ignore branch from 25f513b to 0d909cf Compare November 8, 2024 15:03
@JGAntunes JGAntunes requested a review from ajp-io November 8, 2024 19:31
@JGAntunes
Copy link
Member Author

@ajp-io I've updated the spec, feel free to 👀 the preflight text and push any changes that you deem worth. I'll work on updating troubleshoot and test the spec next week.

Comment on lines 841 to 852
- fail:
when: 'net.ipv4.conf.default.arp_filter > 0'
message: "ARP filtering is enabled by default for newly created interfaces on the host. Disable it by running 'sysctl net.ipv4.conf.default.arp_filter=0'."
- fail:
when: 'net.ipv4.conf.default.arp_ignore > 0'
message: "ARP ignore is enabled by default for newly created interfaces on the host. Disable it by running 'sysctl net.ipv4.conf.default.arp_ignore=0'."
- fail:
when: 'net.ipv4.conf.all.arp_filter > 0'
message: "ARP filtering is enabled for all interfaces on the host. Disable it by running 'sysctl net.ipv4.conf.all.arp_filter=0'."
- fail:
when: 'net.ipv4.conf.all.arp_ignore > 0'
message: "ARP ignore is enabled for all interfaces on the host. Disable it by running 'sysctl net.ipv4.conf.all.arp_ignore=0'."
Copy link
Member

Choose a reason for hiding this comment

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

I think you want a pass condition here too.

As I understand Troubleshoot, you hit a matching when and drop out there. So if someone has filter and ignore set incorrectly, they would only get the message that comes first in this list. Is that correct? If so, can we make this so that all failure conditions would show? Not sure if that needs to be two analyzers or something else.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, I misunderstood troubleshoot in that aspect. Tested it out locally now and looks 👍

Copy link
Member

Choose a reason for hiding this comment

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

The separate analyzers looks good. I still think you need a pass for each in addition to the fail. See the other analyzers in there, like here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed via - 3735481

pkg/preflights/host-preflight.yaml Show resolved Hide resolved
outcomes:
- fail:
when: 'net.ipv4.conf.default.arp_filter > 0'
message: "ARP filtering is enabled by default for newly created interfaces on the host. Disable it by running 'sysctl net.ipv4.conf.default.arp_filter=0'."
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure these instructions make the change permanent. I think you might want to edit /etc/sysctl.conf and then use sysctl -p.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, changed the instructions in - 6c800ba

@JGAntunes JGAntunes force-pushed the jgantunes/sc-114999/add-preflights-for-arp-filter-and-arp-ignore branch from b93b64b to 3bb1fef Compare November 11, 2024 15:09
@JGAntunes JGAntunes marked this pull request as ready for review November 11, 2024 15:11
@JGAntunes
Copy link
Member Author

@ajp-io addressed your review and have run this locally:

root@node0:/replicatedhq/embedded-cluster# output/bin/embedded-cluster install run-preflights --no-prompt --license local-dev/Joao.yaml
✔  Host files materialized!
✔  Host preflights succeeded!
Host preflights completed successfully
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.default.arp_filter=1
net.ipv4.conf.default.arp_filter = 1
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.default.arp_ignore=1
net.ipv4.conf.default.arp_ignore = 1
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.all.arp_filter=1
net.ipv4.conf.all.arp_filter = 1
root@node0:/replicatedhq/embedded-cluster# sysctl net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.all.arp_ignore = 1
root@node0:/replicatedhq/embedded-cluster# output/bin/embedded-cluster install run-preflights --no-prompt --license local-dev/Joao.yaml
✔  Host files materialized!
✗  4 host preflights failed

 •  ARP filtering is enabled by default for newly created interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.default.arp_filter=0` followed by running `sudo sysctl -p`.
 •  ARP ignore is enabled by default for newly created interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.default.arp_ignore=0` followed by running `sudo sysctl -p`.
 •  ARP filtering is enabled for all interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.all.arp_filter=0` followed by running `sudo sysctl -p`.
 •  ARP ignore is enabled for all interfaces on the host. Disable it by editing `/etc/sysctl.conf` and adding the line
    `net.ipv4.conf.all.arp_ignore=0` followed by running `sudo sysctl -p`.

Please address these issues and try again.

@ajp-io
Copy link
Member

ajp-io commented Nov 12, 2024

I left a comment on an outdated comment, which means you might not see it. Here it is #1454 (comment)

@JGAntunes
Copy link
Member Author

@ajp-io addressed via 3735481

@ajp-io
Copy link
Member

ajp-io commented Nov 13, 2024

lgtm, though I don't know if you need an engineer's review too

@JGAntunes JGAntunes merged commit f805a16 into main Nov 13, 2024
67 checks passed
@JGAntunes JGAntunes deleted the jgantunes/sc-114999/add-preflights-for-arp-filter-and-arp-ignore branch November 13, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants