{"id":118,"date":"2017-06-01T18:44:21","date_gmt":"2017-06-01T21:44:21","guid":{"rendered":"http:\/\/vargolino.com\/wp\/?p=118"},"modified":"2017-06-05T10:22:13","modified_gmt":"2017-06-05T13:22:13","slug":"using-ldap-to-authenticate-with-a-svnserve","status":"publish","type":"post","link":"https:\/\/vargolino.com\/wp\/?p=118","title":{"rendered":"Using LDAP to authenticate with a svnserve server"},"content":{"rendered":"<p>I had this already set up in another server \u00a0but we had to set up a new svn server even though we already switch most of our stuff to git&#8230;<\/p>\n<p>So, after setting the the <code>svnserve<\/code> daemon, we need to set up LDAP authentication.<\/p>\n<p>We are using debian servers so I needed to install <code>sasl2-bin<\/code> in order to have the <code>saslauthd<\/code> daemon.<\/p>\n<pre>apt-get install sasl2-bin<\/pre>\n<p>After that, we need to set the daemon to start automatically, editing the file: <code>\/etc\/defaults\/saslauthd<\/code> and changing two lines:<\/p>\n<pre>#...\r\nSTART=no\r\n#...\r\n#...\r\nMECHANISMS=\"pam\"\r\n#...\r\n<\/pre>\n<p>to<\/p>\n<pre>#...\r\nSTART=yes\r\n#...\r\n#...\r\nMECHANISMS=\"ldap\"\r\n#...\r\n<\/pre>\n<p>Then the <code>saslauthd<\/code> daemon needs to know how to reach the LDAP server, we configure this in the file <code>\/etc\/saslauthd.conf<\/code>, it is simple as:<\/p>\n<pre>ldap_servers: ldap:\/\/server.address.example.com\r\nldap_port: 389\r\nldap_version: 3\r\nldap_password_attr: userPassword\r\nldap_auth_method: bind\r\nldap_filter: (uid=%u)\r\nldap_search_base: ou=Users,dc=example,dc=com\r\n<\/pre>\n<p>The daemon will look for an entry with the <code>uid=USERNAME<\/code> in the base <code>ou=Users,dc=example,dc=com<\/code> and will check the password against the attribute <code>userPassword<\/code>.<\/p>\n<p>You can test if it is working using the <code>testsaslauthd<\/code> app, like this:<\/p>\n<pre>user@svn:\/svn# testsaslauthd -u username -p secret\r\n0: OK \"Success.\"\r\n\r\nuser@svn:\/svn# testsaslauthd -u username -p wrongSecret\r\n0: NO \"authentication failed\"\r\n<\/pre>\n<p>We can then start the daemon running <code>service saslauthd start<\/code>.<\/p>\n<p>Now, we need to change the <code>svnserve.conf<\/code> so it will actually request the authentication to sasl. So, make sure that the <code>[sasl]<\/code> section of the file looks like this:<\/p>\n<pre>[sasl]\r\nuse-sasl = true\r\n#...\r\n<\/pre>\n<p>And we need to register the svn app into the sasl. Apps are registered by creating a file in <code>\/usr\/lib\/sasl2\/appname.conf<code>. <code>svnserve<code> uses the name <code>svn<\/code> internally, we need to create the file as: <code>\/usr\/lib\/sasl2\/svn.conf<code>, with the following contents:<\/code><\/code><\/code><\/code><\/code><\/code><\/p>\n<pre>pwcheck_method: saslauthd\r\nmech_list: PLAIN LOGIN\r\n<\/pre>\n<p>We are now all set up. We only need to restart the <code>svnserve<\/code> daemon and <em>voil\u00e0<\/em>, it&#8217;s done!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had this already set up in another server \u00a0but we had to set up a new svn server even though we already switch most of our stuff to git&#8230; So, after setting the the svnserve daemon, we need to set up LDAP authentication. We are using debian servers so I needed to install sasl2-bin &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/vargolino.com\/wp\/?p=118\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using LDAP to authenticate with a svnserve server&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[17,7,18,16,15],"class_list":["post-118","post","type-post","status-publish","format-standard","hentry","category-solution","tag-authentication","tag-howto","tag-ldap","tag-sasl","tag-svn","entry"],"_links":{"self":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=118"}],"version-history":[{"count":3,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions"}],"predecessor-version":[{"id":122,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/118\/revisions\/122"}],"wp:attachment":[{"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vargolino.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}