🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #35445

Re: LDAP and INN ?

#35445
From: Jim Dutton
Date: Mon, 15 Feb 1999 00:00
52 lines
2886 bytes
In article <7a1coc$q39$1@news.kpn.com>,
	A.Addicks@kpn.com (Andre Addicks) writes:

> can somebody tell me if there is a LDAP hook for INN 2.x ? We want to use it 
> for client authentication.

There isn't any direct LDAP hook in INN-2.1, and I don't think that there is
any such thing in INN-2.2 either.

One step removed from initial news client connection and authentication is the
ability to accept/reject posted articles based upon user data stored in an LDAP
server. You can use the 'filter_nnrpd.pl' program in conjunction with the
LDAPSEARCH "command line tool" from UMich LDAP-3.3 or Netscape Directory
Server-3.1 (4.x?).

Here is a (partial) sample using locally installed (UMich) LDAP and INN-2.1:

$emailDS = "ldap.server"; $ldapcmd = "/usr/local/bin/ldapsearch";
$logger = "/usr/bin/logger -i -p news.notice";
#
# n504 - LDAP lookup on E-mail address
#
# add code to perform an LDAP lookup of the poster's E-mail address
# while this is not a foolproof security mechanism, it at least should
# help to prevent someone using a non-local E-mail address (most likely to
# happen with a "spammer" posting)
#
# valid mail attributes to search on: "mail", "otherMailbox"
#        
    $email_address = "$from_userid\\\\\@$from_host";
#   $result = `$logger _email_address: '"'$email_address'"'`;
    $baseDN = '"-b o=<our domain>,c=US"';
    $filter = '"mail='.$email_address.'"';
#   $result = `$logger _filter: '"'$filter'"'`;

    $userDN = `$ldapcmd $emailDS "$baseDN" "$filter" dn`;
    chomp($userDN); ($userRDN) = $userDN =~ /^cn=(\w+\s*\w*\s*\w*\s*\w*),/;
    $result = `$logger "_userRDN(mail)": '"'$userRDN'"'`;
  
    if ($userRDN eq "") {
      $filter = '"otherMailbox='.$email_address.'"';
      $userDN = `$ldapcmd $emailDS "$baseDN" "$filter" dn`;
      chomp($userDN); ($userRDN) = $userDN =~ /^cn=(\w+\s*\w*),/;
      $result = `$logger "_userRDN(otherMail)": '"'$userRDN'"'`;
      if ($userRDN eq "") {
        $rval = "n504: Invalid E-mail address";
        $result = `$logger "_rval:" '"'$rval'"'`;  return ($rval);
      }
    }
#

Technical Details
Message-ID: <7a9lrs$bsi$1@saluki-news.it.siu.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <7a1coc$q39$1@news.kpn.com>

Show Full Headers
Complete Article Headers
Message-ID: <7a9lrs$bsi$1@saluki-news.it.siu.edu>
Subject: Re: LDAP and INN ?
Date: Mon, 15 Feb 1999 00:00:00 +0000
From: jimd@NOSPAM.siu.edu (Jim Dutton)
References: <7a1coc$q39$1@news.kpn.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 444646628
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: netnews@siu.edu
X-Trace: saluki-news.it.siu.edu 919100092 12178 131.230.6.142 (15 Feb 1999 17:34:52 GMT)
Organization: A poorly-installed InterNetNews site
Mime-Version: 1.0
NNTP-Posting-Date: 15 Feb 1999 17:34:52 GMT
Newsgroups: news.software.nntp