Skip to content

Add support for custom certificate #1956

Closed as not planned
Closed as not planned

Description

@kjlaw89

This is related to the pull request #1859, which introduced the --client-certificate flag. When trying to use a PEM file in this manner it does not allow access to a site requesting the client certificate.

Activity

  1. kjlaw89 commented on Jun 12, 2015

    @kjlaw89
    Author

    Just incase it has any use, here's the SSL error that Electron throws:

    [6380:0612/085913:ERROR:ssl_client_socket_openssl.cc(1014)] handshake failed; returned 0, SSL error code 1, net_error -107
    [6380:0612/085913:ERROR:ssl_client_socket_openssl.cc(1014)] handshake failed; returned 0, SSL error code 1, net_error -157
    
  2. deepak1556 commented on Jun 22, 2015

    @deepak1556
    Member

    Got around to finding the real issue with the certificate and test server sample provided by @kjlaw89 . Did a log-net-log trace on both chrome and Electron , found the following in socket connection stage after the server certificates were received.

    t=1788 [st=1642]        SSL_CLIENT_CERT_REQUESTED
    t=1788 [st=1642]        SSL_READ_ERROR
                            --> net_error = -110 (ERR_SSL_CLIENT_AUTH_CERT_NEEDED)
                            --> ssl_error = 2
    

    there was no client certificate read, and AtomBrowserClient::SelectClientCertificate was never hit, turned out chromium does a initial search on the platfrom store for non-emptyness before requesting the delegate on the UI thread to let user select certificate. I patched this initial check and SelectClientCertificate got triggered with data from PEM file passed back. Now there is a second stage lookup on the platform store for private key in openssl_platfrom_key_*.cc , so the purpose of command line option is now obsolete as there is always a lookup on the platform store unless we patch it on chromium, which i dont suggest. Any suggestions to solve this problem @zcbenz

  3. zcbenz commented on Jun 23, 2015

    @zcbenz
    Contributor

    It seems that if we don't provide a cert store SelectClientCertificate will still be called?

  4. deepak1556 commented on Jun 23, 2015

    @deepak1556
    Member

    Yup but then we cant do the fallback. Also if SelectClientCertificate is called there will still be a search on the key store for private key but that is being resolved in this CL https://code.google.com/p/chromium/issues/detail?id=394131 . So i guess command line option would be no go until then ?

  5. zcbenz commented on Jun 23, 2015

    @zcbenz
    Contributor

    Also if SelectClientCertificate is called there will still be a search on the key store for private key but that is being resolved in this CL https://code.google.com/p/chromium/issues/detail?id=394131 . So i guess command line option would be no go until then ?

    I think we can just wait for Chromium to support it then, we don't need to do better than Chromium.

  6. changed the title [-]Windows: --client-certificate flag does not work[/-] [+]--client-certificate flag does not work[/+] on Jul 13, 2015
  7. hokein commented on Jul 13, 2015

    @hokein
    Contributor

    I can verify it on other platforms.

  8. kjlaw89 commented on Dec 17, 2015

    @kjlaw89
    Author

    @deepak1556 Did Chrome 47 include the code necessary to get this flag to work? It'd be great if it was possible to use this now!

  9. kjlaw89 commented on Mar 29, 2016

    @kjlaw89
    Author

    @deepak1556 @zcbenz Okay, now that we're on Chrome 49, any hope yet? :)

  10. deepak1556 commented on Apr 2, 2016

    @deepak1556
    Member

    looked into this further, currently there is no way to hook into a resource lifecycle where we can provide both certificate and private key. The only hook is when chromiums' resource loader asks for a certificate and it will look into the platform certificate database for the key. As far as i can see the current implementation of client-certificate flag doesnt serve its purpose and can be removed. Instead we can provide api to import certificate and ca authorities. Users can listen to select-client-certificate and proceed. @zcbenz thoughts ?

  11. zcbenz commented on Apr 7, 2016

    @zcbenz
    Contributor

    @deepak1556 Sounds good to me.

  12. reopened this on Apr 7, 2016
  13. kjlaw89 commented on Apr 8, 2016

    @kjlaw89
    Author

    @deepak1556 Thanks for looking into this again! What exactly are you proposing doing? I'd be okay with removing the client certificate flag if I had a way to dynamically load a client certificate. It was almost possible to do it with the select-client-certificate event, but it required that a client certificate be installed on the computer first before you could pass in a custom client certificate. If it was possible to get around that (no client certificate installed on the computer) and use my custom client certificate that'd be perfect.

  14. 36 remaining items

  15. github-actions commented on Nov 4, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  16. Bluscream commented on Nov 4, 2022

    @Bluscream

    Stop staling this, just fix it

  17. rahul-dutt-sharma commented on Nov 17, 2022

    @rahul-dutt-sharma

    This is a very valid use case for apps behind corporate networks. They use cloud proxies like zscaler, netlog to ssl inspect the traffic. It's becoming untenable to request them to exclude urls needed by our app from ssl inspection

  18. oleg-milantiev commented on Dec 3, 2022

    @oleg-milantiev

    Have the same problem. Please help :)

    We plan to using squid proxy with ssl-bump. Need to import root certificate into Electron App (Windows) for using this application in closed corporate network.

  19. github-actions commented on Mar 4, 2023

    @github-actions
    Contributor

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  20. James-Livesey commented on Apr 2, 2023

    @James-Livesey

    Would like to see this implemented as I'm currently working on an application that will need a way for users to configure their certificates on Linux. Would be great to be able to manage certificates through CRUD methods to fully resemble Chrome's certificate store interface (in Settings > Privacy and security > Manage certificates). app.importCertificate is a start, but not being able to list certificates and remove them is rather limiting.

    That being said, I've just had a brief look at ses.setCertificateVerifyProc, which looks promising.

  21. Tarrowren commented on Jun 12, 2023

    @Tarrowren

    I have refactored the code and it now looks simpler.
    https://github.com/Tarrowren/electron-self-signed-certificate-example
    Problem: I used 'undici' instead of 'net.fetch' because it doesn't support 'agent', which would cause a typescript type error, but I ignored it and now it works fine, but may also raise unexpected errors...

  22. electron-issue-triage commented on Sep 11, 2023

    @electron-issue-triage

    This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!

  23. electron-issue-triage commented on Oct 11, 2023

    @electron-issue-triage

    This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions