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

Prefer using system or CVMFS CA certs #4966

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion alien-cas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ package: AliEn-CAs
version: v1
tag: f62625ede780d455b3b7878064bcfee6bd9a4f53
source: https://github.com/alisw/alien-cas.git
prefer_system: .*
prefer_system_check: |
# If we can verify the user's cert, the CERN CA must be installed
# system-wide. In that case, don't install our certs.
openssl verify ~/.globus/usercert.pem > /dev/null 2> /dev/null
build_requires:
- alibuild-recipe-tools
env:
# This is only used for O2/O2Physics unit tests. These are run
# locally (in which case these CAs are fine and assumed to be
# up-to-date) or in CI (ditto).
X509_CERT_DIR: "$ALIEN_CAS_ROOT/globus/share/certificates"
---
#!/bin/bash -e
Expand All @@ -18,5 +26,19 @@ MODULEFILE="$MODULEDIR/$PKGNAME"
mkdir -p "$MODULEDIR"
alibuild-generate-module > "$MODULEFILE"
cat >> "$MODULEFILE" <<EOF
setenv X509_CERT_DIR \$::env(BASEDIR)/AliEn-CAs/\$version/globus/share/certificates
try {
exec openssl verify \$::env(HOME)/.globus/usercert.pem > /dev/null 2> /dev/null
} trap CHILDSTATUS {} {
# If we couldn't validate the user's cert, either it doesn't exist
# or the CERN CA isn't installed as a system cert. In the latter
# case, we should redirect to CVMFS or to our certs.
if [file isdirectory /cvmfs/alice.cern.ch/etc/grid-security/certificates] {
# Prefer current certs from CVMFS, if available. This avoids
# failures due to expired certs.
setenv X509_CERT_DIR /cvmfs/alice.cern.ch/etc/grid-security/certificates
Copy link
Member

Choose a reason for hiding this comment

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

Rather than an hardcoded single place, I would use the latest version of this package, so that we can still update the grid by simply bumping something in alidist and no "out of band" procedures are involved.

Copy link
Member

Choose a reason for hiding this comment

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

I.e. something like ls \$::env(BASEDIR)/AliEn-CAs/ | tail -1...

} else {
# As a fallback, use the certs we installed. Fine for local dev and CI.
setenv X509_CERT_DIR \$::env(BASEDIR)/AliEn-CAs/\$version/globus/share/certificates
}
}
EOF