The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

How to enable the SpamAssassin LDAP self-test
---------------------------------------------

- install openldap server, using apt-get etc.   On Debian (unstable),
  that's done as follows:

    sudo apt-get install slapd ldap-utils

  Then enter an admin password.


- Patch the 'inetorgperson.schema' file, found in the following locations:

        Fedora Core 1: /etc/openldap/schema/inetorgperson.schema
        Debian: /etc/ldap/schema/inetorgperson.schema

  as follows:

--- /etc/openldap/schema/inetorgperson.schema.default   2003-10-23 07:26:01.000000000 -0700
+++ /etc/openldap/schema/inetorgperson.schema   2004-02-05 22:07:01.000000000 -0800
@@ -121,6 +121,13 @@
        DESC 'RFC2798: personal identity information, a PKCS #12 PFX'
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.5 )
 
+# spamassassin
+# see http://SpamAssassin.org/ .
+attributetype ( 2.16.840.1.113730.3.1.220
+       NAME 'spamassassin'
+       DESC 'SpamAssassin user preferences settings'
+       EQUALITY caseExactMatch
+       SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
 
 # inetOrgPerson
 # The inetOrgPerson represents people who are associated with an
@@ -138,5 +145,5 @@
                labeledURI $ mail $ manager $ mobile $ o $ pager $
                photo $ roomNumber $ secretary $ uid $ userCertificate $
                x500uniqueIdentifier $ preferredLanguage $
-               userSMIMECertificate $ userPKCS12 )
+               userSMIMECertificate $ userPKCS12 $ spamassassin )
        )


- set up according to
  http://yolinux.com/TUTORIALS/LinuxTutorialLDAP.html#TUTORIAL . To go into
  some detail, here's what you need to do...
 

- Edit the slapd.conf file, and add the "o=stooges" suffix, so that the LDIF
  file we'll be using will be valid.

  On Debian, this means changing the existing /etc/ldap/slapd.conf file
  according to these substitutions:

    s/"dc=jmason,dc=org"/"o=stooges"/g
    s/"cn=admin,dc=jmason,dc=org"/"cn=StoogeAdmin,o=stooges"/g

  Also, add these two lines to set the "root" password so the LDIF file
  can be loaded (ONLY FOR TESTING! DO NOT DO THIS ON A LIVE SERVER!):

    rootdn      "cn=StoogeAdmin,o=stooges"
    rootpw      secret1

  On Fedora Core 1, you can use the file from
  http://yolinux.com/TUTORIALS/OpenLDAP2.0-stooges-slapd.conf-sample.txt 
  pretty much as-is.


- Next, create the storage directories:

    sudo mkdir /var/lib/ldap/stooges /var/lib/ldap/fraternity
    sudo chown ldap.ldap /var/lib/ldap/stooges    [Fedora Core only]
    sudo chown ldap.ldap /var/lib/ldap/fraternity [Fedora Core only]


- And start the server:

    sudo /etc/rc.d/init.d/ldap start              [Fedora Core only]
    sudo /etc/init.d/slapd start                  [Debian only]


- Now load the LDIF data for our testing: (this LDIF file adds a "spamassassin"
  line to the "curley" user.)

    ldapadd -f ldap/sa_test.ldif -xv -D "cn=StoogeAdmin,o=stooges" \
		-h 127.0.0.1 -w secret1


- install Net::LDAP using CPAN:

    perl -MCPAN -e shell
    install Convert::ASN1
    install Net::LDAP
    quit


- create the test flag file:

    touch t/do_ldap


- now "make test" will test against the LDAP server as well.  You can
  also run "cd t; ./spamd_ldap.t" to run just that test directly.