From 9370ef358e15fb44a08af11b07970393c084cacb Mon Sep 17 00:00:00 2001 From: Slawomir Brzezinski Date: Mon, 21 Mar 2016 15:08:49 +0000 Subject: [PATCH 1/4] Support x64 installations where Firefox ends up in 'Program Files' without the 'x86' --- add-certs.cmd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/add-certs.cmd b/add-certs.cmd index 24124bf..7597186 100644 --- a/add-certs.cmd +++ b/add-certs.cmd @@ -2,12 +2,12 @@ setlocal REM #### general config -if not defined programfiles(x86) set programfiles(x86)=%programfiles% -set firefoxdefaultprofile=%programfiles(x86)%\Mozilla Firefox\browser\defaults\Profile - +set programFilesWithMozilla=%programfiles% +if not exist "%programFilesWithMozilla%\Mozilla Firefox" set programFilesWithMozilla=%programfiles(x86)% +if not exist "%programFilesWithMozilla%\Mozilla Firefox" exit /B 1 REM #### default firefox profile -if not exist "%programfiles(x86)%\Mozilla Firefox" exit /B 1 +set firefoxdefaultprofile=%programFilesWithMozilla%\Mozilla Firefox\browser\defaults\Profile if not exist "%firefoxdefaultprofile%" mkdir "%firefoxdefaultprofile%" if not exist "%firefoxdefaultprofile%\cert8.db" copy /y "%~dp0db\empty\cert8.db" "%firefoxdefaultprofile%\" >NUL if not exist "%firefoxdefaultprofile%\key3.db" copy /y "%~dp0db\empty\key3.db" "%firefoxdefaultprofile%\" >NUL From 5b3c2e634d538f9652834aca77a6b0d0f045ff89 Mon Sep 17 00:00:00 2001 From: Slawomir Brzezinski Date: Mon, 21 Mar 2016 15:13:13 +0000 Subject: [PATCH 2/4] Added crude -verbose flag for troubleshooting and some whitespace/comments cosmetics --- add-certs.cmd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/add-certs.cmd b/add-certs.cmd index 24124bf..eb3ded2 100644 --- a/add-certs.cmd +++ b/add-certs.cmd @@ -1,4 +1,4 @@ -@echo off +@if /i "%1" NEQ "-verbose" @echo off setlocal REM #### general config @@ -39,10 +39,14 @@ set certfile=!certpath:%replacepath%=! set certfile=!certfile:.pem=! set certfile=!certfile:.cacert=! set certfile=AddedByUser !certfile! -FOR /D %%P IN ("%%U\AppData\Roaming\Mozilla\Firefox\Profiles\*") DO "%~dp0bin\certutil.exe" -A -n "!certfile!" -i "%%C" -t "cTC,cTC,cTC", -d "%%P" +FOR /D %%P IN ("%%U\AppData\Roaming\Mozilla\Firefox\Profiles\*") DO ( + "%~dp0bin\certutil.exe" -A -n "!certfile!" -i "%%C" -t "cTC,cTC,cTC", -d "%%P" +) )) setlocal DISABLEDELAYEDEXPANSION +REM ####Current user + setlocal ENABLEDELAYEDEXPANSION set replacepath=%~dp0cacert\ FOR /R "%~dp0" %%C IN (cacert\*.pem) DO ( From 4e0be271dcd4664692cfc5860146c4ad796a92a3 Mon Sep 17 00:00:00 2001 From: Christian Korneck Date: Wed, 23 Mar 2016 03:14:22 +0100 Subject: [PATCH 3/4] README.md: *.pem file extension info added --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6e8428..0c89567 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The release download includes a build of the NSS `certutil.exe`. Usage ------------- - download and extract the ZIP file from the [release page](https://github.com/christian-korneck/firefox_add-certs/releases) (includes the NSS certutil.exe binaries) -- put all CA certificates that you want to add in the folder: `cacert\` +- put all CA certificates that you want to add in the folder: `cacert\`. File extension needs to be `.pem`. - note: For testing, the CA folder includes the [CACert.org](http://www.cacert.org/) root and intermediate certificates. Remove them if you don't want to add them. - run `add-certs.cmd` with admin privileges From 879070eb16fddb269482c7f3b6c19fac34889ffc Mon Sep 17 00:00:00 2001 From: Christian Korneck Date: Wed, 23 Mar 2016 03:22:32 +0100 Subject: [PATCH 4/4] cosmetic change --- add-certs.cmd | 1 - 1 file changed, 1 deletion(-) diff --git a/add-certs.cmd b/add-certs.cmd index c65954f..7398330 100644 --- a/add-certs.cmd +++ b/add-certs.cmd @@ -46,7 +46,6 @@ FOR /D %%P IN ("%%U\AppData\Roaming\Mozilla\Firefox\Profiles\*") DO ( setlocal DISABLEDELAYEDEXPANSION REM ####Current user - setlocal ENABLEDELAYEDEXPANSION set replacepath=%~dp0cacert\ FOR /R "%~dp0" %%C IN (cacert\*.pem) DO (