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

Improve security of zarf registry NodePort #2146

Open
bburky opened this issue Nov 15, 2023 · 2 comments
Open

Improve security of zarf registry NodePort #2146

bburky opened this issue Nov 15, 2023 · 2 comments
Labels
enhancement ✨ New feature or request

Comments

@bburky
Copy link
Contributor

bburky commented Nov 15, 2023

Currently the zarf registry uses a NodePort which a) exposes an unneeded external listening port on every node and b) likely uses insecure communication between nodes.

Item a) can actually be mitigated today with the --nodeport-addresses=127.0.0.0/8 kube-proxy setting, but please note that this disables NodePorts entirely external to your nodes, this is not a solution for all users. However, if users do not need externally reachable NodePorts, this works today and disables the externally listening port.

One solution is to use a proper HTTPS registry, but this requires reconfiguring the CRI with the registry's likely-self-signed certificate. Today zarf is CRI agnostic and requires no manual configuration, perhaps this could be an alternate manual setting with the user manually reconfiguring their CRI, but I would like to see a secure configuration by default.

Another idea is to use a ClusterIP HTTPS registry and a DaemonSet reverse proxy pod listening on a 127.0.0.1:31999 hostPort (HTTP, localhost only). Zarf uses a localhost HTTP registry for zero configuration with the CRI which this would still support (and HTTP is not insecure on localhost). Communication between nodes would be secured with HTTPS.

(A hostPort is preferable to a hostNetwork here. It's least privilege, we don't want the permissions of the host network namespace. IT supports specifying hostIP: 127.0.0.1 so it will not be reachable externally, unlike NodePorts which depend on the --nodeport-addresses setting. It may be an issue that the hostPort will be inaccessible during registry restarts, a rolling restart like a NodePort supports is not possible. I'm also not sure what this startup will look like for new nodes without the DaemonSet pod yet on them and other things, needs some research.)

There are also a number of other in-cluster registries like https://github.com/XenitAB/spegel (which appears to be lighter weight than Dragonfly and Kraken). Spegel appears to do a very similar hostPort only binding as above, it's worth reviewing their configuration regardless. If we like one of these registries well enough to recommend we should test it, they should be compatible with zarf as an external registry and could be installed during zarf init, some minor work may be needed to bootstrap images.

@bburky bburky added the enhancement ✨ New feature or request label Nov 15, 2023
@bburky
Copy link
Contributor Author

bburky commented Nov 15, 2023

See #375 about HA registries for some previous discussion of registries including some third party in-cluster registries.

@phillebaba
Copy link
Contributor

@bburky a bit off topic from this issue but I am currently working on enabling other projects to use Spegel as a library instead. This would remove a lot of the security concerns connected to running Spegel in a container. The goal is to integrate Sepgel with k3s to enabled air gap installs. This might also be useful for zarf.

@salaxander salaxander added this to Zarf Jul 22, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Zarf Jul 22, 2024
@salaxander salaxander removed the status in Zarf Jul 22, 2024
@salaxander salaxander moved this to Triage in Zarf Sep 10, 2024
@brandtkeller brandtkeller moved this from Triage to Backlog in Zarf Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants