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

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Korneck committed Mar 23, 2016
2 parents 7389f0d + 879070e commit 981ea0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 9 additions & 6 deletions add-certs.cmd
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@echo off
@if /i "%1" NEQ "-verbose" @echo off
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
Expand Down Expand Up @@ -39,10 +39,13 @@ 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 (
Expand Down

0 comments on commit 981ea0c

Please sign in to comment.