-
Notifications
You must be signed in to change notification settings - Fork 348
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
private PKI: optional trusted CA for HTTPS request.get in Apache Airflow package operator catalog and Apache Airflow provider package operator catalog #2797
Comments
This sounds like a pretty straightforward approach (I'll probably regret saying this later!). We'd have to provide the user (or admin, who installs JupyterLab/Elyra) with the ability to specify the mounted file system location where the certificates can be found. Not sure we'll manage to set up/get access to a system to fully test this out, but if we were to provide you temporarily with a custom build would you be able to deploy that in a sandbox for testing/feedback? |
I have a sandbox I could use in the form of a namespace on an openshift 4.x Cluster, yes, I would gladly try it out then. My observations so far, two main topics, to be exact
which is probably a result of this configmap which is feeding an env variable here which is then used to create the pvc when the image is spawned https://github.com/opendatahub-io/jupyterhub-odh/blob/master/.jupyter/jupyterhub_config.py
Possibly /opt/app-root/etc/jupyter/custom in a directory called certs
user group others s2i-lab-elyra docker image https://github.com/opendatahub-io/s2i-lab-elyra https://github.com/opendatahub-io/s2i-lab-elyra/blob/master/.s2i/bin/assemble |
Patrik, for your part of the code and requests.get, I verified that when providing the ca-bundle file in pem Format in the form of root CA followed by, if any, intermediate CA pem, the SSLVerifyError disappears and the file can be downloaded.
That section with verify should only be executed when file /opt/app-root/etc/jupyter/custom/cacerts/trustedcas.pem is present. @ptitzler @LaVLaS As mentioned in the Jupyterhub-ODH ticket, this location to me is a common custom jupyter files location. As of now, I hardcoded it in my custom spawner code. Patrik, you mentioned "have to provide the user (or admin, who installs JupyterLab/Elyra) with the ability to specify the mounted file system location" - that would be possible, too, providing an env variable. If that instead of my proposed pre-programmed location were desired, I could easily modify the custom spawner code in jupyterhub-odh together with the ODH folks. It should not apply to Elyra images alone, though, but also to the standard ODH data science images, if that was to be the way to go. Then, the question would be whether to apply this to a custom config, e.g. CUSTOM_CA_MOUNT_PATH, similar to singleuser_pvc_size os.env var in ODH's juypterlab configmap and deploymentconfig Alternatively, such an env could be defined directly in the docker image Dockerfile, too. Whether with hard-coded path or not, now we just need the jupyterhub-odh folks to allow mapping the configmap into the filesystem, which I tested out with hints from the open data hub folks on our OCP 4.8 Cluster. Should the changes from opendatahub-io-contrib/jupyterhub-odh#137 (comment) make it into an ODH overlay, this would be good to go, as I have tested with our private PKI SSL CA setup and our internal Artifactory
output OK, no more SSL verify errors:
|
Is your feature request related to a problem? Please describe.
This is an extension of the enhancement request in #2787 (BasicAuth and Proxy).
I tested with an enterprise-internal, noproxy Artifactory location that has anonymous access enabled. This led to another issue with https connections.
We have an enterprise-internal public key infrastructure for SSL Certificates of our repository servers, such as Artifactory and Harbor.
The main issue with https connections against those urls is that CA certificates issued by such a private PKI are not publicly trusted, which is an issue in client applications referencing the server url.
Thus, we get the following message when connecting the the, in our case, Artifactory Https Url
"[E 2022-06-24 06:11:24.955 ElyraApp] Error retrieving operator list from Airflow package https://repo.private.domain/ui/native/folder/airflow_packages_core_operators/apache_airflow.py3-none-any.whl: HTTPSConnectionPool(host='repo.private.domain', port=443): Max retries exceeded with url: /ui/native/folder/airflow_packages_core_operators/apache_airflow.py3-none-any.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)')))"
Describe the solution you'd like
@akchinSTC
In Java applications running on openshift, we added the private CA / pem certificate via a secret or configmap and mounted it into a container-internal file system location that Java then added as trusted CAs.
https://docs.openshift.com/container-platform/4.8/networking/configuring-a-custom-pki.html#certificate-injection-using-operators_configuring-a-custom-pki
e.g. in the namespace, add an empty configmap like so:
https://github.com/trevorbox/reloader-operator/blob/f07d1858825cc8515f45c2cf03b84c23e994aa7e/helm/app/templates/configmap-trusted-cabundle.yaml
and mounting it into a location in the container that python than uses for request.get trust later
https://github.com/trevorbox/reloader-operator/blob/f07d1858825cc8515f45c2cf03b84c23e994aa7e/helm/app/templates/app-nginx-echo-headers.yaml#L50
The general idea is to go with the openshift standard of defining trusted PKI CAs / CA Bundles only once at a cluster level and then to have those additional CAs available in the configmap via injection, then in the container via reference.
It would be cool to have someone with Openshift know how verify this proposed approach.
Since private PKIs are not all that unusual in enterprise environments, we should look for a way to trust a private PKI root CA in python, with a good way to get it into the filesystem. In a first step, GUI-based only perhaps, but it would be better container filesystem-based.
I found the following with regards to python, last quarter of the article https://realpython.com/python-https/
"If you want to avoid this message, then you have to tell requests about your Certificate Authority"
Describe alternatives you've considered
For our internal systems, we have no other way than enterprise-internal PKI
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: