[GH-ISSUE #461] SSL certificates not accepted in browser - Safari, chrome, firefox #295

Open
opened 2026-02-25 22:33:03 +03:00 by kerem · 12 comments
Owner

Originally created by @lakshmajee on GitHub (Jul 10, 2022).
Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/461

Environment

  • Operating system (including version): macOS Big Sur 11.6.7 (20G630)
  • mkcert version (from mkcert -version): v1.4.4
  • Server (where the certificate is loaded): Angular cli has in build serving mechanism to load SSL certs, https://angular.io/cli/serve
  • Client (e.g. browser, CLI tool, or script): browser (Chrome, Safari, Firefox)

What you did

brew install mkcert
brew install nss
mkcert --install
mkcert localhost 127.0.0.1

After generating certificates, I attached them to angular cli. (It is able to detect the certificates at a given path)

ng serve --ssl \                   
  --ssl-cert "/Users/gru/development/angular/ssl/localhost+1.pem” \
  --ssl-key "/Users/gru/development/angular/ssl/localhost+1-key.pem”

I have gone through some closed issues and tried to restart the browser and the entire machine.

But none of them helped.

What went wrong

chrome
safari

Originally created by @lakshmajee on GitHub (Jul 10, 2022). Original GitHub issue: https://github.com/FiloSottile/mkcert/issues/461 ## Environment * Operating system (including version): macOS Big Sur 11.6.7 (20G630) * mkcert version (from `mkcert -version`): v1.4.4 * Server (where the certificate is loaded): Angular cli has in build serving mechanism to load SSL certs, https://angular.io/cli/serve * Client (e.g. browser, CLI tool, or script): browser (Chrome, Safari, Firefox) ## What you did <!-- Including the `mkcert -install` step and how the certificate was generated and installed. --> ```bash brew install mkcert brew install nss mkcert --install mkcert localhost 127.0.0.1 ``` After generating certificates, I attached them to angular cli. (It is able to detect the certificates at a given path) ```bash ng serve --ssl \ --ssl-cert "/Users/gru/development/angular/ssl/localhost+1.pem” \ --ssl-key "/Users/gru/development/angular/ssl/localhost+1-key.pem” ``` ### I have gone through some closed issues and tried to restart the browser and the entire machine. But none of them helped. ## What went wrong <!-- Please include the precise error, like a terminal transcript or a browser screenshot. --> ![chrome](https://user-images.githubusercontent.com/15211916/178149010-c25fc98a-a43b-48ea-b97c-2abb47a79de4.png) ![safari](https://user-images.githubusercontent.com/15211916/178149021-8473e01a-ee4f-4a70-acd3-de2e1d9f53f2.png)
Author
Owner

@ahmadSaeedGoda commented on GitHub (Aug 13, 2022):

Same here with ReactJS. Any Updates please?

<!-- gh-comment-id:1214155849 --> @ahmadSaeedGoda commented on GitHub (Aug 13, 2022): Same here with ReactJS. Any Updates please?
Author
Owner

@hakimio commented on GitHub (Aug 13, 2022):

Might be a change in Chrome causing this.
Anyway, for anyone on Windows try this guide from StackOverflow ("Windows: Generate and self sign certificate"). Worked well for me.

<!-- gh-comment-id:1214174285 --> @hakimio commented on GitHub (Aug 13, 2022): Might be a change in Chrome causing this. Anyway, for anyone on Windows try [this guide from StackOverflow ("Windows: Generate and self sign certificate")](https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate/72477963#72477963). Worked well for me.
Author
Owner

@N6REJ commented on GitHub (Aug 21, 2022):

I'm hoping this can be fixed.
I get the following error when I try to install

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install
Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied)

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> 
<!-- gh-comment-id:1221436873 --> @N6REJ commented on GitHub (Aug 21, 2022): I'm hoping this can be fixed. I get the following error when I try to install ``` PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install Created a new local CA 💥 The local CA is now installed in the system trust store! ⚡️ ERROR: failed to execute "keytool -importcert": exit status 1 Warning: use -cacerts option to access cacerts keystore Certificate was added to keystore keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied) PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ```
Author
Owner

@brezanac commented on GitHub (Aug 28, 2022):

I'm hoping this can be fixed. I get the following error when I try to install

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install
Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied)

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> 

Try running mkcert inside Powershell with elevated (Administrator) privileges or simply install gsudo.

<!-- gh-comment-id:1229554894 --> @brezanac commented on GitHub (Aug 28, 2022): > I'm hoping this can be fixed. I get the following error when I try to install > > ``` > PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install > Created a new local CA 💥 > The local CA is now installed in the system trust store! ⚡️ > ERROR: failed to execute "keytool -importcert": exit status 1 > > Warning: use -cacerts option to access cacerts keystore > Certificate was added to keystore > keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied) > > PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> > ``` Try running `mkcert` inside Powershell with elevated (Administrator) privileges or simply install [gsudo](https://github.com/gerardog/gsudo).
Author
Owner

@N6REJ commented on GitHub (Aug 29, 2022):

I'm hoping this can be fixed. I get the following error when I try to install

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install
Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied)

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> 

Try running mkcert inside Powershell with elevated (Administrator) privileges or simply install gsudo.

that was inside an elevated powershell. as shown here
image

<!-- gh-comment-id:1229976394 --> @N6REJ commented on GitHub (Aug 29, 2022): > > I'm hoping this can be fixed. I get the following error when I try to install > > ``` > > PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install > > Created a new local CA 💥 > > The local CA is now installed in the system trust store! ⚡️ > > ERROR: failed to execute "keytool -importcert": exit status 1 > > > > Warning: use -cacerts option to access cacerts keystore > > Certificate was added to keystore > > keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied) > > > > PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> > > ``` > > Try running `mkcert` inside Powershell with elevated (Administrator) privileges or simply install [gsudo](https://github.com/gerardog/gsudo). that was inside an elevated powershell. as shown here ![image](https://user-images.githubusercontent.com/1850089/187163871-c7404857-14ab-4945-99f9-68316d90a93e.png)
Author
Owner

@brezanac commented on GitHub (Aug 29, 2022):

I'm hoping this can be fixed. I get the following error when I try to install

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install
Created a new local CA 💥
The local CA is now installed in the system trust store! ⚡️
ERROR: failed to execute "keytool -importcert": exit status 1

Warning: use -cacerts option to access cacerts keystore
Certificate was added to keystore
keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied)

PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> 

Try running mkcert inside Powershell with elevated (Administrator) privileges or simply install gsudo.

that was inside an elevated powershell. as shown here image

The only indication that Powershell is running with elevated privileges is that it will use C:\Windows\system32> as the startup directory and the window title will display Administrator: Windows PowerShell. Your images does not contain any of those so I assumed unprivilleged Powershell, which will break mkcert since it needs acceess to sensitive areas of the operating system.

A nice and easy way to test for elevated privileges is to run the following line of code inside Powershell.

([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

<!-- gh-comment-id:1230009576 --> @brezanac commented on GitHub (Aug 29, 2022): > > > I'm hoping this can be fixed. I get the following error when I try to install > > > ``` > > > PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> ./mkcert.exe --install > > > Created a new local CA 💥 > > > The local CA is now installed in the system trust store! ⚡️ > > > ERROR: failed to execute "keytool -importcert": exit status 1 > > > > > > Warning: use -cacerts option to access cacerts keystore > > > Certificate was added to keystore > > > keytool error: java.io.FileNotFoundException: C:\Program Files\Microsoft\jdk-17.0.1.12-hotspot\lib\security\cacerts (Access is denied) > > > > > > PS E:\Development\MY_PROJECTS\bearsampp-development\Bearsampp\core\libs\mkcert> > > > ``` > > > > > > Try running `mkcert` inside Powershell with elevated (Administrator) privileges or simply install [gsudo](https://github.com/gerardog/gsudo). > > that was inside an elevated powershell. as shown here ![image](https://user-images.githubusercontent.com/1850089/187163871-c7404857-14ab-4945-99f9-68316d90a93e.png) The only indication that Powershell is running with elevated privileges is that it will use `C:\Windows\system32>` as the startup directory and the window title will display `Administrator: Windows PowerShell`. Your images does not contain any of those so I assumed unprivilleged Powershell, which will break mkcert since it needs acceess to sensitive areas of the operating system. A nice and easy way to test for elevated privileges is to run the following line of code inside Powershell. `([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)`
Author
Owner

@N6REJ commented on GitHub (Aug 29, 2022):

I apologize your completely correct. I'm trying to figure out how to tell phpstorm to run it as admin as we speak.
image

<!-- gh-comment-id:1230036519 --> @N6REJ commented on GitHub (Aug 29, 2022): I apologize your completely correct. I'm trying to figure out how to tell phpstorm to run it as admin as we speak. ![image](https://user-images.githubusercontent.com/1850089/187174082-0687cd92-5456-4280-9894-473022b5b128.png)
Author
Owner

@N6REJ commented on GitHub (Aug 29, 2022):

gsudo worked perfectly! TY!

<!-- gh-comment-id:1230070112 --> @N6REJ commented on GitHub (Aug 29, 2022): gsudo worked perfectly! TY!
Author
Owner

@N6REJ commented on GitHub (Aug 29, 2022):

Now that that is fixed... we store all ssl certs in the /ssl folder of our app. But we want to change from openssl to mkcert. How can we tell mkcert to use the ssl folder?

<!-- gh-comment-id:1230071564 --> @N6REJ commented on GitHub (Aug 29, 2022): Now that that is fixed... we store all ssl certs in the /ssl folder of our app. But we want to change from openssl to mkcert. How can we tell mkcert to use the ssl folder?
Author
Owner

@lakshmajee commented on GitHub (Sep 8, 2022):

Might be a change in Chrome causing this. Anyway, for anyone on Windows try this guide from StackOverflow ("Windows: Generate and self sign certificate"). Worked well for me.

Actually mkcerts selling point is you don't need to do or use multiple commands, right? Why do we need some workaround to get started with it? If mkcerts is all around workarounds, I need to switch to another library.

<!-- gh-comment-id:1240192929 --> @lakshmajee commented on GitHub (Sep 8, 2022): > Might be a change in Chrome causing this. Anyway, for anyone on Windows try [this guide from StackOverflow ("Windows: Generate and self sign certificate")](https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate/72477963#72477963). Worked well for me. Actually `mkcerts` selling point is you don't need to do or use multiple commands, right? Why do we need some workaround to get started with it? If `mkcerts` is all around workarounds, I need to switch to another library.
Author
Owner

@blueblakk commented on GitHub (Sep 4, 2023):

Facing the exact same issue.

<!-- gh-comment-id:1705115252 --> @blueblakk commented on GitHub (Sep 4, 2023): Facing the exact same issue.
Author
Owner

@SiegeSailor commented on GitHub (Sep 10, 2024):

Any update?

<!-- gh-comment-id:2340455509 --> @SiegeSailor commented on GitHub (Sep 10, 2024): Any update?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mkcert#295
No description provided.