]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/openid_login_fails_wirth_Could_not_determine_ID_provider_from_URL.mdwn
another possibility
[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 > Is this fixed now that [[!debbug 738493]] has been fixed? --[[smcv]]
6
7 > > No, it isn't. I still get: `no_identity_server: Could not determine ID provider from URL.` from the latest ikiwiki in jessie (3.20140831), with liblwpx-paranoidagent-perl 1.10-3. Debugging tells me it's still related to the `500 Can't verify SSL peers without knowing which Certificate Authorities to trust` error, so probably because `Mozilla::CA` is not packaged ([[!debbug 702124]]). I still had to apply the patch to disable SSL verification at the end of this file. However, setting `$ENV{PERL_LWP_SSL_CA_PATH} = '/etc/ssl/certs';` seems to work now, so the following dumb patch works:
8 > > 
9 > > ~~~~
10 > > --- /usr/bin/ikiwiki.orig       2014-09-08 15:48:35.715868902 -0400
11 > > +++ /usr/bin/ikiwiki    2014-09-08 15:50:29.666779878 -0400
12 > > @@ -225,4 +225,5 @@
13 > >         }
14 > >  }
15 > > 
16 > > +$ENV{PERL_LWP_SSL_CA_PATH} = '/etc/ssl/certs';
17 > >  main;
18 > > ~~~~
19 > > 
20 > > may not be the best place to fiddle around with this, but then again it makes sense that it applies to the whole program. it should probably be reported upstream as well. also in my git repo. -- [[anarcat]]
21 > >
22 > > > This seems Debian-specific. I would be inclined to consider this to be
23 > > > a packaging/system-integration (i.e. non-upstream) bug in
24 > > > `liblwpx-paranoidagent-perl` rather than an upstream bug in IkiWiki;
25 > > > it certainly seems inappropriate to put this Debian-specific path
26 > > > in upstream IkiWiki. If it can't be fixed in LWPX::ParanoidAgent for
27 > > > whatever reason, applying it via some sort of sed in ikiwiki's
28 > > > `debian/rules` might be more reasonable? --[[smcv]]
29 > > >
30 > > > > by "upstream", i did mean `liblwpx-paranoidagent-perl`. so yeah, maybe this should be punted back into that package's court again. :( --[[anarcat]]
31 > > > > 
32 > > > > done, by bumping the severity of [[!debbug 744404]] to release-criticial. --[[anarcat]]
33
34 [[!template  id=gitbranch branch=anarcat/dev/ssl_ca_path author="[[anarcat]]"]] 
35
36 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]]
37
38 The Perl module manual says:
39
40 >            "no_identity_server"
41 >               (CV) Tried to do discovery on a URL that does not seem to have any providers at all.
42
43 Yet on the server side, I see no request coming in on the OpenID provider... 
44
45 Adding debugging helps in figuring out wtf is going on:
46
47 ~~~~
48 anarcat@marcos:~$ diff -u ~/src/ikiwiki/IkiWiki/Plugin/openid.pm /usr/share/perl5/IkiWiki/Plugin/openid.pm
49 --- /home/anarcat/src/ikiwiki/IkiWiki/Plugin/openid.pm  2014-02-03 20:21:09.502878631 -0500
50 +++ /usr/share/perl5/IkiWiki/Plugin/openid.pm   2014-04-13 11:45:25.413297420 -0400
51 @@ -257,6 +256,7 @@
52         return Net::OpenID::Consumer->new(
53                 ua => $ua,
54                 args => $q,
55 +               debug => 1,
56                 consumer_secret => sub { return shift()+$secret },
57                 required_root => auto_upgrade_https($q, $cgiurl),
58         );
59 ~~~~
60
61 In my case, I see:
62
63
64 ~~~~
65 [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
66 [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
67 [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
68 [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
69 ~~~~
70
71 There are three places in the code the original error message happens:
72
73 * Net::OpenID::claimed_identity
74 * Net::OpenID::verified_identity
75 * Net::OpenID::_find_openid_server
76
77 We'll look at the last one because it's where the URL data is actually fetched.
78
79 [[!format perl """
80 sub _find_openid_server {
81     my Net::OpenID::Consumer $self = shift;
82     my $url = shift;
83     my $final_url_ref = shift;
84
85     my $sem_info = $self->_find_semantic_info($url, $final_url_ref) or
86         return;
87
88     return $self->_fail("no_identity_server") unless $sem_info->{"openid.server"};
89     $sem_info->{"openid.server"};
90 }
91 """]]
92
93 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:
94
95 ~~~~
96 [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
97 [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
98 [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
99 [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
100 [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
101 ~~~~
102
103 To get this little wonder, I had to change the `_find_semantic_info()` as followed:
104
105 [[!format perl """
106 sub _find_semantic_info {
107     my Net::OpenID::Consumer $self = shift;
108     my $url = shift;
109     my $final_url_ref = shift;
110
111     my $doc = $self->_get_url_contents($url, $final_url_ref);
112     $self->_debug("url dump ($url, $final_url_ref) = " . $doc) if $self->{debug};
113     my $info = _document_to_semantic_info($doc);
114     $self->_debug("semantic info ($url) = " . join(", ", map { $_.' => '.$info->{$_} } keys %$info)) if $self->{debug};
115
116     return $info;
117 }
118 """]]
119
120 A minimal test case would be:
121
122 ~~~~
123 perl -e 'use LWPx::ParanoidAgent;
124   print $LWPx::ParanoidAgent::VERSION, " $]: ";
125   print length(LWPx::ParanoidAgent->new->get
126       ("https://id.koumbit.net/anarcat")
127       ->decoded_content), "\n";'
128 ~~~~
129
130 And the results vary according to the version of perl:
131
132 * wheezy: 1.07 5.014002: 5720
133 * jessie: 1.10 5.018002: 398
134
135 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).
136
137 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).
138
139 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.
140
141 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:
142
143     500 Can't read entity body: Resource temporarily unavailable
144
145 ... yet the commandline client works fine... I'm out of ideas for this sucker.
146
147 Update: i found a way to reproduce the problem even with LWPx::ParanoidAgent 1.07:
148
149 ~~~~
150 $ perl -e 'use LWPx::ParanoidAgent;
151   print $LWPx::ParanoidAgent::VERSION, " $]\n";
152   $ua = new LWPx::ParanoidAgent; for (my $i = 0; $i< 10 ; $i++) { $c = LWPx::ParanoidAgent->new->get
153       ("https://id.koumbit.net/anarcat")
154       ->decoded_content; if (length($c) < 100) { print $c; } else { print length($c),"\n";}}'
155 1.07 5.018002
156 5720
157 500 Can't read entity body: Ressource temporairement non disponible
158 500 Can't read entity body: Ressource temporairement non disponible
159 500 Can't read entity body: Ressource temporairement non disponible
160 500 Can't read entity body: Ressource temporairement non disponible
161 500 Can't read entity body: Ressource temporairement non disponible
162 500 Can't read entity body: Ressource temporairement non disponible
163 500 Can't read entity body: Ressource temporairement non disponible
164 500 Can't read entity body: Ressource temporairement non disponible
165 500 Can't read entity body: Ressource temporairement non disponible
166 ~~~~
167
168 Workaround - disable error checking:
169
170 ~~~~
171 --- /home/anarcat/src/ikiwiki/IkiWiki/Plugin/openid.pm  2014-02-03 20:21:09.502878631 -0500
172 +++ /usr/share/perl5/IkiWiki/Plugin/openid.pm   2014-04-13 16:00:06.875744596 -0400
173 @@ -237,7 +237,7 @@
174
175         my $ua;
176         eval q{use LWPx::ParanoidAgent};
177 -       if (! $@) {
178 +       if (! $@ && 0) {
179                 $ua=LWPx::ParanoidAgent->new;
180         }
181         else {
182 ~~~~
183
184 > I get the same trouble with OpenID and some locally installed versions of IkiWiki on Debian wheezy (server) as well as on 13.10 Ubuntu (laptop). To be precise I hit the *other* bug in LWP: [#738493](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=738493).
185 >
186 > My only workaround for now was to fix `PERL_LWP_SSL_VERIFY_HOSTNAME` to 0 directly in `ikiwiki` :-(  -- [[users/bbb]]
187
188 ~~~~
189 --- /usr/bin/ikiwiki.orig       2014-09-08 15:48:35.715868902 -0400
190 +++ /usr/bin/ikiwiki    2014-09-08 15:48:38.895947911 -0400
191 @@ -225,4 +225,5 @@
192         }
193  }
194
195 +$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
196  main;
197 ~~~~
198