Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

update-ca-certificates doesn't concatenate properly certificates if trailing newline is missing #1601

Open
adam-bartlett-sp opened this issue Dec 17, 2024 · 1 comment
Labels
kind/bug Something isn't working

Comments

@adam-bartlett-sp
Copy link

Description

update-ca-certificates blindly concats certificates without concern for a newline at the end of the file. This is concerning in environments where certificates are provided by enterprise teams that may not always have a newline. This issue was fixed in Debian 13 years ago and in Alpine 6 years ago.

Impact

ca-certificates bundle will be invalid, which breaks a number of services.

Environment and steps to reproduce

  1. Set-up: create a valid pem file in /etc/ssl/certs with no newline at EOF
  2. Task: execute update-ca-certificates, then attempt a curl
  3. Action(s):
    a. write an valid x.509 PEM file into /etc/ssl/certs with no new line before EOF
    b. Execute sudo /usr/sbin/update-ca-certificates
    c. curl https://flatcar.org
  4. Error: curl: (77) error setting certificate file: /etc/ssl/certs/ca-certificates.crt

Expected behavior

We would expect curl to complete and show a 301 Moved Permanently.

Additional information

Bugs in Debian & Alpine:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=635570
https://gitlab.alpinelinux.org/alpine/aports/-/issues/8379

@jepio
Copy link
Member

jepio commented Dec 18, 2024

Flatcar's implementation of update-ca-certificates.

It should be changed to a for loop with sed (https://github.com/ClusterHQ/gentoo/blob/master/usr/sbin/update-ca-certificates#L80C3-L80C15) or cat+echo.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
kind/bug Something isn't working
Projects
Status: 📝 Needs Triage
Development

No branches or pull requests

2 participants