Feature #10684
closed[Crunch2] crunch-run adding certificates to container
Description
Crunch-job includes the following setup logic to make up-to-date SSL certificates available inside the container:
.q{&& if test -f /etc/ssl/certs/ca-certificates.crt ; then VOLUMES+=("--volume=/etc/ssl/certs/ca-certificates.crt:/etc/arvados/ca-certificates.crt") ; }
.q{elif test -f /etc/pki/tls/certs/ca-bundle.crt ; then VOLUMES+=("--volume=/etc/pki/tls/certs/ca-bundle.crt:/etc/arvados/ca-certificates.crt") ; fi };
We need an equivalent feature in crunch-run. Possibly this is as simple as a -v option that passes through to "runner.Binds".
Updated by Peter Amstutz over 9 years ago
Alternately, crunch-run could DTRT and propagate the host system certs file into the container by default (which is what crunch-job is doing in the snippet above). At least when API: true
Updated by Peter Amstutz over 9 years ago
Proposal:
-ca-certs <file>
Will be mounted at /etc/arvados/ca-certificates.crt
If not provided, try
/etc/ssl/certs/ca-certificates.crt
and
/etc/pki/tls/certs/ca-bundle.crt
and mount them at /etc/arvados/ca-certificates.crt
Update Python and Go SDKs to use /etc/arvados/ca-certificates.crt
Updated by Tom Clegg over 9 years ago
- In crunch-run, if the container does not already mount anything there, add a read-only bind mount at
/etc/arvados/ca-certificates.crtusing the first one of these that exists on the worker host:/etc/arvados/ca-certificates.crt/etc/ssl/certs/ca-certificates.crt/etc/pki/tls/certs/ca-bundle.crt
- In the Python SDK, prepend
/etc/arvados/ca-certificates.crtto the array of paths in ca_certs_path() (source:sdk/python/arvados/util.py) - In the Go SDK, if
/etc/arvados/ca-certificates.crtexists and insecure mode is off, read root CAs from there. Move code from source:sdk/go/crunchrunner/crunchrunner.go (but try/etc/arvadosfirst, don't merge certs from multiple sources, don't silently ignore errors, and don't log a debug message).
- if the sysadmin puts certs in
/etc/arvados/ca-certificates.crton worker nodes, those certs (and only those certs) will be used by arvados code running both inside & outside containers - on a given worker node, Go and Python programs use the same certificates
Updated by Peter Amstutz over 9 years ago
- Subject changed from [Crunch2] crunch-run option to add binds to all containers. to [Crunch2] crunch-run adding certificates to container
Updated by Lucas Di Pentima over 9 years ago
sdk/go/arvadosclient/arvadosclient.go:
- Line 116: If
tlsClientconfig.InsecureSkipVerifyis true, can the cert file load be skipped? (asking this because of what Tom added on his proposal) - Line 124: Maybe it’s a good idea to check if
AppendCertFromPEM()returns successfully
Also, got the following install errors when running tests locally:
********** Running sdk/go/crunchrunner install **********
# git.curoverse.com/arvados.git/sdk/go/crunchrunner
../../tmp/GOPATH/src/git.curoverse.com/arvados.git/sdk/go/crunchrunner/crunchrunner.go:4: imported and not used: "crypto/x509"
../../tmp/GOPATH/src/git.curoverse.com/arvados.git/sdk/go/crunchrunner/crunchrunner.go:13: imported and not used: "net/http"
********** !!!!!! sdk/go/crunchrunner install FAILED !!!!!! **********
Updated by Peter Amstutz over 9 years ago
Lucas Di Pentima wrote:
On filesdk/go/arvadosclient/arvadosclient.go:
- Line 116: If
tlsClientconfig.InsecureSkipVerifyis true, can the cert file load be skipped? (asking this because of what Tom added on his proposal)
Done. Also refactored a setting up the TLS config a bit.
- Line 124: Maybe it’s a good idea to check if
AppendCertFromPEM()returns successfully
Done. Logs a warning now.
Also, got the following install errors when running tests locally:
Fixed.
Additional changes:
- Add -ca-certs command line option to crunch-run
- crunch-run only bind mounts certificates when
API: truein runtime_constraints.
Updated by Lucas Di Pentima over 9 years ago
Ran sdk/go & services/crunch-run tests locally. LGTM.
Updated by Peter Amstutz over 9 years ago
- Status changed from New to Resolved
Applied in changeset arvados|commit:ffd4738242c61fa5acd423f927339f836dfb0ffb.