🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
3 messages
3 total messages Started by Russell Virgilio Mon, 26 Feb 2001 22:08
hacking inn with kerberos hooks
#50858
Author: Russell Virgilio
Date: Mon, 26 Feb 2001 22:08
82 lines
4310 bytes
I need to add some kerberos hooks to  inn 2.3.1  I have inserted them
into ckpasswd.c, and am using a return value of 0 for success, and
anything else for failure.  I know my kerberos api is working, but I
want to be sure there is nothing else I am missing in INN's process to
validate user/pass.  When innd calls ckpasswd does it pass in the
user/pass?  I am using the existing ckpasswd routines to parse
user/pass, is this safe?  Does Innd base it's authentication on the
return value of ckpasswd?  I can not seem to find the answers to these
questions in the source code for INN.  Here is my ckpasswd.c file,
which I can compile with no errors.  I will attach some sample news.err
messages as well.  Thanks for any help.

/*  $Id: ckpasswd.c,v 1.6.2.2 2000/09/20 10:47:22 kondou Exp $
**
**  The default username/password authenticator.
*/
#include "config.h"
#include "clibrary.h"
#include "prism_auth.h"
#include <pwd.h>

int main(int argc, char *argv[])
{
    extern int optind;
    extern char *optarg;
    int opt;
    int retval;
    char uname[SMBUF], pass[SMBUF];
    char buff[SMBUF];
    uname[0] = '\0';
    pass[0] = '\0';
    /* make sure that strlen(buff) is always less than sizeof(buff) */
    buff[sizeof(buff)-1] = '\0';
    /* get the username and password from stdin */
    while (fgets(buff, sizeof(buff)-1, stdin) != (char*) 0) {
        /* strip '\r\n' */
        buff[strlen(buff)-1] = '\0';
        if (strlen(buff) && (buff[strlen(buff)-1] == '\r'))
            buff[strlen(buff)-1] = '\0';

#define NAMESTR "ClientAuthname: "
#define PASSSTR "ClientPassword: "
        if (!strncmp(buff, NAMESTR, strlen(NAMESTR)))
            strcpy(uname, buff+sizeof(NAMESTR)-1);
        if (!strncmp(buff, PASSSTR, strlen(PASSSTR)))
            strcpy(pass, buff+sizeof(PASSSTR)-1);
    }
    if (!uname[0] || !pass[0])
        exit(3);

    /* got username and password, check if they're valid */
    retval=prism_auth(PA_SYSLOG | PA_DEBUG | PA_TGT, uname, pass,
"/services/server/news/.pgp/keytab", NULL, NULL, NULL);
    exit(retval);
}

here is my news.err file
Feb 26 17:01:21 overkill nnrpd[5055]: [ID 516902 news.warning] SERVER
perl filtering enabled
Feb 26 17:01:21 overkill nnrpd[5055]: [ID 781445 news.warning] starttls:
TLSv1 with cipher RC4-MD5 (128/128 bits) no authentication
Feb 26 17:01:21 overkill nnrpd[5055]: [ID 998472 news.warning]
batman.ns.gatech.edu connect
Feb 26 17:01:21 overkill nnrpd[5055]: [ID 561221 news.warning]
batman.ns.gatech.edu bad_auth
Feb 26 17:01:21 overkill nnrpd[5055]: [ID 452021 news.warning]
batman.ns.gatech.edu times user 0.260 system 0.010 elapsed 0.252
Feb 26 17:01:31 overkill nnrpd[5056]: [ID 516902 news.warning] SERVER
perl filtering enabled
Feb 26 17:01:31 overkill nnrpd[5056]: [ID 781445 news.warning] starttls:
TLSv1 with cipher RC4-MD5 (128/128 bits) no authentication
Feb 26 17:01:31 overkill nnrpd[5056]: [ID 998472 news.warning]
batman.ns.gatech.edu connect
Feb 26 17:01:31 overkill nnrpd[5056]: [ID 561221 news.warning]
batman.ns.gatech.edu bad_auth
Feb 26 17:01:31 overkill nnrpd[5056]: [ID 452021 news.warning]
batman.ns.gatech.edu times user 0.240 system 0.030 elapsed 0.247




Re: hacking inn with kerberos hooks
#50863
Author: Russ Allbery
Date: Mon, 26 Feb 2001 22:29
33 lines
2132 bytes
Russell Virgilio <russ@gatech.edu> writes:

> I need to add some kerberos hooks to  inn 2.3.1  I have inserted them
> into ckpasswd.c, and am using a return value of 0 for success, and
> anything else for failure.  I know my kerberos api is working, but I
> want to be sure there is nothing else I am missing in INN's process to
> validate user/pass.  When innd calls ckpasswd does it pass in the
> user/pass?

Yes.

> I am using the existing ckpasswd routines to parse user/pass, is this
> safe?

Probably.  Note that weirdness in the NNTP protocol means that this
probably won't work right for passwords containing spaces.

> Does Innd base it's authentication on the return value of ckpasswd?

In part; ckpasswd has to exit 0 and return a User:<user> string on stdout.

> here is my news.err file

If you add news.debug to your syslog.conf and send it to a good place, I
believe that you'll get more output about what the authentication stuff is
doing.

-- 
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: hacking inn with kerberos hooks
#50935
Author: Russ Allbery
Date: Sat, 03 Mar 2001 03:06
51 lines
2404 bytes
Russell Virgilio <russ@gatech.edu> writes:

> think i am very confused as to how readers.conf works beyond domain
> authentication.  Here is my readers.conf file.  I want to disable all
> access unless the user authenticates via user/pass.  Is this scheme
> reflected

> in my readers.conf?  I know it isn't and i'm not sure where my errors lie.

Combine these two:

> auth "no access" {
>     hosts: "*"
>     default: "<noaccess">
> }
> auth "authorized" {
>     hosts: "*"
>     auth: "ckpasswd"
>     default: "<authorized>"
> }

into just:

auth "general" {
    hosts: "*"
    auth: "ckpasswd"
    default: "<noaccess>"
}

That way, everyone who authenticates will get a real username and everyone
else will get the default of <noaccess>.  Then, for access groups, do:

> access full {
>         users: "*, !<noaccess>"
>         newsgroups: "*, !junk, !control, !control.*"
> }

> access fail {
>         users: "<noaccess>"
>         newsgroups: "!*"
> }

You want them in that order, since the last matching access group applies
(although the !<noaccess> bit should also help with that).

-- 
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.
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