]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/http_proxy_for_openid.mdwn
ikiwiki (3.20130711) unstable; urgency=low
[ikiwiki.git] / doc / bugs / http_proxy_for_openid.mdwn
1 If I try to authenticate using openid to my site, it tries to create a http or https connection to the openid server. This doesn't work, because the direct connection is blocked by the firewall.
2
3 It would be good if ikiwiki supported setting up a proxy server to solve this.
4
5 I have found if I add:
6
7     newenviron[i++]="HTTPS_PROXY=http://host.domain.com:3128";
8
9 to IkiWiki/Wrapper.pm it solves the problem for https requests, however it obviously would be preferred if the proxy name is not hard coded.
10
11 Also, the ability to set HTTPS\_CA\_FILE and HTTPS\_CA\_DIR might benefit some people. Then again, it I can't see any evidence that the SSL certificate of the server is being checked. See the [[bug_report|ssl_certificates_not_checked_with_openid]] I filed on this separate issue.
12
13 Unfortunately, HTTP\_PROXY doesn't work for http:// requests, it looks like that library is different.
14
15 ---
16
17 Update 2008-10-26:
18
19 Better solution, one that works for both http and https, and uses config options. It appears to work...
20
21 Note that using $ua->proxy(['https'], ...); won't work, you get a "Not Implemented" error, see <http://community.activestate.com/forum-topic/lwp-https-requests-proxy>. Also see [[!debbug 129528]].
22
23 Also note that the proxy won't work with liblwpx-paranoidagent-perl, I had to remove liblwpx-paranoidagent-perl first.
24
25 <pre>
26 louie:/usr/share/perl5/IkiWiki/Plugin# diff -u openid.pm.old openid.pm
27 --- openid.pm.old       2008-10-26 12:18:58.094489360 +1100
28 +++ openid.pm   2008-10-26 12:40:05.763429880 +1100
29 @@ -165,6 +165,14 @@
30                 $ua=LWP::UserAgent->new;
31         }
32  
33 +       if (defined($config{"http_proxy"})) {
34 +               $ua->proxy(['http'], $config{"http_proxy"});
35 +       }
36 +
37 +       if (defined($config{"https_proxy"})) {
38 +               $ENV{HTTPS_PROXY} = $config{"https_proxy"};
39 +       }
40 +
41         # Store the secret in the session.
42         my $secret=$session->param("openid_secret");
43         if (! defined $secret) {
44 </pre>
45
46 Brian May
47
48 > Rather than adding config file settings for every useful environment 
49 > variable, there is a ENV config file setting that can be used to set
50 > any environment variables you like. So, no changed needed.
51 > --[[Joey]] 
52
53 >> One thing I don't like about using ikiwiki for tracking bugs is I don't
54 >> get notified when changes are made :-(.
55 >>
56 >> Anyway, if you look at the code I pasted above, the environment variables
57 >> do not work for http:// - you have to use $ua->proxy(...) for them.
58 >> This is significant, because all openid servers in my version appear to have been
59 >> defined with http:// not https://  in /usr/share/ikiwiki/openid-selector/ikiwiki/openid/openid-jquery.js
60 >>
61 >> Use $ua->env_proxy() to get it to read the environment variables. Then http:// does work.
62 >>
63 >> Unfortunately this breaks https:// even more - but nothing I do seems to make https:// work anymore.
64
65
66 >>> LWP::UserAgent defaults to not caring about proxy settings in
67 >>> the environment. (To give control over the result, I guess?) 
68 >>> To get it to care, pass `env_proxy => 1` to the constructor. Affected
69 >>> plugins: aggregate, openid, pinger. This probably wants to be on
70 >>> by default, and might not need to be configurable. --[[schmonz]]
71
72 >>>> Okay, in a real-world scenario it does need to be 
73 >>>> configurable. A working implementation (tested with aggregate,
74 >>>> not tested with the other two plugins) is in my git, commit
75 >>>> 91c46819dee237a281909b0c7e65718eb43f4119. --[[schmonz]]
76
77 >>>>> Oh, and according to the LWPx::ParanoidAgent docs, "proxy support is 
78 >>>>> explicitly removed", so if ikiwiki can preferentially find that 
79 >>>>> installed, even with the above commit, `openid` won't be able to 
80 >>>>> traverse a proxy. --[[schmonz]]
81
82 [[!template id=gitbranch branch=schmonz/proxies author="[[schmonz]]"]]
83
84 >>>>> I bollixed up my git, recloned, and reapplied the diffs, so
85 >>>>> that commit won't exist anymore. My proxy-related changes are
86 >>>>> now on a branch. --[[schmonz]]