require 'test/unit' class TestEnv < Test::Unit::TestCase IGNORE_CASE = /djgpp|bccwin|mswin|mingw/ =~ RUBY_PLATFORM def setup @backup = ENV['test'] @BACKUP = ENV['TEST'] ENV['test'] = nil ENV['TEST'] = nil end def teardown ENV['test'] = @backup ENV['TEST'] = @BACKUP end def test_bracket assert_nil(ENV['test']) assert_nil(ENV['TEST']) ENV['test'] = 'foo' assert_equal('foo', ENV['test']) if IGNORE_CASE assert_equal('foo', ENV['TEST']) else assert_nil(ENV['TEST']) end ENV['TEST'] = 'bar' assert_equal('bar', ENV['TEST']) if IGNORE_CASE assert_equal('bar', ENV['test']) else assert_equal('foo', ENV['test']) end assert_raises(TypeError) { tmp = ENV[1] } assert_raises(TypeError) { ENV[1] = 'foo' } assert_raises(TypeError) { ENV['test'] = 0 } end def test_has_value val = 'a' val.succ! while ENV.has_value?(val) && ENV.has_value?(val.upcase) ENV['test'] = val[0...-1] assert_equal(false, ENV.has_value?(val)) assert_equal(false, ENV.has_value?(val.upcase)) ENV['test'] = val assert_equal(true, ENV.has_value?(val)) assert_equal(false, ENV.has_value?(val.upcase)) ENV['test'] = val.upcase assert_equal(false, ENV.has_value?(val)) assert_equal(true, ENV.has_value?(val.upcase)) end def test_index val = 'a' val.succ! while ENV.has_value?(val) && ENV.has_value?(val.upcase) ENV['test'] = val[0...-1] assert_nil(ENV.index(val)) assert_nil(ENV.index(val.upcase)) ENV['test'] = val if IGNORE_CASE assert_equal('TEST', ENV.index(val).upcase) else assert_equal('test', ENV.index(val)) end assert_nil(ENV.index(val.upcase)) ENV['test'] = val.upcase assert_nil(ENV.index(val)) if IGNORE_CASE assert_equal('TEST', ENV.index(val.upcase).upcase) else assert_equal('test', ENV.index(val.upcase)) end end end on> Unnamed repository; edit this file 'description' to name the repository.Endi Dewata
summaryrefslogtreecommitdiffstats
path: root/base/server/man/man8/pkispawn.8
blob: df7d5ca7da00c8f48160275e221a5fbe5fb2dfb6 (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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
.\" 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 pkispawn 8 "December 13, 2012" "version 1.0" "PKI Instance Creation Utility" Ade Lee
.\" 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
pkispawn \- Sets up an instance of Certificate Server.

.SH SYNOPSIS
pkispawn \-s <subsystem> \-f <config_file> [\-h] [\-v] [\-p <prefix>]

.SH DESCRIPTION
Sets up an instance of Certificate Server.  This utility creates any of the Java-based Certificate Server subsystems (CA, KRA, OCSP, and TKS). 
.TP
\fBNote:\fP 
A 389 Directory Server instance must be configured and running before this script can be run. Certificate Server requires an internal directory database. The default configuration assumes a Directory Server instance running on the same machine on port 389.  For more information on creating a Directory Server instance, see
.B setup-ds.pl(8).
.PP
An instance can contain multiple subsystems, although it may contain at most one of each type of subsystem on a single machine.  So, for example, an instance could contain CA and KRA subsystems,  but not two CA subsystems.  To create an instance with a CA and a KRA, simply run pkispawn twice, with values 
.I -s CA 
and 
.I -s KRA 
respectively.
.PP
The instances are created based on values for configuration parameters in the default configuration (/etc/pki/default.cfg) and the user-provided configuration file.  The user-provided configuration file is read after the default configuration file, so any parameters defined in that file will override parameters in the default configuration file.  In general, most users will store only those parameters which are different from the default configuration in their user-provided configuration file.
.PP
This configuration file contains directives that are divided into sections for different subsystem types (such as [DEFAULT], [CA], and [KRA]).  These sections are stacked, so that parameters read in earlier sections can be overwritten by parameters in later sections.  For the Java subsystems (CA, KRA, OCSP and TKS), the sections read are [DEFAULT], [Tomcat] and the subsystem-type section ([CA], [KRA], [OCSP], or [TKS]), in that order.  This allows the ability to specify parameters to be shared by all subsystems in [DEFAULT] or [Tomcat], and system-specific upgrades in the [CA], [KRA], and other sections.
.TP
\fBNote:\fP
Any non-password related parameter values in the configuration file that needs to contain a \fB%\fP character must be properly escaped.  For example, a value of \fBfoo%bar\fP would be specified as \fBfoo%%bar\fP in the configuration file.
.PP
At a minimum, the user-defined configuration file must provide some passwords needed for the install.  An example configuration file is provided in the 
.B EXAMPLES
section below.  For more information on the default configuration file and the parameters it contains (and can be customized), see
.B pki_default.cfg(5).
.PP
The \fBpkispawn\fP run creates several different installation files that can be referenced later, if need be:
.IP
* For Tomcat-based instances, a Tomcat instance is created at \fT/var/lib/pki/<pki_instance_name>\fP, where pki_instance_name is defined in the configuration file.  
.IP
* A log file of \fBpkispawn\fP operations is written to \fI/var/log/pki/pki-<subsystem>-spawn.<timestamp>.log\fP.  
.IP
* A .p12 (PKCS #12) file containing a certificate for a subsystem administrator is stored in pki_client_dir. 
.PP
When the utility is done running, the CA can be accessed by pointing a browser to https://<hostname>:<pki_https_port>/. The agent pages can be accessed by importing the CA certificate and administrator certificate into the browser. 
.PP
The Certificate Server instance can also be accessed using the \fBpki\fP command line interface.  See 
\fBpki(1)\fP. For more extensive documentation on how to use Certificate Server features, see the Red Hat Certificate System Documentation at https://access.redhat.com/knowledge/docs/Red_Hat_Certificate_System/.
.PP
Instances created using \fBpkispawn\fP can be removed using \fBpkidestroy\fP.  See
.BR pkidestroy(8).
.PP
\fBpkispawn\fP supersedes and combines the functionality of \fBpkicreate\fP and \fBpkisilent\fP, which were available in earlier releases of Certificate Server.  It is now possible to completely create and configure the Certificate Server subsystem in a single step using \fBpkispawn\fP.
.TP
\fBNote:\fP 
Previously, as an alternative to using \fBpkisilent\fP to perform a non-interactive batch configuration, a PKI instance could be interactively configured by a GUI-based configuration wizard via a Firefox browser.  GUI-based configuration of a PKI instance is unavailable in this version of the product.
.SH OPTIONS
.TP
.B -s <subsystem>
Specifies the subsystem to be installed and configured, where <subsystem> is CA, KRA, OCSP, or TKS.
.TP
.B -f <config_file>
Specifies the path to the user-defined configuration file.  This file contains differences between the default configuration and the custom configuration.
.TP
.B -h, --help
Prints additional help information.
.TP
.B -v
Displays verbose information about the installation.  This flag can be provided multiple times to increase verbosity.  See
.B pkispawn -h 
for details.

.SH INTERACTIVE MODE
.PP
If no options are specified, pkispawn will provide an interactive menu to collect the parameters needed to install
the Certificate Server instance.  Note that only the most basic installation options are provided.  This includes root CAs,
KRAs, OCSPs and TKS, connecting to the LDAP port of a directory server.  More complicated setups such as: cloned subsystems, subordinate or externally signed CAs, subsystems that connect to the directory server using LDAPS, and subsystems that are customized beyond the options described below -  require the use of a configuration file with the
\-f option.
.PP
The interactive option is most useful for those users getting familiar with Certificate Server.  The parameters collected are
written to the installation file of the subsystem, which can be found at \fB/etc/sysconfig/pki/tomcat/<instance name>/<subsystem>/deployment.cfg.\fP
.PP
The following parameters are queried interactively during the installation process:
.PP
\fBSubsystem Type\fP
.TP
\fISubsystem (CA/KRA/OCSP/TKS):\fP
the type of subsystem to be installed. Prompted when the \-s option is not specified.  The default value chosen is CA.
.PP
\fBInstance Specific Parameters\fP
.TP
\fIInstance name:\fP
the name of the tomcat instance in which the subsystem is to be installed. The default value is pki-tomcat.
.br
\fBNote:\fP Only one subsystem of a given type (CA, KRA, OCSP, TKS) can exist within a given instance.
.TP
\fIHTTP port:\fP
the HTTP port of the Tomcat instance. The default value is 8080.
.TP
\fISecure HTTP port:\fP
the HTTPS port of the Tomcat instance. The default value is 8443.
.TP
\fIAJP port:\fP
the AJP port of the Tomcat instance. The default value is 8009.
.TP
\fIManagement port:\fP
the management port of the Tomcat instance. The default value is 8005.
.TP
\fBNote:\fP When deploying a new subsystem into an existing instance, pkispawn will attempt to read the ports from \fBdeployment.cfg\fP files stored for previously installed subsystems for this instance.  If successful, the installer will not prompt for these ports. 
.PP
\fBAdministrative User Parameters\fP
.TP
\fIUsername:\fP
the username of the administrator of this subsystem. The default value is <ca/kra/tks/ocsp>admin.
.TP
\fIPassword:\fP
password for the administrator user.
.TP
\fIImport certificate:\fP
An optional parameter that can be used to import an already available CA admin certificate into this instance.
.TP
\fIExport certificate:\fP
setup the path where the admin certificate of this <subsystem> should be stored. The default value is $HOME/.dogtag/pki-tomcat/<ca/kra/ocsp/tks>_admin.cert.
.PP
\fBDirectory Server Parameters\fP
.TP
\fIHostname:\fP
Hostname of the directory server instance.  The default value is the hostname of the system.
.TP
\fIUse a secure LDAPS connection?\fP
Answering yes to this question will cause prompts for \fISecure LDAPS Port:\fP and \fIDirectory Server CA certificate pem file:\fP.  Answering no to this question will cause a prompt for \fILDAP Port\fP.  The initial default value for this question is no.
.TP
\fISecure LDAPS Port:\fP
Secure LDAPS port for the directory server instance. The default value is 636.
.TP
\fIDirectory Server CA certificate pem file:\fP
The fully-qualified path including the filename of the file which contains an exported copy of the Directory Server's CA certificate (e. g. - $HOME/dscacert.pem).  This file must exist prior to \fBpkispawn\fP being able to utilize it.  For details on creation of this file see the
.B EXAMPLES
section below entitled
.B Installing a CA connecting securely to a Directory Server via LDAPS.
.
.TP
\fILDAP Port:\fP
LDAP port for the directory server instance. The default value is 389.
.TP
\fIBase DN:\fP
the Base DN to be used for the internal database for this subsystem. The default value is o=pki-tomcat-<subsystem>.
.TP
\fIBind DN:\fP
the bind DN required to connect for the directory server. This user must have sufficient permissions to install the required schema and database.  The default value is cn=Directory Manager.
.TP
\fIPassword:\fP
password for the bind DN.
.PP
\fBSecurity Domain Parameters\fP
.TP
\fIName:\fP
the name of the security domain. Required only if installing a root CA. Default value: <DNS domain name> Security Domain.
.TP
\fIHostname:\fP
the hostname for the security domain CA. Required only for non-CA subsystems. The default value is the hostname of this system.
.TP
\fISecure HTTP port:\fP
the https port for the security domain. Required only for non-CA subsystems. The default value is 8443.
.TP
\fIUsername:\fP
the username of the security domain administrator of the CA. Required only for non-CA subsystems. The default value is caadmin.
.TP
\fIPassword:\fP
password for the security domain administrator. Required for all subsystems that are not root CAs.

.SH EXAMPLES

.SS Installing a root CA
.BR
.PP
To install a root CA in a new instance execute the following command:

.IP
\x'-1'\fBpkispawn \-s CA \-f myconfig.txt\fR

.PP
where \fImyconfig.txt\fP contains the following text:

.IP
.nf
[DEFAULT]
pki_admin_password=\fISecret123\fP
pki_client_pkcs12_password=\fISecret123\fP
pki_ds_password=\fISecret123\fP
.fi

.PP
Prior to running this command, a Directory Server instance should be created
and running. This command assumes that the Directory Server instance is using
its default configuration:

.IP
* Installed on the local machine

.IP
* Listening on port 389 

.IP
* The user is cn=Directory Manager, with the password specified in pki_ds_password

.PP
This invocation of \fBpkispawn\fP creates a Tomcat instance containing a CA
running on the local machine with secure port 8443 and unsecure port 8080.
To access this CA, simply point a browser to https://<hostname>:8443.

.PP
The instance name (defined by pki_instance_name) is pki-tomcat, and it is
located at \fI/var/lib/pki/pki-tomcat\fP. Logs for the instance are located
at \fI/var/log/pki/pki-tomcat\fP, and an installation log is written to
\fI/var/log/pki/pki-<subsystem>-spawn.<timestamp>.log\fP.

.PP
A PKCS #12 file containing the administrator certificate is created in
\fI$HOME/.dogtag/pki-tomcat\fP. This PKCS #12 file uses the password
designated by pki_client_pkcs12_password in the configuration file.

.PP
To access the agent pages, first import the CA certificate by accessing the CA
End Entity Pages and clicking on the Retrieval Tab. Be sure to trust the CA
certificate. Then, import the administrator certificate in the PKCS #12 file.

.SS Installing a root CA using ECC
.BR
.PP
To install a root CA in a new instance using ECC execute the following command:

.IP
\x'-1'\fBpkispawn \-s CA \-f myconfig.txt\fR

.PP
where \fImyconfig.txt\fP contains the following text:

.IP
.nf
[DEFAULT]
pki_admin_password=\fISecret123\fP