<p dir="ltr"><br>
On Mar 30, 2016 22:26, "Mads Kiilerich" <<a href="mailto:mads@kiilerich.com">mads@kiilerich.com</a>> wrote:<br>
><br>
> On 03/29/2016 09:25 PM, Konstantin Veretennicov wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I was setting up Kallithea for our small team, to replace hgweb.cgi installation<br>
>> that didn't cut it anymore, especially when it came to code review.<br>
>> Email + hgweb are very flexible and you can go a surprisingly long way with just<br>
>> that. But they're not enough for tracking which changes are still to be reviewed<br>
>> or integrated.<br>
>><br>
>> Since our infrastructure is all Windows, Kallithea had to be installed on<br>
>> Windows Server 2012 R2 (*duck*).<br>
>><br>
>> I got an experimental installation inside virtualenv up and running fairly<br>
>> quickly. We did evaluation with the team and I proceeded to "production"<br>
>> install. The main thing to solve was making it work with our existing Active<br>
>> Directory accounts.<br>
>><br>
>> So I made a fatal decision: decided to put Kallithea behind some proxy with<br>
>> Windows Authentication support and configure container auth. That way I hoped to<br>
>> get a single'ish sign-on. My initial attempt was with IIS and ISAPI WSGI.<br>
><br>
><br>
> So you were following <a href="http://docs.kallithea-scm.org/en/latest/installation_iis.html">http://docs.kallithea-scm.org/en/latest/installation_iis.html</a> ?</p>
<p dir="ltr">Yep, to the letter. (Which reminds me that there was also an error about --root=/ not recognized as valid arg... is this part of documentation fresh?)</p>
<p dir="ltr">><br>
>> I soon<br>
>> discovered that it meant pywin32 dependency, which is no friend of virtualenv -<br>
>> so there goes virtualenv. Anyway, when everything that had to be installed and<br>
>> configured was finally installed and configured (including ISAPI support in IIS,<br>
>> application pool settings, etc.), all this managed to produce was mysterious<br>
>> death of IIS application pool process whenever a request was sent to it. What<br>
>> made me abandon this track was complete lack of diagnostics: apart from Windows<br>
>> Event Log talking of sudden crash of w3wp.exe - nothing of substance. <br>
><br>
><br>
> Did you use win32traceutil as mentioned in the documentation?</p>
<p dir="ltr">Sure, but it stayed dead silent. I even checked from interpreter whether it worked at all - it did. I concluded that isapi-wsgi didn't get a chance to write to it, because of a very very early crash. Which is consistent with Failed Request Tracing not producing anything (I checked separately that FRT works).</p>
<p dir="ltr">><br>
>> So, anyway... finally I got to the point where my wrong initial assumption<br>
>> became obvious :) - the assumption that Mercurial will authenticate against this<br>
>> setup. But Mercurial client doesn't do Windows Authentication, only Basic.<br>
>> Which (as I immediately remembered) I already discovered 5 years ago while<br>
>> setting up our original hgweb...<br>
>><br>
>> I still fiddled a bit with IIS Basic Authentication, which validates<br>
>> plaintext credentials against Active Directory, but it didn't work out<br>
>> right away. For some reason Mercurial client got served login page instead of<br>
>> repo data. There was probably some mistake here on my part that could be<br>
>> debugged with a bit of effort, but at this point I was quickly losing steam.<br>
>> Also it looked like a dead-end anyway, because even if it worked I was only<br>
>> getting plaintext auth. So why not remove proxy from the picture and<br>
>> authenticate with AD over LDAP.<br>
>><br>
>> Here the first hurdle was to get python-ldap binaries for Python 2.7 x64, which,<br>
>> in a moment of weakness, I just grabbed from Gohlke. <br>
><br>
><br>
> Why was that weakness?</p>
<p dir="ltr">Compared to compiling my own? :)<br>
I'm not fond of downloading semi-official binaries from the web.</p>
<p dir="ltr">><br>
>> Then I had to figure out<br>
>> correct LDAP settings. I managed that with the help of documentation, some trial<br>
>> and error and my lucky rabbit foot. I think the key setting for me was "LDAP<br>
>> Filter". Luckily, the Active Directory notes in Kallithea LDAP documentation<br>
>> matched our own "Small Business Server" LDAP layout.<br>
><br>
><br>
> What part of the documentation left you having to do trial and error? How could it have helped you?</p>
<p dir="ltr">I'm not sure Kallithea documentation has much to improve here. It's just those nitty-gritty details of LDAP itself and AD's implementation of it, like filter expressions, ports and protocols.</p>
<p dir="ltr">At some point I thought "I know, I will look up the correct settings in our Jenkins installation!" - it also uses LDAP/AD. I was surprised to see only a couple of settings in its configuration, none of them customized. It just worked with AD out of the box.</p>
<p dir="ltr">><br>
><br>
>> The last steps were piece(s) of cake, punching a hole in Windows firewall and<br>
>> making Kallithea an NT Service with the help of wsgisvc. Here I wasn't sure<br>
>> which folders need which permissions, so I left it running under (overpowered)<br>
>> "Local System" account, which is wsgisvc's default.<br>
>><br>
>><br>
>> I post this here mainly as a reminder to self to make a documentation PR with a<br>
>> warning "Don't waste your time putting Kallithea behind Windows Authentication".<br>
><br>
><br>
> That doesn't sounds like a helpful advice. But it would be nice to get the documentation improved to help with the problems you encountered and to set the expectations right and mention the pros and cons.</p>
<p dir="ltr">Don't know how it sounds, but as soon as I get a time machine that's the message I will deliver to my past self :) Because it works just fine with LDAP and we could have started using Kallithea one day earlier.</p>
<p dir="ltr">Anyway, I phrased it differently in the small PR <a href="https://bitbucket.org/conservancy/kallithea/pull-requests/213/docs-add-warning-about-iis-windows/">https://bitbucket.org/conservancy/kallithea/pull-requests/213/docs-add-warning-about-iis-windows/</a></p>
<p dir="ltr">> /Mads<br>
</p>