forked from dogtagpki/pki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pki.spec
1634 lines (1356 loc) · 51.6 KB
/
pki.spec
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
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
################################################################################
Name: pki
################################################################################
%global vendor dogtag
%global brand Dogtag
Summary: %{brand} PKI Package
URL: http://www.dogtagpki.org/
# The entire source code is GPLv2 except for 'pki-tps' which is LGPLv2
License: GPLv2 and LGPLv2
Version: 10.7.1
Release: 1%{?_timestamp}%{?_commit_id}%{?dist}
# global _phase -a1
# To create a tarball from a version tag:
# $ git archive \
# --format=tar.gz \
# --prefix pki-<version>/ \
# -o pki-<version>.tar.gz \
# <version tag>
Source: https://github.com/dogtagpki/pki/archive/v%{version}%{?_phase}/pki-%{version}%{?_phase}.tar.gz
# To create a patch for all changes since a version tag:
# $ git format-patch \
# --stdout \
# <version tag> \
# > pki-VERSION-RELEASE.patch
# Patch: pki-VERSION-RELEASE.patch
################################################################################
# NSS
################################################################################
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 27
%global nss_default_db_type dbm
%else
%global nss_default_db_type sql
%endif
################################################################################
# Python
################################################################################
# Python 2 packages
%if 0%{!?with_python2:1}
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 28
%global with_python2 1
%else
# no python2
%endif
%endif
# Python 3 packages
%if 0%{!?with_python3:1}
%if 0%{?rhel} && 0%{?rhel} <= 7
# no python3
%else
%global with_python3 1
%endif
%endif
# Use Python 3 for all commands?
%if 0%{!?with_python3_default:1}
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 27
%global with_python3_default 0
%else
%global with_python3_default 1
%endif
%endif
################################################################################
# Java
################################################################################
%define java_home %{_usr}/lib/jvm/jre-1.8.0-openjdk
################################################################################
# RESTEasy
################################################################################
%if 0%{?rhel} && 0%{?rhel} <= 7
%define jaxrs_api_jar /usr/share/java/resteasy-base/jaxrs-api.jar
%define resteasy_lib /usr/share/java/resteasy-base
%else
%define jaxrs_api_jar /usr/share/java/jboss-jaxrs-2.0-api.jar
%define resteasy_lib /usr/share/java/resteasy
%endif
################################################################################
# PKI
################################################################################
# By default the build will execute unit tests unless --without test
# option is specified.
%bcond_without test
# By default all packages will be built except the ones specified with
# --without <package> option (exclusion method).
# If --with pkgs option is specified, only packages specified with
# --with <package> will be built (inclusion method).
%bcond_with pkgs
# Define package_option macro to wrap bcond_with or bcond_without macro
# depending on package selection method.
%if %{with pkgs}
%define package_option() %bcond_with %1
%else
%define package_option() %bcond_without %1
%endif # with pkgs
# Define --with <package> or --without <package> options depending on
# package selection method.
%package_option base
%package_option server
%package_option ca
%package_option kra
%package_option ocsp
%package_option tks
%package_option tps
%package_option javadoc
%package_option console
%package_option theme
%package_option meta
%package_option debug
%if ! %{with debug}
%define debug_package %{nil}
%endif # with debug
# ignore unpackaged files from native 'tpsclient'
# REMINDER: Remove this '%%define' once 'tpsclient' is rewritten as a Java app
%define _unpackaged_files_terminate_build 0
# pkiuser and group. The uid and gid are preallocated
# see /usr/share/doc/setup/uidgid
%define pki_username pkiuser
%define pki_uid 17
%define pki_groupname pkiuser
%define pki_gid 17
%define pki_homedir /usr/share/pki
%global saveFileContext() \
if [ -s /etc/selinux/config ]; then \
. %{_sysconfdir}/selinux/config; \
FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
if [ "${SELINUXTYPE}" == %1 -a -f ${FILE_CONTEXT} ]; then \
cp -f ${FILE_CONTEXT} ${FILE_CONTEXT}.%{name}; \
fi \
fi;
%global relabel() \
. %{_sysconfdir}/selinux/config; \
FILE_CONTEXT=%{_sysconfdir}/selinux/%1/contexts/files/file_contexts; \
selinuxenabled; \
if [ $? == 0 -a "${SELINUXTYPE}" == %1 -a -f ${FILE_CONTEXT}.%{name} ]; then \
fixfiles -C ${FILE_CONTEXT}.%{name} restore; \
rm -f ${FILE_CONTEXT}.%name; \
fi;
################################################################################
# Build Dependencies
################################################################################
# autosetup
BuildRequires: git
BuildRequires: make
BuildRequires: cmake >= 2.8.9-1
BuildRequires: gcc-c++
BuildRequires: zip
BuildRequires: java-1.8.0-openjdk-devel
BuildRequires: redhat-rpm-config
BuildRequires: ldapjdk >= 4.21.0
BuildRequires: apache-commons-cli
BuildRequires: apache-commons-codec
BuildRequires: apache-commons-io
BuildRequires: apache-commons-lang
BuildRequires: jakarta-commons-httpclient
BuildRequires: glassfish-jaxb-api
BuildRequires: slf4j
%if 0%{?rhel} && 0%{?rhel} <= 7
# no slf4j-jdk14
%else
BuildRequires: slf4j-jdk14
%endif
BuildRequires: nspr-devel
BuildRequires: nss-devel >= 3.36.1
BuildRequires: openldap-devel
BuildRequires: pkgconfig
BuildRequires: policycoreutils
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: python-lxml
BuildRequires: python-sphinx
%else
%if 0%{?fedora} && 0%{?fedora} <= 28
BuildRequires: python2-lxml
BuildRequires: python2-sphinx
%else
BuildRequires: python3-lxml
BuildRequires: python3-sphinx
%endif
%endif
BuildRequires: velocity
BuildRequires: xalan-j2
BuildRequires: xerces-j2
%if 0%{?rhel}
%if 0%{?rhel} <= 7
# 'resteasy-base' is a subset of the complete set of
# 'resteasy' packages and consists of what is needed to
# support the PKI Restful interface on certain RHEL platforms
BuildRequires: resteasy-base-atom-provider >= 3.0.6-1
BuildRequires: resteasy-base-client >= 3.0.6-1
BuildRequires: resteasy-base-jaxb-provider >= 3.0.6-1
BuildRequires: resteasy-base-jaxrs >= 3.0.6-1
BuildRequires: resteasy-base-jaxrs-api >= 3.0.6-1
BuildRequires: resteasy-base-jackson-provider >= 3.0.6-1
%else
BuildRequires: resteasy >= 3.0.26
%endif
%else
BuildRequires: jboss-annotations-1.2-api
BuildRequires: jboss-jaxrs-2.0-api
BuildRequires: jboss-logging
BuildRequires: resteasy-atom-provider >= 3.0.17-1
BuildRequires: resteasy-client >= 3.0.17-1
BuildRequires: resteasy-jaxb-provider >= 3.0.17-1
BuildRequires: resteasy-core >= 3.0.17-1
BuildRequires: resteasy-jackson2-provider >= 3.0.17-1
%endif
%if 0%{?with_python2}
%if 0%{?rhel}
# no pylint
%else
BuildRequires: pylint
%if 0%{?fedora} && 0%{?fedora} <= 27
BuildRequires: python-flake8 >= 2.5.4
BuildRequires: pyflakes >= 1.2.3
%else
BuildRequires: python2-flake8 >= 2.5.4
BuildRequires: python2-pyflakes >= 1.2.3
%endif
%endif
%endif # with_python2
%if 0%{?with_python3}
%if 0%{?rhel}
# no pylint
%else
BuildRequires: python3-pylint
BuildRequires: python3-flake8 >= 2.5.4
BuildRequires: python3-pyflakes >= 1.2.3
%endif
%endif # with_python3
%if 0%{?with_python2}
BuildRequires: python2
BuildRequires: python2-devel
BuildRequires: python2-cryptography
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 27
BuildRequires: python-nss
BuildRequires: python-requests >= 2.6.0
BuildRequires: python-six
BuildRequires: libselinux-python
BuildRequires: policycoreutils-python
BuildRequires: python-ldap
%else
BuildRequires: python2-nss
BuildRequires: python2-requests >= 2.6.0
BuildRequires: python2-six
BuildRequires: python2-libselinux
BuildRequires: python2-policycoreutils
BuildRequires: python2-ldap
%endif
%if 0%{?rhel} && 0%{?rhel} <= 7
# no policycoreutils-python-utils
%else
BuildRequires: policycoreutils-python-utils
%endif
%endif # with_python2
%if 0%{?with_python3}
BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: python3-cryptography
BuildRequires: python3-lxml
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 27
BuildRequires: python3-pyldap
# no python3-libselinux
%else
BuildRequires: python3-ldap
BuildRequires: python3-libselinux
%endif
BuildRequires: python3-nss
BuildRequires: python3-requests >= 2.6.0
BuildRequires: python3-six
%endif # with_python3
BuildRequires: junit
BuildRequires: jpackage-utils >= 0:1.7.5-10
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: jss >= 4.4.0-11
BuildRequires: tomcatjss >= 7.2.1-4
%else
BuildRequires: jss >= 4.6.0
BuildRequires: tomcatjss >= 7.4.0
%endif
BuildRequires: systemd-units
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: tomcat >= 7.0.69
%else
%if 0%{?fedora} && 0%{?fedora} <= 27
BuildRequires: tomcat >= 8.0.49
%else
%if 0%{?fedora} && 0%{?fedora} <= 28
BuildRequires: tomcat >= 1:8.5.23
%else
%if 0%{?rhel}
BuildRequires: pki-servlet-engine
%else
BuildRequires: tomcat >= 1:9.0.7
%endif
%endif
%endif
%endif
# additional build requirements needed to build native 'tpsclient'
# REMINDER: Revisit these once 'tpsclient' is rewritten as a Java app
BuildRequires: apr-devel
BuildRequires: apr-util-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: httpd-devel >= 2.4.2
BuildRequires: pcre-devel
BuildRequires: systemd
BuildRequires: zlib
BuildRequires: zlib-devel
# build dependency to build man pages
BuildRequires: go-md2man
# PKICertImport depends on certutil and openssl
BuildRequires: nss-tools
BuildRequires: openssl
# description for top-level package (if there is a separate meta package)
%if "%{name}" != "%{vendor}-pki"
%description
%{brand} PKI is an enterprise software system designed
to manage enterprise Public Key Infrastructure deployments.
PKI consists of the following components:
* Certificate Authority (CA)
* Key Recovery Authority (KRA)
* Online Certificate Status Protocol (OCSP) Manager
* Token Key Service (TKS)
* Token Processing Service (TPS)
%endif
%if %{with meta}
%if "%{name}" != "%{vendor}-pki"
################################################################################
%package -n %{vendor}-pki
################################################################################
Summary: %{brand} PKI Package
%endif
# Make certain that this 'meta' package requires the latest version(s)
# of ALL PKI theme packages
Requires: %{vendor}-pki-server-theme = %{version}
Requires: %{vendor}-pki-console-theme = %{version}
# Make certain that this 'meta' package requires the latest version(s)
# of ALL PKI core packages
Requires: pki-ca = %{version}
Requires: pki-kra = %{version}
Requires: pki-ocsp = %{version}
Requires: pki-tks = %{version}
Requires: pki-tps = %{version}
# Make certain that this 'meta' package requires the latest version(s)
# of PKI console
Requires: pki-console = %{version}
Requires: pki-javadoc = %{version}
# Make certain that this 'meta' package requires the latest version(s)
# of ALL PKI clients
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: esc >= 1.1.0
%else
Requires: esc >= 1.1.1
%endif
# description for top-level package (unless there is a separate meta package)
%if "%{name}" == "%{vendor}-pki"
%description
%else
%description -n %{vendor}-pki
%endif
%{brand} PKI is an enterprise software system designed
to manage enterprise Public Key Infrastructure deployments.
PKI consists of the following components:
* Certificate Authority (CA)
* Key Recovery Authority (KRA)
* Online Certificate Status Protocol (OCSP) Manager
* Token Key Service (TKS)
* Token Processing Service (TPS)
%endif # with meta
%if %{with base}
################################################################################
%package -n pki-symkey
################################################################################
Summary: PKI Symmetric Key Package
Requires: java-1.8.0-openjdk-headless
Requires: jpackage-utils >= 0:1.7.5-10
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: jss >= 4.4.0-11
%else
Requires: jss >= 4.6.0
%endif
Requires: nss >= 3.38.0
# Ensure we end up with a useful installation
Conflicts: pki-symkey < %{version}
Conflicts: pki-javadoc < %{version}
Conflicts: pki-server-theme < %{version}
Conflicts: pki-console-theme < %{version}
%description -n pki-symkey
The PKI Symmetric Key Java Package supplies various native
symmetric key operations to Java programs.
################################################################################
%package -n pki-base
################################################################################
Summary: PKI Base Package
BuildArch: noarch
Requires: nss >= 3.36.1
%if 0%{?with_python3_default}
Requires: python3-pki = %{version}
Requires(post): python3-pki = %{version}
%else
Requires: python2-pki = %{version}
Requires(post): python2-pki = %{version}
%endif # with_python3_default
# Ensure we end up with a useful installation
Conflicts: pki-symkey < %{version}
Conflicts: pki-javadoc < %{version}
Conflicts: pki-server-theme < %{version}
Conflicts: pki-console-theme < %{version}
%description -n pki-base
The PKI Base Package contains the common and client libraries and utilities
written in Python.
%if 0%{?with_python2}
################################################################################
%package -n python2-pki
################################################################################
Summary: PKI Python 2 Package
BuildArch: noarch
Obsoletes: pki-base-python2 < %{version}
Provides: pki-base-python2 = %{version}
%if 0%{?fedora}
%{?python_provide:%python_provide python2-pki}
%endif
Requires: pki-base = %{version}
Requires: python2-cryptography
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 27
Requires: python-nss
Requires: python-requests >= 2.6.0
Requires: python-six
%else
Requires: python2-nss
Requires: python2-requests >= 2.6.0
Requires: python2-six
%endif
%description -n python2-pki
This package contains PKI client library for Python 2.
%endif # with_python2
%if 0%{?with_python3}
################################################################################
%package -n python3-pki
################################################################################
Summary: PKI Python 3 Package
BuildArch: noarch
Obsoletes: pki-base-python3 < %{version}
Provides: pki-base-python3 = %{version}
%if 0%{?fedora}
%{?python_provide:%python_provide python3-pki}
%endif
Requires: pki-base = %{version}
Requires: python3-cryptography
Requires: python3-lxml
Requires: python3-nss
Requires: python3-requests >= 2.6.0
Requires: python3-six
%description -n python3-pki
This package contains PKI client library for Python 3.
%endif # with_python3 for python3-pki
################################################################################
%package -n pki-base-java
################################################################################
Summary: PKI Base Java Package
BuildArch: noarch
Requires: java-1.8.0-openjdk-headless
Requires: apache-commons-cli
Requires: apache-commons-codec
Requires: apache-commons-io
Requires: apache-commons-lang
Requires: apache-commons-logging
Requires: jakarta-commons-httpclient
Requires: glassfish-jaxb-api
Requires: slf4j
%if 0%{?rhel} && 0%{?rhel} <= 7
# no slf4j-jdk14
%else
Requires: slf4j-jdk14
%endif
Requires: jpackage-utils >= 0:1.7.5-10
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: jss >= 4.4.0-11
%else
Requires: jss >= 4.6.0
%endif
Requires: ldapjdk >= 4.21.0
Requires: pki-base = %{version}
%if 0%{?rhel}
%if 0%{?rhel} <= 7
# 'resteasy-base' is a subset of the complete set of
# 'resteasy' packages and consists of what is needed to
# support the PKI Restful interface on certain RHEL platforms
Requires: resteasy-base-atom-provider >= 3.0.6-1
Requires: resteasy-base-client >= 3.0.6-1
Requires: resteasy-base-jaxb-provider >= 3.0.6-1
Requires: resteasy-base-jaxrs >= 3.0.6-1
Requires: resteasy-base-jaxrs-api >= 3.0.6-1
Requires: resteasy-base-jackson-provider >= 3.0.6-1
%else
Requires: resteasy >= 3.0.26
%endif
%else
Requires: resteasy-atom-provider >= 3.0.17-1
Requires: resteasy-client >= 3.0.17-1
Requires: resteasy-jaxb-provider >= 3.0.17-1
Requires: resteasy-core >= 3.0.17-1
Requires: resteasy-jackson2-provider >= 3.0.17-1
%endif
Requires: xalan-j2
Requires: xerces-j2
Requires: xml-commons-apis
Requires: xml-commons-resolver
%description -n pki-base-java
The PKI Base Java Package contains the common and client libraries and utilities
written in Java.
################################################################################
%package -n pki-tools
################################################################################
Summary: PKI Tools Package
Requires: openldap-clients
Requires: nss-tools >= 3.36.1
Requires: pki-base-java = %{version}
# PKICertImport depends on certutil and openssl
Requires: nss-tools
Requires: openssl
%description -n pki-tools
This package contains PKI executables that can be used to help make
Certificate System into a more complete and robust PKI solution.
%endif # with base
%if %{with server}
################################################################################
%package -n pki-server
################################################################################
Summary: PKI Server Package
BuildArch: noarch
Requires: hostname
Requires: net-tools
Requires: policycoreutils
Requires: procps-ng
Requires: openldap-clients
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: openssl >= 1.0.2k-11
%else
Requires: openssl
%endif
Requires: pki-symkey = %{version}
Requires: pki-tools = %{version}
Requires: keyutils
%if 0%{?rhel} && 0%{?rhel} <= 7
# no policycoreutils-python-utils
%else
Requires: policycoreutils-python-utils
%endif
%if 0%{?with_python3_default}
%if 0%{?fedora} && 0%{?fedora} <= 27
Requires: python3-pyldap
%else
Requires: python3-ldap
%endif
Requires: python3-lxml
Requires: python3-libselinux
Requires: python3-policycoreutils
%else
%if 0%{?rhel} && 0%{?rhel} <= 7 || 0%{?fedora} && 0%{?fedora} <= 27
Requires: python-ldap
Requires: python-lxml
Requires: libselinux-python
Requires: policycoreutils-python
%else
Requires: python2-ldap
Requires: python2-lxml
Requires: python2-libselinux
Requires: python2-policycoreutils
%endif
%endif # with_python3_default
Requires: selinux-policy-targeted >= 3.13.1-159
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: tomcat >= 7.0.69
%else
%if 0%{?fedora} && 0%{?fedora} <= 27
Requires: tomcat >= 8.0.49
%else
%if 0%{?fedora} && 0%{?fedora} <= 28
Requires: tomcat >= 1:8.5.23
%else
%if 0%{?rhel}
Requires: pki-servlet-engine >= 1:9.0.7
%else
Requires: tomcat >= 1:9.0.7
%endif
%endif
%endif
%endif
Requires: velocity
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(pre): shadow-utils
%if 0%{?rhel} && 0%{?rhel} <= 7
Requires: tomcatjss >= 7.2.1-4
%else
Requires: tomcatjss >= 7.4.0
%endif
# https://pagure.io/freeipa/issue/7742
%if 0%{?rhel}
Conflicts: ipa-server < 4.7.1
%else
Conflicts: freeipa-server < 4.7.1
%endif
%description -n pki-server
The PKI Server Package contains libraries and utilities needed by the
following PKI subsystems:
the Certificate Authority (CA),
the Key Recovery Authority (KRA),
the Online Certificate Status Protocol (OCSP) Manager,
the Token Key Service (TKS), and
the Token Processing Service (TPS).
%endif # with server
%if %{with ca}
################################################################################
%package -n pki-ca
################################################################################
Summary: PKI CA Package
BuildArch: noarch
Requires: pki-server = %{version}
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description -n pki-ca
The Certificate Authority (CA) is a required PKI subsystem which issues,
renews, revokes, and publishes certificates as well as compiling and
publishing Certificate Revocation Lists (CRLs).
The Certificate Authority can be configured as a self-signing Certificate
Authority, where it is the root CA, or it can act as a subordinate CA,
where it obtains its own signing certificate from a public CA.
%endif # with ca
%if %{with kra}
################################################################################
%package -n pki-kra
################################################################################
Summary: PKI KRA Package
BuildArch: noarch
Requires: pki-server = %{version}
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description -n pki-kra
The Key Recovery Authority (KRA) is an optional PKI subsystem that can act
as a key archival facility. When configured in conjunction with the
Certificate Authority (CA), the KRA stores private encryption keys as part of
the certificate enrollment process. The key archival mechanism is triggered
when a user enrolls in the PKI and creates the certificate request. Using the
Certificate Request Message Format (CRMF) request format, a request is
generated for the user's private encryption key. This key is then stored in
the KRA which is configured to store keys in an encrypted format that can only
be decrypted by several agents requesting the key at one time, providing for
protection of the public encryption keys for the users in the PKI deployment.
Note that the KRA archives encryption keys; it does NOT archive signing keys,
since such archival would undermine non-repudiation properties of signing keys.
%endif # with kra
%if %{with ocsp}
################################################################################
%package -n pki-ocsp
################################################################################
Summary: PKI OCSP Package
BuildArch: noarch
Requires: pki-server = %{version}
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description -n pki-ocsp
The Online Certificate Status Protocol (OCSP) Manager is an optional PKI
subsystem that can act as a stand-alone OCSP service. The OCSP Manager
performs the task of an online certificate validation authority by enabling
OCSP-compliant clients to do real-time verification of certificates. Note
that an online certificate-validation authority is often referred to as an
OCSP Responder.
Although the Certificate Authority (CA) is already configured with an
internal OCSP service. An external OCSP Responder is offered as a separate
subsystem in case the user wants the OCSP service provided outside of a
firewall while the CA resides inside of a firewall, or to take the load of
requests off of the CA.
The OCSP Manager can receive Certificate Revocation Lists (CRLs) from
multiple CA servers, and clients can query the OCSP Manager for the
revocation status of certificates issued by all of these CA servers.
When an instance of OCSP Manager is set up with an instance of CA, and
publishing is set up to this OCSP Manager, CRLs are published to it
whenever they are issued or updated.
%endif # with ocsp
%if %{with tks}
################################################################################
%package -n pki-tks
################################################################################
Summary: PKI TKS Package
BuildArch: noarch
Requires: pki-server = %{version}
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description -n pki-tks
The Token Key Service (TKS) is an optional PKI subsystem that manages the
master key(s) and the transport key(s) required to generate and distribute
keys for hardware tokens. TKS provides the security between tokens and an
instance of Token Processing System (TPS), where the security relies upon the
relationship between the master key and the token keys. A TPS communicates
with a TKS over SSL using client authentication.
TKS helps establish a secure channel (signed and encrypted) between the token
and the TPS, provides proof of presence of the security token during
enrollment, and supports key changeover when the master key changes on the
TKS. Tokens with older keys will get new token keys.
Because of the sensitivity of the data that TKS manages, TKS should be set up
behind the firewall with restricted access.
%endif # with tks
%if %{with tps}
################################################################################
%package -n pki-tps
################################################################################
Summary: PKI TPS Package
Requires: pki-server = %{version}
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
# additional runtime requirements needed to run native 'tpsclient'
# REMINDER: Revisit these once 'tpsclient' is rewritten as a Java app
Requires: nss-tools >= 3.36.1
Requires: openldap-clients
%description -n pki-tps
The Token Processing System (TPS) is an optional PKI subsystem that acts
as a Registration Authority (RA) for authenticating and processing
enrollment requests, PIN reset requests, and formatting requests from
the Enterprise Security Client (ESC).
TPS is designed to communicate with tokens that conform to
Global Platform's Open Platform Specification.
TPS communicates over SSL with various PKI backend subsystems (including
the Certificate Authority (CA), the Key Recovery Authority (KRA), and the
Token Key Service (TKS)) to fulfill the user's requests.
TPS also interacts with the token database, an LDAP server that stores
information about individual tokens.
The utility "tpsclient" is a test tool that interacts with TPS. This
tool is useful to test TPS server configs without risking an actual
smart card.
%endif # with tps
%if %{with javadoc}
################################################################################
%package -n pki-javadoc
################################################################################
Summary: PKI Javadoc Package
BuildArch: noarch
# Ensure we end up with a useful installation
Conflicts: pki-base < %{version}
Conflicts: pki-symkey < %{version}
Conflicts: pki-server-theme < %{version}
Conflicts: pki-console-theme < %{version}
%description -n pki-javadoc
This package contains PKI API documentation.
%endif # with javadoc
%if %{with console}
################################################################################
%package -n pki-console
################################################################################
Summary: PKI Console Package
BuildArch: noarch
BuildRequires: idm-console-framework >= 1.2.0
Requires: idm-console-framework >= 1.2.0
Requires: pki-base-java = %{version}
Requires: pki-console-theme = %{version}
%description -n pki-console
The PKI Console is a Java application used to administer PKI server.
%endif # with console
%if %{with theme}
################################################################################
%package -n %{vendor}-pki-server-theme
################################################################################
Summary: %{brand} PKI Server Theme Package
BuildArch: noarch
Provides: pki-server-theme = %{version}
# Ensure we end up with a useful installation
Conflicts: pki-base < %{version}
Conflicts: pki-symkey < %{version}
Conflicts: pki-console-theme < %{version}
Conflicts: pki-javadoc < %{version}
%description -n %{vendor}-pki-server-theme
This PKI Server Theme Package contains
%{brand} textual and graphical user interface for PKI Server.
################################################################################
%package -n %{vendor}-pki-console-theme
################################################################################
Summary: %{brand} PKI Console Theme Package
BuildArch: noarch
Provides: pki-console-theme = %{version}
# Ensure we end up with a useful installation
Conflicts: pki-base < %{version}
Conflicts: pki-symkey < %{version}
Conflicts: pki-server-theme < %{version}
Conflicts: pki-javadoc < %{version}
%description -n %{vendor}-pki-console-theme
This PKI Console Theme Package contains
%{brand} textual and graphical user interface for PKI Console.
%endif # with theme
################################################################################
%prep
################################################################################
%autosetup -n pki-%{version}%{?_phase} -p 1 -S git
################################################################################
%build
################################################################################
# get Tomcat <major>.<minor> version number
tomcat_version=`/usr/sbin/tomcat version | sed -n 's/Server number: *\([0-9]\+\.[0-9]\+\).*/\1/p'`
if [ $tomcat_version == "9.0" ]; then
app_server=tomcat-8.5
else
app_server=tomcat-$tomcat_version
fi
%{__mkdir_p} build
cd build
%cmake \
--no-warn-unused-cli \
-DVERSION=%{version}-%{release} \
-DVAR_INSTALL_DIR:PATH=/var \
-DJAVA_HOME=%{java_home} \
-DJAVA_LIB_INSTALL_DIR=%{_jnidir} \
-DSYSTEMD_LIB_INSTALL_DIR=%{_unitdir} \
-DAPP_SERVER=$app_server \
-DJAXRS_API_JAR=%{jaxrs_api_jar} \
-DRESTEASY_LIB=%{resteasy_lib} \
-DNSS_DEFAULT_DB_TYPE=%{nss_default_db_type} \
-DBUILD_PKI_CORE:BOOL=ON \
-DWITH_PYTHON2:BOOL=%{?with_python2:ON}%{!?with_python2:OFF} \
-DWITH_PYTHON3:BOOL=%{?with_python3:ON}%{!?with_python3:OFF} \
%if 0%{?with_python3_default}
-DWITH_PYTHON3_DEFAULT:BOOL=ON \
%endif