自簽名證書——幫助用戶知道他們需要將根 CA 添加到受信任的證書存儲中 (Self-signed certs -- helping users know they need to add root CA to trusted cert store)


問題描述

自簽名證書——幫助用戶知道他們需要將根 CA 添加到受信任的證書存儲中 (Self-signed certs -- helping users know they need to add root CA to trusted cert store)

I have a desktop product which uses an embedded webserver which will use self-signed certs.

Is there something that I can put in a web page that would detect that they haven't added the root CA to their trusted list, and display a link or DIV or something directing them how to do it?  

I'm thinking maybe a DIV that has instructions on install the CA, and a Javascript that runs some test (tries to access something without internal warnings??), and hides the DIV if the test succeeds.  Or something like that...

Any ideas from the brilliant SO community ?  :)


參考解法

方法 1:

Why do you want to do this? It is a bad idea to train users to indiscriminately install root CA certificates just because a web site tells them to. You are undermining the entire chain of trust. A security conscious user would ignore your advice to install the certificate, and might conclude that you are not taking security seriously since you did not bother to acquire a certificate from an existing CA.

Do you really need HTTPS? If so, you should probably bite the bullet and make a deal with a CA to facilitate providing your customers with proper CA signed server certificates. If the web server is only used for local connections from the desktop app, you should either add the self-signed certificate to the trusted list as part of the installation process, or switch to HTTP instead.

方法 2:

Assuming you know C# and you want to install a pfx file.Create a exe that will be run from a url.Follow this URL

  •  and this

方法 3:

The only idea I have is to use frames and some javascript.

The first element of the frame will act as a watchdog waiting x amount of time (javascript setTimeout) before showing your custom ssl failure message to the user with hyperlinks or instructions to download the self-signed cert.

The second frame element attempts the https connection and if successful resets the watchdog frame so that it never fires.  If it fails (assume https cert validation failed) the watchdog message would then fire and be presented to the user.

Depending on your browser you will most likely still see some security warning with the approach but you would at least be able to push your own content without requiring users to run untrusted code with no proper trust chain (This would be much much worse from a security POV than accepting the cert validation errors and establishing an untrusted ssl session)

Improvements to the concept may be possible using other testing methods such as XMLHttpRequest et al.

方法 4:

You should not do this. Root certificates are not something you just install, since adding one could compromise any security given to you by https.

However if you are making a desktop app then just only listen to 127.0.0.1. That way the traffic never leaves the users computer and no attacker can listen in.

方法 5:

You might try to add some (hidden) Flex element or Java Applet once per user session. It will just download any https page of your server and will get all information about connection:

com.sun.deploy.security.CertificateHostnameVerifier.verify()
or
javax.security.cert.X509Certificate.checkValidity()

I suppose Flex (which is more common to users) shoul have similar ways of validating https certificate from user's point of view. It should also share OS' trusted cert. store while Java might have its own.

(by DougNmarkuskabmvEinsteintomjenAlexander Kosenkov)

參考文件

  1. Self-signed certs -- helping users know they need to add root CA to trusted cert store (CC BY-SA 3.0/4.0)

#Browser #javascript #ssl-certificate #self-signed #certificate






相關問題

讓 jQuery 與 Netscape 7 和 8 一起工作 (Getting jQuery to work with Netscape 7 and 8)

功能性 javascript 和網絡瀏覽器 javascript 版本 (Functional javascript and web browser javascript versions)

VB.NET - WebBrowser 附加標題 - 用戶代理覆蓋/取消其他標題? (VB.NET - WebBrowser Additional Headers - User Agent Overrides / Cancels Other Headers?)

無法在所有移動瀏覽器上居中 - 普通瀏覽器效果極佳 (Centering Not Possible On All Mobile Browsers - Normal Browser Works Superb)

在 SWT 瀏覽器小部件中獲取選定文本 (Getting a Selected Text In SWT Browser Widgets)

瀏覽器如何知道網頁發生了變化? (How does the browser know a web page has changed?)

iPhone/Android/BlackBerry 上的 jQuery (jQuery on iPhone/Android/BlackBerry)

對 DOM 和 HTML (API) 之間的關係感到困惑 (Confused by relation between DOM and HTML (APIs))

Firefox 5 - 無限循環處理 (Firefox 5 - infinite loop handling)

字符串或二進制數據將被截斷 (string or binary data would be truncated)

拖放圖片轉Base64 (Drag and drop image convert to Base64)

使用在瀏覽器中運行的 webgl 創建 GPU 密集型 Web 應用程序是否現實? (Is it realistic to create gpu-intensive web apps using webgl running in the browser?)







留言討論