SVN Authentication against a Microsoft Active Directory using svnserve sasl, ldap

April 11th, 2010 No comments »

I have borrowed the contents of this post with permission from the author of this link:

http://e-d20.com/?p=27

The reason I am posting it here is because this type of questions are frequently asked, so here goes:

Below you will find instructions on how to authenticate subversion users against a Microsoft Active Directory using svnserve sasl, ldap. I am writing this documentation for future reference by myself, and because I cannot find a good compilation of documents that adequately explain how to configure this properly.

Please note, this document is being written after two days of frustrating configuration. I apologise if everything is not absolutely accurate, but will assist as best as I can if you need help.

- Pre Setup –

Server with Ubuntu Server Edition 9.10 loaded.

- Install packages, subversion, db4.7-util, sasl2-bin, ldap-utils


sudo apt-get install subversion db4.7-util sasl2-bin ldap-utils

Configure /path/to/repository/conf/svnserve.conf in your repository path to use sasl.

## svnserve.conf
[general]

## Drop access for anonymous users
anon-access = none

## Access for authorized users to write
auth-access = write

[sasl]
use-sasl = true

With the option use-sasl set to true, you’re telling the svnserve daemon to use SASL as it’s authentication method. Now you have to tell SASL to authenticate using the SASL Authentication daemon, when subversion requests an authentication.

Reference, http://svnbook.red-bean.com/en/1.5/svn.serverconfig.svnserve.html

The way to achieve this, is to create a svn.conf or subversion.conf (not sure which, I made svn.conf and link to subversion.conf) file in a location that SASL can find. In Ubuntu Server 9.10, this location is, /usr/lib/sasl2/.

Create the file, /usr/lib/sasl2/svn.conf and configure it with the following options.


#/usr/lib/sasl2/svn.conf -- might be /usr/lib/sasl2/subversion.conf not sure, make both

## Password check method, default to the SASL AUTH daemon
pwcheck_method: saslauthd

## Auxiliary (propery) plugin, use ldap
auxprop_plugin: ldap

## Mechanism list, MS AD requires you to send credentials in plain text
mech_list: PLAIN LOGIN

## Not sure if this is required… but I kept it in
ldapdb_mech: PLAIN LOGIN

Now you need to configure the SASL Auth Daemon to use LDAP. The file is located at /etc/default/saslauthd .

Only need to modify one variable here, and that is MECHANISMS.


# /etc/default/saslauthd

MECHANISMS=”ldap”

Finally configure SASL to connect to your Active Directory. You’ll need to create the file, /etc/saslauthd.conf

Reference, http://www.opensource.apple.com/source/passwordserver_sasl/passwordserver_sasl-159/cyrus_sasl/saslauthd/LDAP_SASLAUTHD


#/etc/saslauthd.conf

## URL for the Active Directory
ldap_servers: ldap://ad.example.com

## Not sure why exactly, but yes doesnt work… so no.
ldap_use_sasl: no

## Bind DN (Distinguishing Name) of the user you want to bind to the AD
ldap_bind_dn: CN=Bind User,OU=AdminGroup,DC=ad,DC=example,DC=com

## Password to the above user
ldap_password: password

## Sends passwords as plain text to AD to authenticate
ldap_mech: PLAIN

## Auth Method = Bind as specified user, and search for users in the AD
ldap_auth_method: bind

## Filter for users. (user@example.com) sAMAccountName = user
ldap_filter: sAMAccountName=%U

## Specify search base
ldap_search_base: OU=Users,DC=ad,DC=example,DC=com

You can test this setup by running the saslauthd in debug mode,

saslauthd -a ldap -d

Authorization messages are stored in,

/var/log/auth.log

If you are having problems connecting to your AD, I suggest trying to use ldapsearch to connect first, then adjusting your saslauthd.conf file.

ldapsearch -x -H ldap://ad.example.com/ \
-D cn=Bind\User,OU=AdminGroup,DC=ad,DC=example,DC=com \
-w password \
-b ” \
“(sAMAccountName=userToTest)”

Good luck.

Sync a subversion repository to an FTP location

September 5th, 2009 No comments »

This was posted by codeslinger. When I upgraded to the latest wordpress version, I was unable to successfully migrate accounts.

I just recently wrote my first python script, which is a subversion hook script that I am calling svn2ftp. I needed to synchronize my repository to an FTP location and was surprised to have such difficulty finding a script that would do the job. Since then I found svn2web which purports to do roughly the same thing. I have not tried it though.

The script has documentation within, so I won’t repeat here, but the general idea is that you must pass as arguments the ftp connection information, the ftp remote directory that is supposed to serve as a mirror of your repository, as well as what path in the repository you are interested in propagating.

The script uses svn diff –summarize so it only needs to reflect changes. Never does svn2ftp explicitly do a full transfer to the server. Something to keep in mind.

Also, I wrote the routine to remember the last successful revision number. This way if revisions get skipped on account of failures, it can try again the next time it is called.

If anyone has any contributions or comments, please leave them. I’m open to both

Click here to download. I had to change the extension to .txt because the blog software didn’t like a .py extension…

Also note that this script is dependent on both pysvn and python subversion bindings.

Sync a subversion repository to an FTP location

user Posted by codeslingerdate bullet August 8th, 2007

I just recently wrote my first python script, which is a subversio