Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Enable RootCA for Microsoft Edge.
Browse files Browse the repository at this point in the history
  • Loading branch information
aandryashin committed Dec 8, 2020
1 parent 504b83b commit 6709227
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions static/edge/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,6 @@ if [ -n "$VERBOSE" ]; then
DRIVER_ARGS="--verbose"
fi

ROOT_CA_PATH=${ROOT_CA_PATH:-""}
if [ -r "$ROOT_CA_PATH" ]; then
ROOT_CA=$(<"$ROOT_CA_PATH")
ROOT_CA_NAME=$(basename "$ROOT_CA_PATH" | sed -e 's|.crt||g')
fi

ROOT_CA=${ROOT_CA:-""}
if [ -n "$ROOT_CA" ]; then
ROOT_CA_NAME=${ROOT_CA_NAME:-"UserRootCA"}
mkdir -p ~/.pki/nssdb
certutil -d "sql:$HOME/.pki/nssdb" -N --empty-password
echo "$ROOT_CA" | certutil -d "sql:$HOME/.pki/nssdb" -A -t TC -n "$ROOT_CA_NAME"
fi

clean() {
if [ -n "$FILESERVER_PID" ]; then
kill -TERM "$FILESERVER_PID"
Expand All @@ -44,6 +30,17 @@ clean() {

trap clean SIGINT SIGTERM

if env | grep -q ROOT_CA_; then
mkdir -p $HOME/.pki/nssdb
certutil -N --empty-password -d sql:$HOME/.pki/nssdb
for e in $(env | grep ROOT_CA_ | sed -e 's/=.*$//'); do
certname=$(echo -n $e | sed -e 's/ROOT_CA_//')
echo ${!e} | base64 -d >/tmp/cert.pem
certutil -A -n ${certname} -t "TCu,Cu,Tu" -i /tmp/cert.pem -d sql:$HOME/.pki/nssdb
rm /tmp/cert.pem
done
fi

/usr/bin/fileserver &
FILESERVER_PID=$!

Expand Down

0 comments on commit 6709227

Please sign in to comment.