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(20.04): add 'data' slice to openssl SDF #262

Conversation

zhijie-yang
Copy link
Collaborator

@zhijie-yang zhijie-yang commented Jun 21, 2024

Proposed changes

Add openssl_data slice for users does not require the "openssl" binaries, but only needs the pem bundled certificate at the default cafile.

The problem: Programmes in rocks with base focal and jammy cannot get local issuer certificates during an SSL certificate verification.

The cause: The lack of both the symlinks of certificates and rehashed symlinks to the certificates in /etc/ssl/certs that point to the certificates introduced by package "ca-certificates" and the symlink pointing to the ca-certificates bundle crt file.

To cope with this problem, we are diverging a bit from the behaviour of the package "openssl" in focal and jammy, providing the symlink /usr/lib/ssl/cert.pem -> /etc/ssl/certs/ca-certificates.crt in the slice openssl_data. The reasons behind that are:

  1. The SSL library by default reads the local certificates firstly at the bundled certificates cafile, which defaults at /usr/lib/ssl/certs.pem, and then the single certificates in capath which defaults to /usr/lib/ssl/certs.

  2. In focal and jammy, the "openssl" package does not provide a capath symlink /usr/lib/ssl/certs.pem -> /etc/ssl/certs/ca-certificates.crt. As a result, the certificates have to be read from the capath, which by default is /usr/lib/ssl/certs -> /etc/ssl/certs, wheretthe certificates from package "ca-certificates" are symbolically linked to /etc/ssl/certs by the script update-ca-certificates and rehashed with openssl rehash or c_rehash (this is automatically triggered with the maintainer scripts of the package "ca-certificates"). However, with the current specification of chisel slice definition files and starlark (the mutation script language in chisel SDF), it's not possible to fully mimic the behaviour of the maintainer scrip and the update-ca-certificates script in the package "ca-certificates" to calculate the hashes for the certificates and create symlinks with file name format HHHHHHHH.D (H for hex, D for dec) within the directory /etc/ssl/certs.

  3. Such symlink /usr/lib/ssl/certs.pem -> /etc/ssl/certs/ca-certificates.crt is provided in the package "openssl" starting from noble. It is verified to work for the same case in a rock built with a noble base.

Therefore, we providing a symlink /usr/lib/ssl/certs.pem -> /etc/ssl/certs/ca-certificates.crt is the only solution for now, though it deviates a bit from the behaviour of the package "openssl".

FYI: @letFunny

Related issues/PRs

Forward porting

#273

Checklist

@zhijie-yang zhijie-yang changed the title feat(22.04): add 'data' slice to openssl SDF feat(20.04): add 'data' slice to openssl SDF Jun 21, 2024
Copy link

Diff of dependencies:
None found.


@zhijie-yang zhijie-yang force-pushed the ROCKS-994-openssl_data-slice-20.04 branch from 7cc59cf to 7b3e319 Compare June 21, 2024 17:45
@zhijie-yang zhijie-yang reopened this Jun 27, 2024
@zhijie-yang zhijie-yang requested a review from cjdcordeiro June 27, 2024 09:57
@zhijie-yang zhijie-yang requested review from letFunny and linostar June 27, 2024 10:02
Copy link

@linostar linostar left a comment

Choose a reason for hiding this comment

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

LGTM.

slices/openssl.yaml Outdated Show resolved Hide resolved
@rebornplusplus rebornplusplus added the Priority Look at me first label Jul 5, 2024
Copy link
Member

@rebornplusplus rebornplusplus left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@rebornplusplus rebornplusplus self-assigned this Jul 9, 2024
Copy link
Collaborator

@cjdcordeiro cjdcordeiro left a comment

Choose a reason for hiding this comment

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

sounds good, thanks

@cjdcordeiro cjdcordeiro merged commit 24190e8 into canonical:ubuntu-20.04 Jul 19, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority Look at me first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants