🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #64080

Re: password file format ????

#64080
From: Jeffrey M. Vinocur
Date: Wed, 19 Feb 2003 01:25
139 lines
4536 bytes
In article <b6f4115d.0302181455.5edf8ae9@posting.google.com>,
Luc-Olivier Gouedart Lafeuille <luc-olivier@gouedart-lafeuille.net> wrote:
>
>               auth: "ckpasswd -d /usr/local/news/db/newsusers"
>
>I'm looking for the format of file where chpasswd look for access by
>user and password.

Did you examine the ckpasswd manpage?


>My goal is only to run an innd for private news like in the old
>version with nnrp.access file where user name, password, access type,
>news wildcard and resolv reaching were set.

I have a script for converting nnrp.access to readers.conf:


#!/usr/bin/perl

# Written by Jeffrey M. Vinocur <jeff@litech.org>
# This work is hereby placed in the public domain by its author.

use strict;
use warnings;

my ($src, $passwd, $dst, $debug);

if(@ARGV == 1) {
    $src = shift;
    $passwd = 'passwd';
    $debug = 1;
} elsif(@ARGV == 3) {
    ($src, $passwd, $dst) = @ARGV;
    $debug = 0;
} else {
    usage();
}

my ($address, $access, $user, $pass, $groups);
my %passwords;
my @badsyntax;
my @duplicates;
my $OUT;

open(SRC, $src) or die "Could not open $src: $!\n";

if($debug) {
    $OUT = \*STDOUT;
} else {
    open(DST, ">$dst") or die "Could not open $dst: $!\n";
    $OUT = \*DST;
}

while(<SRC>) {
    chomp;
    next if /^\#/;
    s/\#.*//;
    ($address, $access, $user, $pass, $groups) = split /:/;
    unless (defined $groups) {
        push @badsyntax, $.;
        next;
    }

    # XXX - what exactly were the semantics of using
    # whitespace in user/pass to disable access?

    unless($user eq '') {
        push @duplicates, $. if defined $passwords{$user};
        $passwords{$user} = $pass;
    }

    print $OUT "auth \"$address\" {\n";
    print $OUT "    hosts: \"$address\"\n";
    print $OUT "    key: \"line$.\"\n";
    print $OUT "    auth: \"ckpasswd -f $passwd\"\n" unless $user eq '';
    print $OUT "}\n";
    print $OUT "access \"$address\" {\n";
    print $OUT "    key: \"line$.\"\n";
    print $OUT "    newsgroups: \"$groups\"\n";
    print $OUT "    access: \"$access\"\n";
    print $OUT "    users: \"$user\"\n" unless $user eq '';
    print $OUT "}\n\n";

}
close SRC;

srand($$^time);

# XXX - if $passwd exists, should we overwrite, append, or merge?
if(!$debug) {
    close $OUT;
    open(PASSWD, ">$passwd") or die "Could not open $passwd: $!\n";
    $OUT = \*PASSWD;
}
while (my ($user, $pass) = each %passwords) {
    $pass = crypt($pass, seedchar().seedchar());
    print $OUT "$user:$pass\n";
}
close PASSWD unless $debug;

print STDERR "Had trouble with syntax on line", 
             @badsyntax > 1 ? 's ' : ' ',
             join(", ", @badsyntax), ".\n"
    if @badsyntax;

print STDERR "Found username duplication on line",
             @duplicates > 1 ? 's ' : ' ',
             join(", ", @duplicates), ".\n"
    if @duplicates;


sub seedchar {  # from Randal Schwarz
    ('a'..'z','A'..'Z','0'..'9','.','/')[rand(64)];
}

sub usage {
    print STDERR << "__END__";
Usage:

$0 <nnrp.access file> [<passwd file> <readers.conf file>]

Use $0 to convert an old-style nnrp.access file to readers.conf 
format.  All unique user/password pairs from the nnrp.access file are 
placed in the passwd file (in format suitable for ckpasswd).

If the second and third arguments are missing, everything is 
printed instead to stdout for examination purposes.

__END__

exit 1;

}

-- 
Jeffrey M. Vinocur
jeff@litech.org
Technical Details
Message-ID: <b2umdq$440$2@puck.litech.org>
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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.litech.org!not-for-mail
References: <b6f4115d.0302181455.5edf8ae9@posting.google.com>

Show Full Headers
Complete Article Headers
Message-ID: <b2umdq$440$2@puck.litech.org>
Subject: Re: password file format ????
Date: Wed, 19 Feb 2003 01:25:14 +0000
From: jeff@litech.org (Jeffrey M. Vinocur)
References: <b6f4115d.0302181455.5edf8ae9@posting.google.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!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.litech.org!not-for-mail
Newsgroups: news.software.nntp
Organization: Litech Systems Design
Lines: 138
Sender: jeff@litech.org
NNTP-Posting-Host: 66.218.0.75
X-Trace: puck.litech.org 1045617914 4224 66.218.0.75 (19 Feb 2003 01:25:14 GMT)
X-Complaints-To: usenet@litech.org
NNTP-Posting-Date: Wed, 19 Feb 2003 01:25:14 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: jeff@litech.org (Jeffrey M. Vinocur)