1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
.\" $OpenBSD: dbmmanage.1,v 1.11 2008/06/07 01:59:36 jdixon Exp $
.\"
.\" ====================================================================
.\" The Apache Software License, Version 1.1
.\"
.\" Copyright (c) 2000-2003 The Apache Software Foundation. All rights
.\" reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\"
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\"
.\" 3. The end-user documentation included with the redistribution,
.\" if any, must include the following acknowledgment:
.\" "This product includes software developed by the
.\" Apache Software Foundation (http://www.apache.org/)."
.\" Alternately, this acknowledgment may appear in the software itself,
.\" if and wherever such third-party acknowledgments normally appear.
.\"
.\" 4. The names "Apache" and "Apache Software Foundation" must
.\" not be used to endorse or promote products derived from this
.\" software without prior written permission. For written
.\" permission, please contact apache@apache.org.
.\"
.\" 5. Products derived from this software may not be called "Apache",
.\" nor may "Apache" appear in their name, without prior written
.\" permission of the Apache Software Foundation.
.\"
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
.\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\" ====================================================================
.\"
.\" This software consists of voluntary contributions made by many
.\" individuals on behalf of the Apache Software Foundation. For more
.\" information on the Apache Software Foundation, please see
.\" <http://www.apache.org/>.
.\"
.\" Portions of this software are based upon public domain software
.\" originally written at the National Center for Supercomputing Applications,
.\" University of Illinois, Urbana-Champaign.
.\"
.Dd $Mdocdate: June 7 2008 $
.Dt DBMMANAGE 1
.Os
.Sh NAME
.Nm dbmmanage
.Nd create and update user authentication files in DBM format
.Sh SYNOPSIS
.Nm
.Ar filename
.Op Ar command
.Op Ar username Op Ar encpassword
.Sh DESCRIPTION
.Nm
is used to create and update the DBM format files used to store
usernames and passwords for basic authentication of HTTP users.
Resources available from the
.Xr httpd 8
Apache web server can be restricted to just the users listed
in the files created by
.Nm .
This program can only be used when the usernames are stored in a DBM file.
To use a flat-file database see
.Xr htpasswd 1 .
.Pp
This manual page only lists the command line arguments.
For details of the directives necessary to configure user authentication in
.Xr httpd 8 ,
see
the Apache manual, which can be found in
.Pa /usr/share/doc/html/httpd/ .
.Pp
The options are as follows:
.Bl -tag -width "encpasswordXX"
.It Ar command
This selects the operation to perform:
.Bl -tag -width "adduserXX"
.It Ic add
Add an entry for
.Ar username
to
.Ar filename
using the encrypted password
.Ar encpassword .
.It Ic adduser
Ask for a password and then add an entry for
.Ar username
to
.Ar filename .
.It Ic check
Ask for a password and then check if
.Ar username
is in
.Ar filename
and if its password matches the specified one.
.It Ic delete
Delete the
.Ar username
entry from
.Ar filename .
.It Ic import
Read username:password entries (one per line) from stdin and add them to
.Ar filename .
The password already has to be encrypted.
.It Ic update
Same as the
.Ic adduser
command, except that it makes sure
.Ar username
already exists in
.Ar filename .
.It Ic view
Just display the complete contents of the DBM file.
.El
.It Ar encpassword
The password to be encrypted.
.It Ar filename
The filename of the DBM format file.
Usually without the extension .db, .pag, or .dir.
.It Ar username
The user for which the update operation is performed.
.El
.Sh SEE ALSO
.Xr htdigest 1 ,
.Xr htpasswd 1 ,
.Xr httpd 8
.Sh BUGS
One should be aware that there are a number of different DBM file
formats in existence, and with all likelihood, libraries for more than
one format may exist on your system.
The three primary examples are NDBM, the GNU project's GDBM,
and Berkeley DB 2.
Unfortunately, all these libraries use different file formats,
and you must make sure that the file format used by
.Ar filename
is the same format that
.Nm
expects to see.
.Nm
currently has no way of determining what type of DBM file it is
looking at.
If used against the wrong format,
.Nm
will simply return nothing, or may create a different DBM file with a
different name, or at worst, it may corrupt the DBM file if you were
attempting to write to it.
.Pp
.Nm
has a list of DBM format preferences, defined by the
.Dq @AnyDBM::ISA
array near the beginning of the program.
Since we prefer the Berkeley DB 2 file format, the order in which
.Nm
will look for system libraries is Berkeley DB 2, then NDBM, and then GDBM.
The first library found will be the library
.Nm
will attempt to use for all DBM file transactions.
This ordering is slightly different than the standard
.Dq @AnyDBM::ISA
ordering in
.Xr perl 1 ,
as well as the ordering used by the simple
.Fn dbmopen
call in perl,
so if you use any other utilities to manage your DBM files,
they must also follow this preference ordering.
Similar care must be taken if using programs in other languages,
like C,
to access these files.
.Pp
.Xr httpd 8 Ns 's
.Pa mod_auth_db.c
module corresponds to the Berkeley DB 2 library, while
.Pa mod_auth_dbm.c
corresponds to the NDBM library.
Also, one can usually use the
.Xr file 1
program supplied with most
.Ux
systems to see what format a DBM file is in.
|