1CKPASSWD(8)               InterNetNews Documentation               CKPASSWD(8)
2
3
4

NAME

6       ckpasswd - nnrpd password authenticator
7

SYNOPSIS

9       ckpasswd [-gs] [-d database] [-f filename] [-u username -p password]
10

DESCRIPTION

12       ckpasswd is the basic password authenticator for nnrpd, suitable for
13       being run from an auth stanza in readers.conf.  See readers.conf(5) for
14       more information on how to configure an nnrpd authenticator.
15
16       ckpasswd accepts a username and password from nnrpd and tells nnrpd(8)
17       whether that's the correct password for that username.  By default,
18       when given no arguments, it tries to check the password using PAM if
19       support for PAM was found when INN was built.  Failing that, it tries
20       to check the password against the password field returned by
21       getpwnam(3).  Note that these days most systems no longer make real
22       passwords available via getpwnam(3) (some still do if and only if the
23       program calling getpwnam(3) is running as root).
24
25       When using PAM, ckpasswd identifies itself as "nnrpd", not as
26       "ckpasswd", and the PAM configuration must be set up accordingly.  The
27       details of PAM configuration are different on different operating
28       systems (and even different Linux distributions); see EXAMPLES below
29       for help getting started, and look for a pam(7) or pam.conf(4) manual
30       page on your system.
31
32       When using any method other than PAM, ckpasswd expects all passwords to
33       be stored encrypted by the system crypt(3) function and calls crypt(3)
34       on the supplied password before comparing it to the expected password.
35       If you're using a different password hash scheme (like MD5), you must
36       use PAM.
37

OPTIONS

39       -d database
40           Read passwords from a database (ndbm or dbm format depending on
41           what your system has) rather than by using getpwnam(3).  ckpasswd
42           expects database.dir and database.pag to exist and to be a database
43           keyed by username with the encrypted passwords as the values.
44
45           While INN doesn't come with a program intended specifically to
46           create such databases, on most systems it's fairly easy to write a
47           Perl script to do so.  Something like:
48
49               #!/usr/bin/perl
50               use NDBM_File;
51               use Fcntl;
52               tie (%db, 'NDBM_File', '/path/to/database', O_RDWR|O_CREAT, 0640)
53                   or die "Cannot open /path/to/database: $!\n";
54               $| = 1;
55               print "Username: ";
56               my $user = <STDIN>;
57               chomp $user;
58               print "Password: ";
59               my $passwd = <STDIN>;
60               chomp $passwd;
61               my @alphabet = ('.', '/', 0..9, 'A'..'Z', 'a'..'z');
62               my $salt = join '', @alphabet[rand 64, rand 64];
63               $db{$user} = crypt ($passwd, $salt);
64               untie %db;
65
66           Note that this will echo back the password when typed; there are
67           obvious improvements that could be made to this, but it should be a
68           reasonable start.  Sometimes a program like this will be available
69           with the name dbmpasswd.
70
71           This option will not be available on systems without dbm or ndbm
72           libraries.
73
74       -f filename
75           Read passwords from the given file rather than using getpwnam(3).
76           The file is expected to be formatted like a system password file,
77           at least vaguely.  That means each line should look something like:
78
79               username:pdIh9NCNslkq6
80
81           (and each line may have an additional colon after the encrypted
82           password and additional data; that data will be ignored by
83           ckpasswd).  Lines starting with a number sign ("#") are ignored.
84           INN does not come with a utility to create the encrypted passwords,
85           but htpasswd (which comes with Apache) can do so and it's a quick
86           job with Perl (see the example script under -d).  If using Apache's
87           htpasswd program, be sure to give it the -d option so that it will
88           use crypt(3).
89
90       -g  Attempt to look up system group corresponding to username and
91           return a string like "user@group" to be matched against in
92           readers.conf.  This option is incompatible with the -d and -f
93           options.
94
95       -p password
96           Use password as the password for authentication rather than reading
97           a password using the nnrpd authenticator protocol.  This option is
98           useful only for testing your authentication system (particularly
99           since it involves putting a password on the command line), and does
100           not work when ckpasswd is run by nnrpd.  If this option is given,
101           -u must also be given.
102
103       -s  Check passwords against the result of getspnam(3) instead of
104           getpwnam(3).  This function, on those systems that supports it,
105           reads from /etc/shadow or similar more restricted files.  If you
106           want to check passwords supplied to nnrpd(8) against system account
107           passwords, you will probably have to use this option on most
108           systems.
109
110           Most systems require special privileges to call getspnam(3), so in
111           order to use this option you may need to make ckpasswd setgid to
112           some group (like group "shadow") or even setuid root.  ckpasswd has
113           not been specifically audited for such uses!  It is, however, a
114           very small program that you should be able to check by hand for
115           security.
116
117           This configuration is not recommended if it can be avoided, for
118           serious security reasons.  See "SECURITY CONSIDERATIONS" in
119           readers.conf(5) for discussion.
120
121       -u username
122           Authenticate as username.  This option is useful only for testing
123           (so that you can test your authentication system easily) and does
124           not work when ckpasswd is run by nnrpd.  If this option is given,
125           -p must also be given.
126

EXAMPLES

128       See readers.conf(5) for examples of nnrpd(8) authentication
129       configuration that uses ckpasswd to check passwords.
130
131       An example PAM configuration for /etc/pam.conf that tells ckpasswd to
132       check usernames and passwords against system accounts is:
133
134           nnrpd auth    required pam_unix.so
135           nnrpd account required pam_unix.so
136
137       Your system may want you to instead create a file named nnrpd in
138       /etc/pam.d with lines like:
139
140           auth    required pam_unix.so
141           account required pam_unix.so
142
143       This is only the simplest configuration.  You may be able to include
144       common shared files, and you may want to stack other modules, either to
145       allow different authentication methods or to apply restrictions like
146       lists of users who can't authenticate using ckpasswd.  The best guide
147       is the documentation for your system and the other PAM configurations
148       you're already using.
149
150       To test to make sure that ckpasswd is working correctly, you can run it
151       manually and then give it the username (prefixed with
152       "ClientAuthname:") and password (prefixed with "ClientPassword:") on
153       standard input.  For example:
154
155           (echo 'ClientAuthname: test' ; echo 'ClientPassword: testing') \
156               | ckpasswd -f /path/to/passwd/file
157
158       will check a username of "test" and a password of "testing" against the
159       username and passwords stored in /path/to/passwd/file.  On success,
160       ckpasswd will print "User:test" and exit with status 0.  On failure, it
161       will print some sort of error message and exit a non-zero status.
162

HISTORY

164       Written by Russ Allbery <rra@stanford.edu> for InterNetNews.
165
166       $Id: ckpasswd.pod 7674 2007-09-15 21:49:08Z iulius $
167

SEE ALSO

169       crypt(3), nnrpd(8), pam(7), readers.conf(5).
170
171       Linux users who want to use PAM should read the Linux-PAM System
172       Administrator's Guide at
173       http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/Linux-PAM_SAG.html
174       <http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/Linux-
175       PAM_SAG.html>.
176
177
178
179INN 2.5.2                         2010-08-11                       CKPASSWD(8)
Impressum