简体   繁体   English

在 Mac 和 Windows 虚拟机中的所有浏览器中为本地主机生成安全有效的自签名证书

[英]Generate a secure & valid self signed certificate for localhost in all the browsers in Mac and Windows virtual machine

I wanted to generate a valid certificate for localhost in Mac and 192.168.1.1 in Windows virtual machine.我想为 Mac 中的 localhost 和 Windows 虚拟机中的 192.168.1.1 生成有效证书。 I followed this thread in Mac:我在 Mac 中关注了这个线程

[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = US
ST = VA
L = SomeCity
O = MyCompany
OU = MyDivision
CN = localhost
[v3_req]
keyUsage = critical, digitalSignature, keyAgreement
extendedKeyUsage = serverAuth
subjectAltName = DNS:localhost,IP:192.168.1.1,IP:127.0.0.1

And the command:和命令:

openssl req -newkey rsa:2048 -x509 -nodes -keyout key.pem -new -out cert.pem -config req.cnf -sha256 -days 3650

Then, I exported the certificate from Chrome and trusted it in Keychain Access in Mac and certmgr in Windows. It worked well.然后,我从 Chrome 导出了证书,并在 Mac 的 Keychain Access 和 Windows 的certmgr中信任它。它运行良好。 And I believe that the certificate was also secure without red warning.而且我相信该证书在没有红色警告的情况下也是安全的。

However, today, I realize that, it shows a "Not Secure" red warning in Chrome, then I tried in different browsers, in Mac and Windows virtual machine.然而,今天,我意识到,它在 Chrome 中显示“不安全”红色警告,然后我在不同的浏览器、Mac 和 Windows 虚拟机中尝试。 It returns different results as below.它返回如下不同的结果。

Does anyone know how to generate a secure & valid self signed certificate for localhost in all the browsers in Mac and Windows virtual machine?有谁知道如何在 Mac 和 Windows 虚拟机的所有浏览器中为本地主机生成安全有效的自签名证书?

Not Secure with Chrome Version 109.0.5414.119 (Official Build) (x86_64) in Mac: Mac 中的 Chrome 版本109.0.5414.119 (官方构建)(x86_64) 不安全:

在此处输入图像描述

Not Secure with Firefox Version 109.0.1518.70 (Official build) (64-bit) in Windows virtual machine: Windows虚拟机中的 Firefox 版本 109.0.1518.70(官方构建)(64 位)不安全:

在此处输入图像描述

Not Secure with Firefox 109.0 (64-bit) in Mac在 Mac 中使用Firefox 109.0(64 位)不安全

在此处输入图像描述

Secure with Edge Version 109.0.1518.70 (Official build) (64-bit) in Windows virtual machine:Windows虚拟机中使用 Edge 版本 109.0.1518.70(官方构建)(64 位)进行保护:

在此处输入图像描述

Secure with Chrome Version 109.0.5414.120 (Official Build) (64-bit) in Windows virtual machine:Windows虚拟机中使用 Chrome 版本 109.0.5414.120(官方构建)(64 位)进行保护:

在此处输入图像描述

I realize that it is because my frontend calls a backend https://localhost:3000 whose certificate is not valid.我意识到这是因为我的前端调用后端https://localhost:3000其证书无效。

I then use the same certificate in https://localhost:3000 as in https://localhost:8000 .然后,我在https://localhost:3000中使用与在https://localhost:8000中相同的证书。 There is no Not Secure red flag anymore.不再有Not Secure的危险信号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 创建用于测试本地主机的自签名证书,并使其被浏览器接受 - Create self signed certificate for testing localhost and have it accepted by the browsers 如何生成不会在浏览器中触发警告的自签名证书? - How to generate a self-signed certificate that does not trigger warnings in browsers? Windows服务器中的自签名证书 - self signed certificate in windows server 带有自签名证书的Chrome网站不安全 - website in chrome with self-signed certificate is not secure 使用自签名证书保护 websockets - Secure websockets with self-signed certificate 自签名证书仅适用于本地主机,不适用于 127.0.0.1 - Self signed certificate only works with localhost, not 127.0.0.1 Chrome接受自签名本地主机证书 - Chrome accept self-signed localhost certificate 使用然后删除自签名证书 localhost - Using and then removing self-signed certificate localhost 为 localhost 创建一个自签名证书并将其导入 Glassfish - Create a self signed certificate for localhost and import it in Glassfish 如何为Windows OS中的tomcat中托管的应用程序生成SSL证书-非自签名 - How to generate SSL certificate for application hosted in tomcat in Windows OS-not self-signed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM