Apache,Trac和LDAP-如何将它们粘合在一起?


8

我正在尝试设置Trac以通过Debian(Lenny)服务器上的LDAP插件授权用户。

LDAP似乎工作正常,我可以通过以下方式成功查询:

ldapsearch -vLx -h 127.0.0.1 -b "dc=example, dc=com" "(sn=mysurname)"

并且,如果我有意破坏了我的Apache LDAP地址设置,我会在/var/log/apache2/error.log中看到错误。

2010-08-27 17:19:38,909 Trac[api] WARNING: LDAP error: No such object (dc=examplefoo,dc=com)

当我访问http://example.com:8022/trac并单击登录按钮时,会弹出身份验证窗口(再次确认LDAP正在启动),但是,当我输入正确的用户名/密码时,我只会得到Trac网站页面:

Trac Error
Authentication information not available. Please refer to the installation documentation.

TracGuide — The Trac User and Administration Guide

日志同样无济于事(忽略svn错误,我知道):

2010-09-01 14:25:30,553 Trac[api] DEBUG: NEEDS UP?: sys:False, rep:False, stats:False, fields:False, man:False
2010-09-01 14:25:30,577 Trac[env] WARNING: base_url option not set in configuration, generated links may be incorrect
2010-09-01 14:25:30,577 Trac[main] DEBUG: Dispatching <Request "GET u'/login'">
2010-09-01 14:25:30,583 Trac[svn_fs] INFO: Failed to load Subversion bindings
Traceback (most recent call last):
  File "/home/web/example/buildout-cache/eggs/Trac-0.11-py2.6.egg/trac/versioncontrol/svn_fs.py", line 251, in __init__
    _import_svn()
  File "/home/web/example/buildout-cache/eggs/Trac-0.11-py2.6.egg/trac/versioncontrol/svn_fs.py", line 69, in _import_svn
    from svn import fs, repos, core, delta
ImportError: No module named svn
2010-09-01 14:25:30,584 Trac[chrome] DEBUG: Prepare chrome data for request
2010-09-01 14:25:30,586 Trac[api] DEBUG: action controllers for ticket workflow: ['ConfigurableTicketWorkflow']
2010-09-01 14:25:30,597 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_CREATE on None
2010-09-01 14:25:30,599 Trac[perm] DEBUG: No policy allowed anonymous performing TRAC_ADMIN on None
2010-09-01 14:25:30,599 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_GRANT on None
2010-09-01 14:25:30,599 Trac[perm] DEBUG: No policy allowed anonymous performing PERMISSION_REVOKE on None
2010-09-01 14:25:30,599 Trac[perm] DEBUG: No policy allowed anonymous performing TICKET_ADMIN on None
2010-09-01 14:25:30,601 Trac[main] WARNING: 500 Trac Error (Authentication information not available. Please refer to the <a href="https://serverfault.com/trac/wiki/TracInstall#ConfiguringAuthentication" title="Configuring Authentication">installation documentation</a>.)
2010-09-01 14:25:30,621 Trac[perm] DEBUG: No policy allowed anonymous performing EMAIL_VIEW on None
2010-09-01 14:25:30,621 Trac[session] DEBUG: Retrieving session for ID '20e2cfb643bff0f9121fe615'
2010-09-01 14:25:30,641 Trac[tande_filters] DEBUG: self.billing_reports= set([9, 10, 11, 12, 13, 14, 15, 16, 17])
2010-09-01 14:25:30,642 Trac[ticket_webui] DEBUG: TicketWebUiAddon executing
2010-09-01 14:25:30,774 Trac[main] DEBUG: 124 unreachable objects found.

我的Apache设置如下。

<VirtualHost example.com:8022>
    ServerName example.com
    ServerAlias example.com

    ProxyRequests Off
    <Proxy *>
      Order deny,allow
      Allow from all
    </Proxy>

    ProxyPreserveHost On
    RewriteEngine On
    RewriteCond %{HTTP:Authorization} ^(.*)
    RewriteRule ^/(.*) http://127.0.0.1:8002/$1 [P]
</VirtualHost>

<Location /trac/login>
   AuthType Basic
   AuthName "Trac"
   AuthBasicProvider ldap
   Order Allow,Deny
   Allow from All
   AuthLDAPURL "ldap://127.0.0.1:389/dc=example,dc=com?uid"
   #should be on if using groups
   AuthzLDAPAuthoritative off
   Require valid-user
   #Require ldap-group cn=tracusers,dc=example,dc=com
</Location>

该服务器有许多其他正在运行的开发中服务在运行,因此是奇数端口号。

我的trac.ini是全新安装,进行了以下更改:

[ldap]
basedn = dc=example,dc=com
bind_passwd = foo
bind_user = cn=admin,dc=example,dc=com
enable = true
group_rdn = ou=people
host = 127.0.0.1
port = 389
use_tls = false
user_rdn = ou=users

[components]
ldapplugin.* = enabled

为了进行测试,我仅使用以下命令启动Trac服务器:

bin/tracd --port 8202 parts/trac

我要去哪里错了?感觉好像apache配置有问题,就像LDAP似乎在工作一样。

那是使用服务器启动服务器的正确命令(例如,htpasswd有其自己的选项)吗?

从长远来看,什么是运行服务器的最佳方法?WSGI?


你修好了吗?我对这个问题的解决方法很感兴趣...
Kartoch 2011年

Answers:


1

如果您需要测试“ Apache + LDAP + Trac”绑定,则无需独立运行bin/tracd

首先尝试在不带LdapPlugin的Trac中使用Apache LDAP身份验证(它只是增加了管理LDAP组的跟踪权限的能力)。您应该在/trac/login位置上配置身份验证,Trac会自动获取经过身份验证的用户名。在这里查看:TracModWSGI-配置身份验证在我的设置中运行正常(Debian Squeeze,Trac 0.12)。因此,只需从中删除所有修改即可trac.ini

获得工作身份验证后,可以开始配置LdapPlugin。

WSGI是IMHO在Apache上运行python应用程序的最佳方法,它既快速又简单。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.