]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/openid_login_fails_wirth_Could_not_determine_ID_provider_from_URL.mdwn
(no commit message)
[ikiwiki.git] / doc / bugs / openid_login_fails_wirth_Could_not_determine_ID_provider_from_URL.mdwn
1 On some ikiwikis that I run, I get the following error on OpenID logins:
2
3     no_identity_server: Could not determine ID provider from URL.
4
5 I seem recall having that error before, and fixing it, but it always seems to come back and I forget how to fix it. So I'll just open this bug and document it if i can figure it out... -- [[users/anarcat]]
6
7 The Perl module manual says:
8
9 >            "no_identity_server"
10 >               (CV) Tried to do discovery on a URL that does not seem to have any providers at all.
11
12 Yet on the server side, I see no request coming in on the OpenID provider... 
13
14 Adding debugging helps in figuring out wtf is going on:
15
16 ~~~~
17 anarcat@marcos:~$ diff -u ~/src/ikiwiki/IkiWiki/Plugin/openid.pm /usr/share/perl5/IkiWiki/Plugin/openid.pm
18 --- /home/anarcat/src/ikiwiki/IkiWiki/Plugin/openid.pm  2014-02-03 20:21:09.502878631 -0500
19 +++ /usr/share/perl5/IkiWiki/Plugin/openid.pm   2014-04-13 11:45:25.413297420 -0400
20 @@ -257,6 +256,7 @@
21         return Net::OpenID::Consumer->new(
22                 ua => $ua,
23                 args => $q,
24 +               debug => 1,
25                 consumer_secret => sub { return shift()+$secret },
26                 required_root => auto_upgrade_https($q, $cgiurl),
27         );
28 ~~~~
29
30 In my case, I see:
31
32
33 ~~~~
34 [Sun Apr 13 11:45:35.796531 2014] [cgi:error] [pid 7299] [client 162.223.3.24:39547] AH01215: [DEBUG Net::OpenID::Consumer] Cache MISS for https://id.koumbit.net/anarcat, referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
35 [Sun Apr 13 11:45:35.842520 2014] [cgi:error] [pid 7299] [client 162.223.3.24:39547] AH01215: [DEBUG Net::OpenID::Consumer] Cache MISS for https://id.koumbit.net/anarcat, referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
36 [Sun Apr 13 11:45:35.845603 2014] [cgi:error] [pid 7299] [client 162.223.3.24:39547] AH01215: [DEBUG Net::OpenID::Consumer] semantic info (https://id.koumbit.net/anarcat) = , referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
37 [Sun Apr 13 11:45:35.845672 2014] [cgi:error] [pid 7299] [client 162.223.3.24:39547] AH01215: [DEBUG Net::OpenID::Consumer] fail(no_identity_server) Could not determine ID provider from URL., referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
38 ~~~~
39
40 There are three places in the code the original error message happens:
41
42 * Net::OpenID::claimed_identity
43 * Net::OpenID::verified_identity
44 * Net::OpenID::_find_openid_server
45
46 We'll look at the last one because it's where the URL data is actually fetched.
47
48 [[!format perl """
49 sub _find_openid_server {
50     my Net::OpenID::Consumer $self = shift;
51     my $url = shift;
52     my $final_url_ref = shift;
53
54     my $sem_info = $self->_find_semantic_info($url, $final_url_ref) or
55         return;
56
57     return $self->_fail("no_identity_server") unless $sem_info->{"openid.server"};
58     $sem_info->{"openid.server"};
59 }
60 """]]
61
62 From there we look at `_find_semantic_info()`, which is supposed to hit the OpenID server, but doesn't somehow.... By cranking up debugging, we can see that the consumer fails to verify the HTTPS signature on the host:
63
64 ~~~~
65 [Sun Apr 13 11:58:30.284511 2014] [cgi:error] [pid 11141] [client 162.223.3.24:39563] AH01215: [DEBUG Net::OpenID::Consumer] url dump (https://id.koumbit.net/anarcat, SCALAR(0x3275ac0)) = 500 Can't verify SSL peers without knowing which Certificate Authorities to trust, referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
66 [Sun Apr 13 11:58:30.284551 2014] [cgi:error] [pid 11141] [client 162.223.3.24:39563] AH01215: , referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
67 [Sun Apr 13 11:58:30.284573 2014] [cgi:error] [pid 11141] [client 162.223.3.24:39563] AH01215: This problem can be fixed by either setting the PERL_LWP_SSL_CA_FILE, referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
68 [Sun Apr 13 11:58:30.284593 2014] [cgi:error] [pid 11141] [client 162.223.3.24:39563] AH01215: envirionment variable or by installing the Mozilla::CA module., referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
69 [Sun Apr 13 11:58:30.284597 2014] [cgi:error] [pid 11141] [client 162.223.3.24:39563] AH01215: , referer: http://cats.orangeseeds.org/ikiwiki.cgi?do=signin&action=verify&openid_identifier=https%3A%2F%2Fid.koumbit.net%2Fanarcat
70 ~~~~
71
72 To get this little wonder, I had to change the `_find_semantic_info()` as followed:
73
74 ~~~~
75 sub _find_semantic_info {
76     my Net::OpenID::Consumer $self = shift;
77     my $url = shift;
78     my $final_url_ref = shift;
79
80     my $doc = $self->_get_url_contents($url, $final_url_ref);
81     $self->_debug("url dump ($url, $final_url_ref) = " . $doc) if $self->{debug};
82     my $info = _document_to_semantic_info($doc);
83     $self->_debug("semantic info ($url) = " . join(", ", map { $_.' => '.$info->{$_} } keys %$info)) if $self->{debug};
84
85     return $info;
86 }
87 ~~~~
88
89 A minimal test case would be:
90
91 ~~~~
92 perl -e 'use LWPx::ParanoidAgent;
93   print $LWPx::ParanoidAgent::VERSION, " $]: ";
94   print length(LWPx::ParanoidAgent->new->get
95       ("https://id.koumbit.net/anarcat")
96       ->decoded_content), "\n";'
97 ~~~~
98
99 And the results vary according to the version of perl:
100
101 * wheezy: 1.07 5.014002: 5720
102 * jessie: 1.10 5.018002: 398
103
104 Thanks [jwz](http://www.jwz.org/blog/2014/03/apple-broke-lwp-in-a-new-and-exciting-way-on-10-9-2/) for that.. Mozilla::CA *could* have been packaged in Debian, except it overlaps with the `ca-certificates` package, so it was [basically barred entry](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702124).
105
106 I tried the workaround of hardcoding the path to the CA root, using `PERL_LWP_SSL_CA_PATH=/etc/ssl/certs`, but then I hit *another* bug in LWP: [#738493](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=738493).
107
108 Note that this bug is similar to [[bugs/ssl_certificates_not_checked_with_openid/]], but backwards: it checks the SSL certs but then fails to verify.
109
110 I filed this bug in the Debian BTS as [#702124](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702124). Downgrading to wheezy's version of LWPx::ParanoidAgent doesn't fix the problem, instead i get this error:
111
112     500 Can't read entity body: Resource temporarily unavailable
113
114 ... yet the commandline client works fine... I'm out of ideas for this sucker.