🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
9 messages
9 total messages Started by Marc Mon, 25 Nov 2002 08:46
Coding a auth prog for INND
#62116
Author: Marc
Date: Mon, 25 Nov 2002 08:46
9 lines
1232 bytes
Hello,

I would like to do my own C code to use as auth program in the 
readers.conf. Are there any guides out there which specifies what the 
programm needs to return and how it receives it's input ?

Many thanks

Re: Coding a auth prog for INND
#62107
Author: Jeffrey M. Vinocur
Date: Mon, 25 Nov 2002 11:26
119 lines
5766 bytes
In article <3DE1E349.5020503@NOSPAM_hotmail.com>,
Marc  <syn_uw@NOSPAM_hotmail.com> wrote:
>
>I would like to do my own C code to use as auth program in the 
>readers.conf. Are there any guides out there which specifies what the 
>programm needs to return and how it receives it's input ?

I'm actually in the process of cleaning up the documentation for
that as we speak.  The examples in authprogs/ of the INN source
tree should help.

The following is documentation for CURRENT, but it should mostly
or entirely apply to other versions as well:

---------------------------------------------------------------------------
NNRPD External Authentication Support
    A fundamental part of the readers.conf(5)-based authorization mechanism
    is the interface to external authenticator and resolver programs. This
    interface is documented below.

    INN ships with a number of such programs (all written in C, although any
    language can be used). Code for them can be found in authprogs/ of the
    source tree; the authenticators are installed to *pathbin*/auth/passwd,
    and the resolvers are installed to *pathbin*/auth/resolv.

Reading information from nnrpd
    When nnrpd spawns an external auth program, it passes information on
    standard input as a sequence of "key: value" lines. Each line ends with
    CRLF, and a line consisting of only "." indicates the end of the input.
    The order of the fields is not significant. Additional fields not
    mentioned below may be included; this should not be cause for alarm.

    (For robustness as well as ease of debugging, it is probably wise to
    accept line endings consisting only of LF, and to treat EOF as
    indicating the end of the input even if "." has not been received.)

  For authenticators

    When nnrpd calls an authenticator, the lines it passes are

        ClientAuthname: user\r
        ClientPassword: pass\r

    where *user* and *pass* are the username and password provided by the
    client (e.g. using AUTHINFO). In addition, nnrpd generally also passes
    the fields mentioned as intended for resolvers; it rare instances this
    data may be useful for authenticators.

  For resolvers

    When nnrpd calls a resolver, the lines it passes are

        ClientHost: hostname\r
        ClientIP: IP-address\r
        ClientPort: port\r
        LocalIP: IP-address\r
        LocalPort: port\r
        .\r

    where *hostname* indicates a string representing the hostname if
    available, *IP-address* is a numeric IP address (dotted-quad for IPv4,
    equivalent for IPv6 if appropriate), and *port* is a numeric port
    number. (The *LocalIP* paramter may be useful for determining which
    interface was used for the incoming connection.)

    If information is not available, nnrpd will omit the corresponding
    fields. In particular, this applies to the unusual situation of nnrpd
    not being connected to a socket; TCP-related information is not
    available for standard input.

Returning information to nnrpd
  Exit status and signals

    The external auth program must exit with a status of `0' to indicate
    success; any other exit status indicates failure. (The non-zero exit
    value will be logged.)

    If the program dies due to catching a signal (for example, a
    segmentation fault occurs), this will be logged and treated as a
    failure.

  Returning a username and domain

    If the program succeeds, it may return a username string (optionally
    with a domain appended) by writing to standard output. The line it
    should write is exactly:

        user:username\r

    where *username* is the string that nnrpd should use in matching
    readers.conf access blocks.

    There should be no extra spaces in lines sent from the hook to nnrpd;
    `user:aidan' is read by nnrpd as a different username than `user:
    aidan'.

Error messages
    As mentioned above, errors can be indicated by a non-zero exit value, or
    termination due to an unhandled signal; both cases are logged by nnrpd.
    However, external auth programs may wish to log error messages
    separately.

    Although nnrpd will syslog() anything an external auth program writes to
    standard error, it is generally better to use the messages.h functions,
    such as warn() and die().

    Please use the ckpasswd.c program as an example for any authenticators
    you write, and ident.c as an example for any resolvers.

HISTORY
    Written by Aidan Cully for InterNetNews. This documentation rewritten in
    POD by Jeffrey M. Vinocur <jeff@litech.org>.
---------------------------------------------------------------------------


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: Coding a auth prog for INND
#62109
Author: Marc
Date: Mon, 25 Nov 2002 12:15
19 lines
1635 bytes
Jeffrey M. Vinocur wrote:


> I'm actually in the process of cleaning up the documentation for
> that as we speak.  The examples in authprogs/ of the INN source
> tree should help.
> 
> The following is documentation for CURRENT, but it should mostly
> or entirely apply to other versions as well:

<SNIP>

Many thanks for the docs, do you maybe also know where I can now find an 
LDAP API doc, it's mostly to know how I can use the ldap functions from 
the ldap library.

Regards

Re: Coding a auth prog for INND
#62111
Author: Jeffrey M. Vinocur
Date: Tue, 26 Nov 2002 01:17
18 lines
1599 bytes
In article <3DE21471.2020100@NOSPAM_hotmail.com>,
Marc  <syn_uw@NOSPAM_hotmail.com> wrote:
>
>Many thanks for the docs, do you maybe also know where I can now find an 
>LDAP API doc, it's mostly to know how I can use the ldap functions from 
>the ldap library.

Oh, why didn't you say so?  Are you using a system with PAM (e.g.
Redhat)?  Just install pamckpasswd from 

  http://www.wossname.org.uk/~mathie/software/#pamckpasswd

and configure it to use pam_ldap instead of pam_unix

-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: Coding a auth prog for INND
#62124
Author: Marc
Date: Tue, 26 Nov 2002 18:49
17 lines
1749 bytes
Jeffrey M. Vinocur wrote:


> Oh, why didn't you say so?  Are you using a system with PAM (e.g.
> Redhat)?  Just install pamckpasswd from 
> 
>   http://www.wossname.org.uk/~mathie/software/#pamckpasswd
> 
> and configure it to use pam_ldap instead of pam_unix

Well I am using Slackware and Slackware doesn't use PAM at all. That's 
why I am also coding my own auth proggie...

Regards


Re: Coding a auth prog for INND
#62126
Author: Jeffrey M. Vinocur
Date: Tue, 26 Nov 2002 22:50
15 lines
1539 bytes
In article <3DE3C23C.4090800@NOSPAM_hotmail.com>,
Marc  <syn_uw@NOSPAM_hotmail.com> wrote:
>Jeffrey M. Vinocur wrote:
>
>>   http://www.wossname.org.uk/~mathie/software/#pamckpasswd
>
>Well I am using Slackware and Slackware doesn't use PAM at all. That's 
>why I am also coding my own auth proggie...

Ohh.  Well, good luck -- I don't know anything about LDAP, and
don't know if anyone here will.  You'll probably have to track
down some ldap-type people.


Re: Coding a auth prog for INND
#62127
Author: Russ Allbery
Date: Tue, 26 Nov 2002 23:38
15 lines
1691 bytes
Jeffrey M Vinocur <jeff@litech.org> writes:

> Ohh.  Well, good luck -- I don't know anything about LDAP, and don't
> know if anyone here will.  You'll probably have to track down some
> ldap-type people.

I've done quite a bit of LDAP v2, but I'm guessing that you'll probably
want to use LDAP v3, about which I don't know nearly as much.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

          Please post questions rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.
Re: Coding a auth prog for INND
#62148
Author: Marc
Date: Thu, 28 Nov 2002 10:16
14 lines
1560 bytes
Russ Allbery wrote:

> 
> I've done quite a bit of LDAP v2, but I'm guessing that you'll probably
> want to use LDAP v3, about which I don't know nearly as much.
> 

Well actually it wasn't as complicated as I thought and the code is 
maximum 200 lines long of C. And it really works fine :) Thanks for the 
help to all.

Regards

Re: Coding a auth prog for INND
#62173
Author: those who know me have no need o...
Date: Fri, 29 Nov 2002 10:52
11 lines
1418 bytes
in news.software.nntp i read:

>Well actually it wasn't as complicated as I thought and the code is
>maximum 200 lines long of C. And it really works fine :) Thanks for
>the help to all.

consider contributing it.

-- 
bringing you boring signatures for 17 years
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads