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

Add SSL CA integration support for Firefox Developer Edition #830

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
40 changes: 23 additions & 17 deletions compose/bin/setup-ssl-ca
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,38 @@ echo "System password requested to install certificate authority on host..."

if [ "$(uname)" == "Darwin" ]; then
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain rootCA.pem
echo "{\"policies\": {\"Certificates\": {\"ImportEnterpriseRoots\": true}}}" | sudo tee policies.json

FIREFOX_FOUND=0
### Check if Firefox is installed
FFoxBin="/Applications/Firefox.app/Contents/MacOS/firefox-bin"
if [ -f "$FFoxBin" ]; then
echo "{\"policies\": {\"Certificates\": {\"ImportEnterpriseRoots\": true}}}" | sudo tee policies.json
for FFoxAppDir in \
'/Applications/Firefox.app' \
'/Applications/Firefox Developer Edition.app' \
; do

### Check if distribution directory exists
DistDirectory="/Applications/Firefox.app/Contents/Resources/distribution"
if [ ! -d "$DistDirectory" ]; then
FFoxBin=$FFoxAppDir/Contents/MacOS/firefox-bin
if [[ -f $FFoxBin ]]; then
printf 'Firefox compatible found at: %s\n' "$FFoxAppDir" >&2
FIREFOX_FOUND=1

### Copy the newly created policies.json to the Certificates directory
DistDirectory=$FFoxAppDir/Contents/Resources/distribution
sudo mkdir -p "$DistDirectory"
fi
### Move the newly created policies.json to the Certificates directory
sudo mv policies.json "$DistDirectory"/policies.json
sudo cp policies.json "$DistDirectory"/policies.json

### Check if Certificates directory exists
CertDirectory="/Library/Application Support/Mozilla/Certificates"
if [ ! -d "$CertDirectory" ]; then
sudo mkdir -p "$CertDirectory"
fi
done

### Move the newly created .pem to the Certificates directory
sudo mv rootCA.pem "$CertDirectory"/rootCA.pem
else
sudo rm rootCA.pem
if [[ $FIREFOX_FOUND -ne 0 ]]; then
### Copy the newly created .pem to the Certificates directory
CertDirectory='/Library/Application Support/Mozilla/Certificates'
printf 'Installing CA certificate to: %s\n' "$CertDirectory" >&2
sudo mkdir -p "$CertDirectory"
sudo cp rootCA.pem "$CertDirectory"/rootCA.pem
fi

rm -f policies.json rootCA.pem

else

### Requirement: apt install libnss3-tools
Expand Down