🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #50938

Re: Setting up authentications

#50938
From: Russ Allbery
Date: Sat, 03 Mar 2001 05:55
64 lines
3662 bytes
Rebecca Ore <rebecca@ogoense.net> writes:

> I'd like to be able to set up accounts for users who log on with user
> name and password.  I think I understand how to set up readers.conf
> properly (using Russ's example posted tonight), but I'm not quite sure
> how to set up the name/password database that INN will be consulting.
> I've got NetBSD as the OS.

There's better documentation in the ckpasswd(8) man page in current stable
snapshots:

OPTIONS
   -d database
       Read passwords from a database (ndbm or dbm format depending on what
       your system has) rather than by using getpwnam(3).  ckpasswd expects
       database.dir and database.pag to exist and to be a database keyed by
       username with the encrypted passwords as the values.

       While INN doesn't come with a program intended specifically to create
       such databases, on most systems it's fairly easy to write a Perl
       script to do so.  Something like:

           #!/usr/bin/perl
           use NDBM_File;
           use Fcntl;
           tie (%db, 'NDBM_File', '/path/to/database', O_RDWR | O_CREAT, 0640)
               or die "Cannot open /path/to/database: $!\n";
           $| = 1;
           print "Username: ";
           my $user = <STDIN>;
           chomp $user;
           print "Password: ";
           my $passwd = <STDIN>;
           chomp $passwd;
           my @alphabet = ('.', '/', 0..9, 'A'..'Z', 'a'..'z');
           my $salt = join '', @alphabet[rand 64, rand 64];
           $db{$user} = crypt ($passwd, $salt);
           untie %db;

       Note that this will echo back the password when typed; there are
       obvious improvements that could be made to this, but it should be a
       reasonable start.

       This option will not be available on systems without dbm or ndbm
       libraries.

   -f filename
       Read passwords from the given file rather than using getpwnam(3).
       The file is expected to be formatted like a system password file, at
       leat vaguely.  That means each line should look something like:

           username:pdIh9NCNslkq6

       (and each line may have an additional colon after the encrypted
       password and additional data; that data will be ignored by ckpasswd).
       INN does not come with a utility to create the encrypted passwords,
       but it's a quick job with Perl (see the example script under -d).

-- 
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.
Technical Details
Message-ID: <yln1b3pfb8.fsf@windlord.stanford.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!supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!ucberkeley!hammer.uoregon.edu!feed.textport.net!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail
References: <m3n1b3s8t4.fsf@pyrophore.ogoense.net>

Show Full Headers
Complete Article Headers
Message-ID: <yln1b3pfb8.fsf@windlord.stanford.edu>
Subject: Re: Setting up authentications
Date: Sat, 03 Mar 2001 05:55:07 +0000
From: Russ Allbery <rra@stanford.edu>
References: <m3n1b3s8t4.fsf@pyrophore.ogoense.net>
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!supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!ucberkeley!hammer.uoregon.edu!feed.textport.net!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail
Newsgroups: news.software.nntp
Organization: The Eyrie
Lines: 63
NNTP-Posting-Host: windlord.stanford.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.Stanford.EDU 983598907 3960 171.64.13.23 (3 Mar 2001 05:55:07 GMT)
X-Complaints-To: news@news.stanford.edu
User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)