password file format ????

2 views
Skip to first unread message

Luc-Olivier Gouedart Lafeuille

unread,
Feb 18, 2003, 5:55:55 PM2/18/03
to
auth all {
auth: "ckpasswd -d /usr/local/news/db/newsusers"
auth: "ckpasswd -s"
}

access full {
users: *
newsgroups: *
}

I'm looking for the format of file where chpasswd look for access by
user and password.
I've scann many and many pages, contrib, messages in news but I've
never find out the solution.

Is someone can help me.

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.

Thanks,
Regards.

luc-o...@gouedart-lafeuille.net

Jeffrey M. Vinocur

unread,
Feb 18, 2003, 8:25:14 PM2/18/03
to
In article <b6f4115d.03021...@posting.google.com>,
Luc-Olivier Gouedart Lafeuille <luc-o...@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 <je...@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
je...@litech.org

Reply all
Reply to author
Forward
0 new messages