Re: LDAP: homeDirectory from different attributes

Heiko Noordhof <[email protected]> Thu, 26 Jan 2006 13:34:06 +0100
Newsgroups gmane.network.pureftpd.user
Message-ID <[email protected]>
Jimmy Ott wrote:

>i'm using pureftp with LDAP.
>is it possible to build the homeDirectory return value with more than
>one attribute? and perhaps with regulary expressions?
>[..snip..]
>i want to build the homeDirectory value from cn and perhaps some other
>attributes. as an example:
>abstract: /home/ftp/domains/<domainname>/<cn>
>example: /home/ftp/domains/onnet.ch/jott
>
>is there any possibility for that?
>  
>
One possibility would be to have the application you use to edit the
FTP-entries in LDAP construct the homeDirectory attribute.

If that's not possible in your case, you could use the pure-authd
daemon. This is the "hard way". This enables you to handle pure-ftpd
authentication yourself through a program or script. In the
program/script you'll need to query LDAP yourself, and construct the
home directory string the way you want.

Please note that:
- The pure-ftpd server needs to be configured for this a compile time. I
remember the package forSuSE-8 didn't support it. Debian woody and sarge
do IIRC.
- The program or script needs to exit as quickly as possible, so a C
program is probably better than a script, but more difficult.
- The program or script will run *as root*, so take care.

See "man pure-ftpd" (search for "extauth") and "man pure-authd" for
information about this mechanism.

About 2 years ago, I wrote such a program in C that authenticates
against LDAP and writes the number of logins to a hidden file in the
home directory. It did work as I wanted, but I never actually used it,
so development, testing and debugging never really took place. It  may
serve you as a starting point, but please realise that I don't take any
responsibility for bugs and/or security holes. Remember that it will run
as root...

I've made the program available here:
http://www.xs4all.nl/~heiky/pureldaplogincount-0.01.tar.gz

    Heiko


---------------------------------------------------------------------
To post a new message, e-mail: [email protected]
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]