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

[Bug]: After #1257 autoscaler stopped working. #1271

Closed
patope opened this issue Mar 12, 2024 · 12 comments · Fixed by #1272
Closed

[Bug]: After #1257 autoscaler stopped working. #1271

patope opened this issue Mar 12, 2024 · 12 comments · Fixed by #1272
Labels
bug Something isn't working

Comments

@patope
Copy link
Contributor

patope commented Mar 12, 2024

Description

#1257 broke auto scaler. Autoscaler runs fine with 2.13.1, but fails with 2.13.2. Cluster needs to be just created.

on pods logs:

F0312 16:22:32.698624       1 hetzner_cloud_provider.go:186] Failed to create Hetzner manager: failed to get ssh key error: Get "https://api.hetzner.cloud/v1/ssh_keys/19959902": tls: failed to verify certificate: x509: failed to load system roots and no roots provided; open /etc/ssl/certs: permission denied

Host audits:

type=AVC msg=audit(1710260420.902:1266): avc:  denied  { read } for  pid=4733 comm="system-upgrade-" name="certs" dev="overlay" ino=434 scontext=system_u:system_r:container_t:s0:c677,c872 tcontext=system_u:object_r:cert_t:s0 tclass=lnk_file permissive=0
type=AVC msg=audit(1710260420.902:1267): avc:  denied  { read } for  pid=4733 comm="system-upgrade-" name="ca-bundle.pem" dev="overlay" ino=433 scontext=system_u:system_r:container_t:s0:c677,c872 tcontext=system_u:object_r:cert_t:s0 tclass=lnk_file permissive=0
type=AVC msg=audit(1710260444.549:1547): avc:  denied  { read } for  pid=6274 comm="cluster-autosca" name="pem" dev="sda2" ino=296 scontext=system_u:system_r:container_t:s0:c517,c844 tcontext=system_u:object_r:cert_t:s0 tclass=dir permissive=0

audit2allow

# ausearch --raw | audit2allow 


#============= container_t ==============

#!!!! This avc can be allowed using the boolean 'container_read_certs'
allow container_t cert_t:dir read;

#!!!! This avc can be allowed using the boolean 'container_read_certs'
allow container_t cert_t:lnk_file read;

Kube.tf file

source = "kube-hetzner/kube-hetzner/hcloud"
  version = "2.13.2"

Screenshots

No response

Platform

Linux

@patope patope added the bug Something isn't working label Mar 12, 2024
@patope
Copy link
Contributor Author

patope commented Mar 12, 2024

Problem seems to be in policy compilation

With 2.13.2 root's home folder contains only

  • kube_hetzner_selinux.te

on 2.13.1 there are

  • kube_hetzner_selinux.te
  • kube_hetzner_selinux.mod
  • kube_hetzner_selinux.pp

@lpellegr
Copy link

lpellegr commented Mar 12, 2024

I just experienced the same problem, and it even caused a working cluster that updates by itself to stop working. Using version 2.13.1 helps, but you still need to recreate the cluster again from scratch.

@mateuszlewko
Copy link

it even caused a working cluster that updates by itself to stop working.

Sorry for off topic, but what do you mean by cluster updating itself? Do you mean automatic system updates, or do you have some automation that applies the newest version of this terraform module?

@lpellegr
Copy link

it even caused a working cluster that updates by itself to stop working.

Sorry for off topic, but what do you mean by cluster updating itself? Do you mean automatic system updates, or do you have some automation that applies the newest version of this terraform module?

I would say automatic system updates since I have no automation.

@mysticaltech
Copy link
Collaborator

@patope @lpellegr I will add the missing SELinux rules ASAP.

@patope
Copy link
Contributor Author

patope commented Mar 12, 2024

@mysticaltech I already made PR #1272 to resolve this. Problem is unknown permissions on anon_inode

@mysticaltech
Copy link
Collaborator

@patope I don't understand, you are removing permissions in the PR, how can that help?

@patope
Copy link
Contributor Author

patope commented Mar 12, 2024

@mysticaltech those permissions are not valid for anon_inode and policy compiler will fail on those.

@mysticaltech
Copy link
Collaborator

@patope Ok, I see. Thanks for the info.

@mysticaltech
Copy link
Collaborator

@patope @lpellegr Should be fixed in v2.13.3. Lesson learned, when modifying SElinux policies, always test if it compiles correctly 😅 And thanks again for the tip!

@lpellegr
Copy link

Thanks for the fix!

@brain-dev-null
Copy link

Thank you! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants