After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 791534 - Unable to use saved certificate with wrong host name
Unable to use saved certificate with wrong host name
Status: RESOLVED DUPLICATE of bug 745351
Product: epiphany
Classification: Core
Component: Passwords, Cookies, & Certificates
3.26.x
Other Linux
: Normal enhancement
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-12-12 18:45 UTC by Technical Support
Modified: 2018-01-09 00:53 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Technical Support 2017-12-12 18:45:49 UTC
Saved and installed certificate from https://cp.us2.net but unable to use it. Certificate "Common Name" is "www.foundationapi.com" so, though it works for cp.us2.net, it is never used. Firefox is able to use the certificate by assigning it to cp.us2.net. What is the workaround for Epiphany?
Comment 1 Michael Catanzaro 2017-12-12 18:55:20 UTC
I think there's currently no way to permanently ignore the certificate error. You can temporarily ignore it for a single session by clicking Technical Information -> Accept Risk and Proceed.
Comment 2 Michael Catanzaro 2017-12-12 18:59:17 UTC
I think you're probably requesting the feature described in bug #765364, right? I'll mark this as a duplicate... let me know if that's wrong.

*** This bug has been marked as a duplicate of bug 765364 ***
Comment 3 Technical Support 2017-12-12 19:48:06 UTC
Not exactly a duplicate, though certainly related.

The workaround for bug 765364 is to save certificates manually and install them using ca-certificates.

This works for sites that have defined their certificates correctly. This isn't the case with https://cp.us2.net. The certificate works, but contains the CN (Common Name) "www.foundationapi.com" and no alternates. Though the certificate has been saved and installed, it isn't referenced for cp.us2.net because the name doesn't match.

Firefox also fails to use the certificate when it relies on certificates installed with ca-certificates. However, when it saves the certificate internally, it matches it to the host it downloaded it from. The certificate downloaded from cp.us2.net is used when going there.

Maybe there's an easy way to devise a workaround for the workaround so the faulty cp.us2.net certificate works correctly?

If not, then yes, it belongs with bug 765364 :-)
Comment 4 Michael Catanzaro 2017-12-12 23:37:01 UTC
I think what both bug #765364 and this bug are requesting is a way to pin certificates to particular sites, right? Then the connection would succeed if the certificate is unchanged, and not otherwise, and no certificate validity checks will not be performed at all. So the solution is really the same, right? It doesn't make any difference whether verification fails because some intermediate certificate is missing or because the common name is wrong.
Comment 5 Technical Support 2017-12-13 06:38:10 UTC
Agreed. The only reason to take this first is that it's already possible to save certificates for Epiphany. Bug 765364 is more difficult because it asks for the process to be made easy.

The problem with cp.us2.net shouldn't be hard to replicate. Maybe there's a simple solution? (If not, then as you say, it gets fixed along with the solution for Bug 765364.)
Comment 6 Michael Catanzaro 2017-12-13 16:41:01 UTC
(In reply to Technical Support from comment #5)
> Agreed. The only reason to take this first is that it's already possible to
> save certificates for Epiphany. Bug 765364 is more difficult because it asks
> for the process to be made easy.
> 
> The problem with cp.us2.net shouldn't be hard to replicate. Maybe there's a
> simple solution? (If not, then as you say, it gets fixed along with the
> solution for Bug 765364.)

It won't be simple. Epiphany will need to save a copy of the certificate into a new local database. The database would be a map of hostname -> certificate. Then Epiphany needs to check if a hostname is present in that database before each page load. That's the easy part. The hard part would be to hook into the TLS connection establishment, because Epiphany needs to verify that the certificate presented in the TLS connection matches the certificate stored in its local database. The right APIs for this all exist in GLib, but not in WebKit. In fact, it's hard to think of how that might ever be possible: there's a process boundary involved here, so it's not possible to expose the actual GSocket and GTlsConnection involved in the WebKit API. So designing any API that would allow Epiphany to implement its own pinning would be quite difficult.

It's possible to get the TLS certificate after the connection has been established, and check if it's right then. Some GNOME applications (like Banshee) are known to do just that. But that's wrong: if the verification fails, sensitive state (like secure cookies, or local databases) has already been leaked.

I think it would be much easier to add this functionality at the WebKit level rather than Epiphany level, since then the new WebKit API would be comparatively straightforward: there would just need to be a function, say webkit_web_context_set_tls_certificate_pins, that would allow passing a GHashTable of hostnames to certificate PEMs to indicate which certificates are pinned. Then that's just a bunch of strings, which will be easy to ferry across to the network process, and the network process can implement the check there. That's probably the best path forward here.

Either way, it's going to be several days of implementation work, and not a priority for me, unfortunately. Workarounds like this were more important 10 years ago when certificate verification errors were common on the web; nowadays it's quite rare to see a completely broken server like this one. Especially sad that it's a government website which nobody can access without clicking through a big scary and important browser security warning....

Now, there is an alternative. Epiphany could easily just turn off certificate verification altogether for a given hostname, by storing a database of websites for which no verification should be performed. The downside is that Epiphany won't be able to block the connection if the certificate changes unexpectedly, so unlike the Firefox approach, this would be completely turning off all security checks permanently (which is reasonable; that's currently what Epiphany does now, just for the current session instead of permanently). I don't plan to work on this either, but this should be straightforward for a new contributor to implement.
Comment 7 Technical Support 2017-12-13 20:38:32 UTC
Thanks for the information and I *definitely* see your difficulty.

The idea of saving a list of websites that automatically turn off certificate verification is actually a good one. Right now, I install certificates for people who don't know how and only run into trouble when someone has to hit the ignore button themselves. As you say, the warning is scary :-)

Having a friendlier warning would be nice but if I could make the warning go away altogether, that would be best. With a saved certificate, if possible, but a simple list of excluded websites would be almost as good.

Or maybe a command line option to skip certificate verification? I don't mind a little effort if it's easy for the end user.
Comment 8 Michael Catanzaro 2017-12-13 22:55:29 UTC
(In reply to Technical Support from comment #7)
> Or maybe a command line option to skip certificate verification?

I don't think so. ;)
Comment 9 Michael Catanzaro 2018-01-09 00:53:13 UTC

*** This bug has been marked as a duplicate of bug 745351 ***