-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update: set custom CA Certificate installation docs (#2136)
- Loading branch information
Showing
7 changed files
with
109 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG NAMESPACE=selenium | ||
ARG BASE=node-chrome | ||
ARG VERSION=latest | ||
FROM ${NAMESPACE}/${BASE}:${VERSION} | ||
|
||
USER root | ||
|
||
ARG CERT_FILE | ||
ARG PERM=577 | ||
RUN mkdir -p /usr/share/ca-certificates/extra/ | ||
COPY ${CERT_FILE} /usr/share/ca-certificates/extra/ | ||
RUN chmod -R ${PERM} /usr/share/ca-certificates/extra/ | ||
RUN update-ca-certificates | ||
|
||
ARG CERT_SCRIPT | ||
COPY --chown="${SEL_UID}:${SEL_GID}" ${CERT_SCRIPT} /usr/share/ca-certificates/cert-script.sh | ||
RUN chmod +x /usr/share/ca-certificates/cert-script.sh | ||
|
||
USER ${SEL_UID} | ||
ARG TRUST_ATTR=TCu,Cu,Tu | ||
RUN bash /usr/share/ca-certificates/cert-script.sh /usr/share/ca-certificates/extra/ ${TRUST_ATTR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
# Function to be executed on command failure | ||
on_failure() { | ||
local exit_status=$? | ||
echo "There is step failed with exit status $exit_status" | ||
exit $exit_status | ||
} | ||
|
||
# Trap ERR signal and call on_failure function | ||
trap 'on_failure' ERR | ||
|
||
NAMESPACE=${NAME:-"selenium"} | ||
VERSION=${VERSION:-$TAG_VERSION} | ||
CERT_FILE=${CERT_FILE:-"./charts/selenium-grid/certs/*.pem"} | ||
CERT_SCRIPT=${CERT_SCRIPT:-"./tests/customCACert/cert-script.sh"} | ||
|
||
COMMON_BUILD_ARGS="--build-arg NAMESPACE=${NAMESPACE} --build-arg VERSION=${VERSION} --build-arg CERT_FILE=${CERT_FILE} --build-arg CERT_SCRIPT=${CERT_SCRIPT}" | ||
|
||
docker build ${COMMON_BUILD_ARGS} --build-arg BASE=node-chrome -t ${NAMESPACE}/node-chrome:${VERSION} -f ./tests/customCACert/Dockerfile . | ||
docker build ${COMMON_BUILD_ARGS} --build-arg BASE=node-firefox -t ${NAMESPACE}/node-firefox:${VERSION} -f ./tests/customCACert/Dockerfile . | ||
docker build ${COMMON_BUILD_ARGS} --build-arg BASE=node-edge -t ${NAMESPACE}/node-edge:${VERSION} -f ./tests/customCACert/Dockerfile . | ||
|
||
list_cert_files=($(find ./charts/selenium-grid/certs/ -name "*.pem")) | ||
for cert_file_path in "${list_cert_files[@]}"; do | ||
cert_file_name="$(basename ${cert_file_path})" | ||
cert_name="${cert_file_name%.*}" | ||
docker run --entrypoint="" --rm ${NAMESPACE}/node-chrome:${VERSION} bash -c "certutil -L -d sql:/home/seluser/.pki/nssdb -n ${cert_name}" | grep -q "SeleniumHQ" | ||
docker run --entrypoint="" --rm ${NAMESPACE}/node-firefox:${VERSION} bash -c "certutil -L -d sql:/home/seluser/.pki/nssdb -n ${cert_name}" | grep -q "SeleniumHQ" | ||
docker run --entrypoint="" --rm ${NAMESPACE}/node-edge:${VERSION} bash -c "certutil -L -d sql:/home/seluser/.pki/nssdb -n ${cert_name}" | grep -q "SeleniumHQ" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -x | ||
|
||
echo "$(whoami) is running cert script!" | ||
|
||
CERT_DIR=${1:-"/usr/share/ca-certificates/extra/"} | ||
TRUST_ATTR=${2:-"TCu,Cu,Tu"} | ||
|
||
# Get the list of certs copied | ||
cert_files=($(ls $CERT_DIR)) | ||
|
||
# Find all "cert9.db" files | ||
cert_db_files=($(find ${HOME}/ -name "cert9.db")) | ||
|
||
for cert_file in "${cert_files[@]}"; do | ||
cert_file="${CERT_DIR}/${cert_file}" | ||
file_name=$(basename $cert_file) | ||
cert_name="${file_name%.*}" | ||
for cert_db_file in "${cert_db_files[@]}"; do | ||
cert_db_path=$(dirname $cert_db_file) | ||
certutil -d "sql:${cert_db_path}" -A -t "${TRUST_ATTR}" -n "${cert_name}" -i "${cert_file}" | ||
certutil -L -d "sql:${cert_db_path}" -n "${cert_name}" | ||
done | ||
done |