summaryrefslogtreecommitdiffstats
path: root/base/java-tools/man/man1/pki.1
blob: 9e174e11fd2f88558dab421cb5ec87c8a6508622 (plain)
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH pki 1 "May 5, 2014" "version 10.2" "PKI Command-Line Interface (CLI)" Dogtag Team
.\" Please adjust this date whenever revising the man page.
.\"
.\" Some roff macros, for reference:
.\" .nh        disable hyphenation
.\" .hy        enable hyphenation
.\" .ad l      left justify
.\" .ad b      justify to both left and right margins
.\" .nf        disable filling
.\" .fi        enable filling
.\" .br        insert line break
.\" .sp <n>    insert n+1 empty lines
.\" for man page specific macros, see man(7)
.SH NAME
pki \- Command-Line Interface for accessing Certificate System services.

.SH SYNOPSIS
\fBpki\fR [CLI options] <command> [command arguments]

.SH DESCRIPTION
.PP
The \fBpki\fR command provides a command-line interface allowing clients to access various services on the Certificate System server.
These services include certificates, groups, keys, security domains, and users.
  
.SH CLI OPTIONS
.TP
.B -c <client security database password>
Specifies the client security database password (mutually exclusive to the '-C' option).
.TP
.B -C <client-side password file>
Specifies the file which contains the client security database password (mutually exclusive to the '-c' option).
.TP
.B -d <client security database location>
Specifies the client security database location (default: \fI~/.dogtag/nssdb\fP).
.TP
.B -h <hostname>
Specifies the hostname (default: hostname of the local machine).
.TP
.B --help
Prints additional help information.
.TP
.B --ignore-cert-status <list>
Comma-separated list of ignored certificate validity statuses.
.TP
.B --message-format <format>
Message format: xml (default), json.
.TP
.B -n <client certificate nickname>
Specifies the nickname for client certificate authentication (mutually exclusive to the '-u' option). This authentication requires a security database password.
.TP
.B --output <folder>
Folder to store HTTP messages.
.TP
.B -P <protocol>
Specifies the protocol (default: http).
.TP
.B -p <port>
Specifies the port (default: 8080).
.TP
.B --reject-cert-status <list>
Comma-separated list of rejected certificate validity statuses.
PKI subsystem type - [CA, KRA, OCSP, TKS, or TPS] (non-case-sensitive).
.TP
.B -U <URI>
Specifies the server URI.
.TP
.B -u <username>
Specifies the username for basic authentication (mutually exclusive to the '-n' option). This authentication requires a user password.
.TP
.B -v
Displays verbose information.
.TP
.B --version
Displays CLI version information.
.TP
.B -w <password>
Specifies the user password (mutually exclusive to the '-W' option).
.TP
.B -W <client-side password file>
Specifies the file which contains the user password (mutually exclusive to the '-w' option).

.SH OPERATIONS
To view available commands and options, simply type \fBpki\fP.  Some commands have sub-commands.
To view the sub-commands, type \fBpki <command>\fP.
To view each command's usage, type \fB pki <command> \-\-help\fP.

A client security database is needed to execute commands that require SSL connection or client certificate
for authentication. See \fBpki-client\fR(1) for more information.

.SS Connection
By default, the CLI connects to a server running on the local machine via the non-secure HTTP port 8080.  To specify a different server location, use the appropriate arguments to give a different host (\fB-h\fP), port (\fB-p\fP), or connection protocol (\fB-P\fP).

.B pki -P <protocol> -h <hostname> -p <port> <command>

Alternatively, the connection parameters can be specified as a URI:

.B pki -U <URI> <command>

where the URI is of the format \fI<protocol>://<hostname>:<port>\fP.

.SS Authentication
Some commands require authentication.  These are commands that are restricted to particular sets of users (such as agents or admins) or those operations involving certificate profiles that require authentication.

To execute a command without authentication:

.B pki <command>

To execute a command using basic authentication (i. e. - username/password), see the \fBBasic Authentication\fP section of this man page.

To execute a command using client authentication (i. e. - client certificate), see the \fBClient Authentication\fP section of this man page.

.SS Basic Authentication
To authenticate with a username and password:

.B pki -u <username> -w <password> <command>

Rather than being exposed in plaintext on the command-line, user passwords may be stored in a file instead.  See \fBClient-side Password Files\fR for detailed information.

To authenticate with a username by obtaining the user password from a client-side password file:

.B pki -u <username> -W <client-side password file> <command>

Finally, if a username has been specified on the command-line, and neither the '-W <client-side password file>' nor the '-w <password>' options have been utilized, the password will be prompted for.

To authenticate with a username by interactively prompting for a password:

.B pki -u <username> <command>

\fBNote:\fP
Prompting for a user password is not suitable for automated batch processing.

.SS Client Authentication Setup
A client certificate associated with the desired PKI server must be used for client authentication. This can be done by importing the client certificate into an NSS security database and passing the values to the relevant options provided by the \fBpki\fP CLI framework.

To achieve this, execute the following commands to set up an NSS security database for use by the \fBpki\fP client, import the client certificate into the NSS database, and list information (including the nickname of the client certificate) stored in the NSS database:

.B    - certutil -N -d <CERT_DB_DIR_PATH>

.B    - pk12util -i <Agent_Cert_P12_FILE_PATH> -d <CERT_DB_DIR_PATH>

.B    - certutil -L -d <CERT_DB_DIR_PATH>

The first command creates a client security database, and asks the client user to enter a password for this NSS database.

The second command imports a client certificate stored in a PKCS12 format into this NSS database; it prompts for the passwords of the PKCS12 file and the client security database.  The simplist example of such a client certificate is to obtain the administrator certificate created during the configuration portion of the basic PKI installation of the associated PKI server (e. g. - located at \fI/root/.dogtag/pki-tomcat/ca_admin_cert.p12\fP on the PKI server machine).

The third command shows the information about the imported client certificate (including its nickname).

\fBNote:\fP
When issuing the first \fBpki\fP command using the authentication parameters (after completion of the setup of the client security database), a user may be greeted with a warning message which indicates that an untrusted issuer was encountered.  Simply reply 'Y' to import the CA certificate, and, presuming that the displayed CA server URL is valid, press the carriage return.

.SS Client Authentication
To authenticate with a client certificate:

.B pki -d <client security database location> -c <client security database password> -n <client certificate nickname> <command>
    
Alternatively, to prevent exposure via the command-line, a client security database may store their password in a file instead. See \fBClient-side Password Files\fR for detailed information.

To authenticate with a client certificate by obtaining the client security database password from a client-side password file:

.B pki -d <client security database location> -C <client-side password file> -n <client certificate nickname> <command>

Finally, if a client certificate has been specified on the command-line, and neither the '-C <client-side password file>' nor the '-c <client security database password>' options have been utilized, the client security database password will be prompted for.

To authenticate with a client certificate by interactively prompting for a client security database password:

.B pki -d <client security database location> -n <client certificate nickname> <command>

\fBNote:\fP
Prompting for a client security database password is not suitable for automated batch processing.

.SS Client-side Password Files

Both the '-C' (client authentication) and the '-W' (basic authentication) options require the use of a client-side password file.

For security purposes, client-side password files should be, at a minimum, operating system protected non-world readable files.

Client-side password files generally store a password in an equals-sign-delimited plaintext format 'token=password' (e. g. - 'internal=foobar' where 'internal' is the token, '=' is the delimiter, and 'foobar' is the actual password).  The token keyword 'internal' is the default specification for a token, and refers to the "Internal Key Storage Token".  If a client-side password file is being used for the sole purposes of the \fBpki\fR command-line tool, a client-side password file also supports the format that merely consists of the plaintext password on a single line (read the \fBCaveats\fP which follow).

\fBCaveats:\fP
.IP
\(bu Since client-side password files are allowed to use the 'token=password' format, the first '=' character can only be used as a delimiter (i. e. - it cannot be used as a valid character within the 'token' name) as escaping the '=' character within a token is not supported.

\(bu When specifying a password which contains an '=' character, always specify an initial '=' prior to specifying the actual password (mandatory when no token has been specified) as escaping the '=' character within a password is not supported.

\(bu Tokens do not support leading or trailing whitespace since these characters are stripped prior to their use; however, all whitespace inside tokens will be preserved.

\(bu Passwords preserve all leading, trailing, and internal whitespace since passwords are not trimmed prior to their use.

\(bu TBD: Supply code to handle the case of a non-internal token (e. g. - 'hardware-nethsm' utilized in the following examples) since the current code ignores the specified token (i. e. - it always utilizes the default 'internal' token no matter what is currently specified).

\(bu TBD: Allow numerous 'token=password' lines in a single client-side password file to support the ability to authenticate against specified tokens as well as multiple tokens.

.PP
\fBValid examples include:\fP

.B internal=foobar
   where:  token="internal", password="foobar"

.B hardware-nethsm=foobar
   where:  token="hardware-nethsm" (ignored - TBD), password="foobar"

.B internal=ack=bar
   where:  token="internal", password="ack=bar"

.B hardware-nethsm=ack=bar
   where:  token="hardware-nethsm" (ignored - TBD), password="ack=bar"

.B =foobar
   where:  token="internal" (default), password="foobar"

.B =foo=bar
   where:  token="internal" (default), password="foo=bar"
           (Since the password contains an '=' character,
            an initial '=' character must be specified!)

.B foobar
   where:  token="internal" (default), password="foobar"

.SH FILES
.I /usr/bin/pki

.SH SEE ALSO
.PP
\fBpki-cert\fR(1)
.RS 4
Certificate management commands
.RE

.PP
\fBpki-client\fR(1)
.RS 4
Client security database management commands
.RE

.PP
\fBpki-group\fR(1)
.RS 4
Group management commands
.RE

.PP
\fBpki-group-member\fR(1)
.RS 4
Group member management commands
.RE

.PP
\fBpki-key\fR(1)
.RS 4
Key management commands
.RE

.PP
\fBpki-securitydomain\fR(1)
.RS 4
Security domain management commands
.RE

.PP
\fBpki-user\fR(1)
.RS 4
User management commands
.RE

.PP
\fBpki-user-cert\fR(1)
.RS 4
User certificate management commands
.RE

.PP
\fBpki-ca-profile\fR(1)
.RS 4
Profile management commands
.RE

.SH AUTHORS
Ade Lee <alee@redhat.com>, Endi Dewata <edewata@redhat.com>, and Matthew Harmsen <mharmsen@redhat.com>.

.SH COPYRIGHT
Copyright (c) 2012 Red Hat, Inc. This is licensed under the GNU General Public License, version 2 (GPLv2). A copy of this license is available at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.