-
Notifications
You must be signed in to change notification settings - Fork 318
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(icos): First phase of the firewall setup feature (DRE-258) #1451
base: master
Are you sure you want to change the base?
Conversation
31603d7
to
ca53f81
Compare
ic-os/components/hostos-scripts/generate-guestos-config/generate-guestos-config.sh
Show resolved
Hide resolved
2c44825
to
c849b6e
Compare
773291f
to
f9c86eb
Compare
We don't yet do anything with the firewall.json file, but all this work, already, is enormous just to pass a silly config file down the pipe. Horrible. I am so looking forward to your work @andrewbattat enabling the use of the configuration structures making this job enormously easier and deleting so much code from our codebase. |
9121ce5
to
0ec762c
Compare
0ec762c
to
9b84e0c
Compare
78386c8
to
7521ca4
Compare
Vulnerable dependency information The findings are: |
This was due to a mixup in testing. Should be resolved now. |
In case of absence of the default rules file, an empty text is rendered (empty text is valid input for the `nft` command). If the rules file is explicitly specified, and it does not exist, the subcommand exits with an error. When rules are in fact generated, in case the nftables chains they depend upon are not defined or referenced anywhere, the chains are created prior to flushing. This prevents errors of coordination where perhaps the system rules (which create the chains) have not yet been added to the system. Both commands default to their respective OSes' config partitions to search for the file in question (`firewall.json`). This file is added by the SetupOS into HostOS, and later propagated by HostOS into GuestOS when the GuestOS is bootstrapped. This commit does not yet incorporate the mechanisms that will actually load the rules into the kernel. That part is still being developed.
…config`. Proof from HostOS: ``` Ubuntu 20.04.6 LTS localhost ttyS0 localhost login: root Password: root@localhost:~# systemctl status nftables.service | cat ● nftables.service - nftables Loaded: loaded (/lib/systemd/system/nftables.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/nftables.service.d └─nftables-add-operator-rules.conf Active: active (exited) since Mon 2024-09-30 12:55:02 UTC; 4min 2s ago Docs: man:nft(8) http://wiki.nftables.org Process: 277 ExecStart=/usr/sbin/nft -f /etc/nftables.conf (code=exited, status=0/SUCCESS) Process: 332 ExecStart=/usr/bin/bash -c set -o pipefail ; /opt/ic/bin/hostos_tool render-firewall-config | nft -f - (code=exited, status=0/SUCCESS) Main PID: 332 (code=exited, status=0/SUCCESS) Sep 30 12:55:01 localhost bash[335]: Firewall config (from default /boot/config/firewall.json): None Sep 30 12:55:02 localhost systemd[1]: Finished nftables. Warning: journal has been rotated since unit was started, output may be incomplete. root@localhost:~# ``` Similar with GuestOS.
An invalid ruleset may cause the system to be in an insecure state post-install.
…g because who knows thought this was a good idea.
3e8bc52
to
c7665d8
Compare
rs/nervous_system/integration_tests/tests/sns_ledger_upgrade.rs
Outdated
Show resolved
Hide resolved
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.
Approving the changes under rs/registry/canister/Cargo.toml
Firewall rules loaded successfully in installed HostOS. From this config:
we get this result (see chain provider_INPUT):
|
Per https://dfinity.atlassian.net/browse/DRE-258 .
We have successfully loaded rules of well-formed
/boot/config/firewall.json
in HostOS and GuestOS.Details:
We would like to allow the node operator / provider to modify the firewall rules in order to allow incoming traffic to their nodes. This can be used to get the ability to fetch logs and metrics from the nodes in the same DC.
To achieve this, the node provider should add a new config file named
firewall.json
in the SetupOS config. This file is then propagated to the other parts of the IC-OS stack.Note that the firewall rules can only be configured during node (re)deployment, in this phase. In phase 2, it will become possible to reconfigure already running nodes. Phase 2 will be more effort than phase 1.
This PR rides atop this other one: #2077