[Buildbot-devel] Could anybody give me a configuration example about LDAP authentication for WebStatus?

Vasily vasslitvinov at pisem.net
Wed Jul 16 09:53:23 UTC 2014


Hi,

This is how we do it:

class BasicHTTPAuthRequest(Request):
    '''
    Class allowing us to put some more info into request before it is
processed by Buildbot.
    We use activedirectory package to get e-mail and display name and we
add our own request
    arguments for ForceScheduler instance to get them from the request.
    '''
    def process(self):
        userName, userPass = self.getUser(), self.getPassword()
        if userName:
            try:
                userName, userDisplayName, userEmail =
getUserInfo(userName, userPass, \
                    getActiveDirectoryCachePath())
            except:
                twistedLog.msg('BasicHTTPAuthRequest: exception: %s' %
traceback.format_exc())
                userDisplayName = ''
                userEmail = current_site.NOTIFY
            # Overriding user_name here would help those sites where nginx
accepts logins both
            # with and without domain specified (like in INNL) - previously
that broke further
            # P1 builds because IDSID wasn't extracted, now it is properly
extracted no matter
            # which form of username was specified by user.
            self.args['user_name'] = [userName]
            self.args['user_email'] = [userEmail]
            self.args['display_name'] = [userDisplayName]
        return Request.process(self)

class BasicHTTPAuthWebStatus(html.WebStatus):
    '''
    Subclass for usual Buildbot WebStatus that allows overriding
requestFactory at the moment
    of initializing itself. Basic WebStatus sets its requestFactory to
twisted Request class.
    '''
    def setupSite(self):
        self.site.requestFactory = BasicHTTPAuthRequest
        return html.WebStatus.setupSite(self)


getUserInfo() is a function implemented via python-ldap which goes to
ActiveDirectoy.

Thanks,
Vasily


2014-07-16 6:11 GMT+04:00 你是我的眼 <hbingbing at foxmail.com>:

> Hi,
>
> I want to config buildbot by ldap authentication, but I can't find
> anything useful in buildbot manual.
> Could someone give me a configuration ‍example about LDAP authentication
> for WebStatus?‍
>
> Maybe it can be completed with Apache HTTPD as reverse proxy according to
> the offical manual, but I don't know to how to config it used by ldap.‍
>
>
> Thanks a lot!
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20140716/b1851b41/attachment.html>


More information about the devel mailing list