如何避免在SVN的configuration文件中写入密码?

我正在configuration服务器SVN Collabnet(适用于Solaris 10的v1.5.6.1)。 我成功地使用ldap服务器进行SVN身份validation。 如何避免在下面的configuration文件(collabnet_subversion_httpd.conf)中写入一个非encryption密码(XXXXX,在这里)?

ServerName mccuatsv10:8080 Listen 8080 User csvn Group csvn <Location /svn> DAV svn SetHandler svn SVNParentPath /appli/svn/repositories/ AuthName "Subversion repository" AuthType Basic AuthBasicProvider ldap AuthzLDAPAuthoritative On AuthLDAPBindDN [email protected] AuthLDAPBindPassword XXXXX AuthLDAPURL ldap://eur.msd.world.ibm:389/OU=Users,OU=Accounts,OU=FR,DC=eur,DC=msd,DC=world,DC=socgen?sAM AccountName?sub?(objectCategory=person) Require valid-user </Location> 

一种select是将AuthLDAPBindPassword行放在合适的chmod文件中,并在apcaheconfiguration文件中使用Include将文件拉入。例如:

 <Location /svn> ... AuthLDAPBindDN [email protected] Include my_ldap_password.conf ... </Location> 

这可以保证密码的安全性,同时保持configuration世界的其余部分可读。

一些ldap服务器允许匿名绑定。 那么[afaik]你不需要提供绑定密码。

由于Apache2以root身份启动并在删除root之前读取configuration文件。

假设您的当前文件configuration由root拥有,并且group是root,如下所示:

-rw-r--r-- 1 root root 1.4K 2014-10-15 14:43 vhostconf

您可以将读取/写入/执行从文件中删除到“其他用户”:

sudo chmod o-rwx /etc/apache2/sites-available/vhostconf

你最终应该:

-rw-r----- 1 root root 1.4K 2014-10-15 14:43 vhostconf

这应该足以让Apache2读取它的权限。

从Apache 2.2.25开始,AuthLDAPBindPassword可以执行命令来查找密码。

最简单的select将是有

 AuthLDAPBindPassword "exec:/bin/cat /some/file/with/password" 

详情请参阅http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html#authldapbindpassword