Skip to content

Commit 2cc9c08

Browse files
committed
T8529: Add configuration CLI to enable OpenSSL FIPS
Add the new configuration CLI to enable OpenSSL FIPS-140 (Federal Information Processing Standard) cryptographic modules
1 parent a8187bb commit 2cc9c08

4 files changed

Lines changed: 462 additions & 0 deletions

File tree

Lines changed: 395 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,395 @@
1+
#
2+
# OpenSSL example configuration file.
3+
# See doc/man5/config.pod for more info.
4+
#
5+
# This is mostly being used for generation of certificate requests,
6+
# but may be used for auto loading of providers
7+
8+
# Note that you can include other files from the main configuration
9+
# file using the .include directive.
10+
#.include filename
11+
12+
# This definition stops the following lines choking if HOME isn't
13+
# defined.
14+
HOME = .
15+
16+
# Use this in order to automatically load providers.
17+
openssl_conf = openssl_init
18+
19+
# Comment out the next line to ignore configuration errors
20+
config_diagnostics = 1
21+
22+
# Extra OBJECT IDENTIFIER info:
23+
# oid_file = $ENV::HOME/.oid
24+
oid_section = new_oids
25+
26+
# To use this configuration file with the "-extfile" option of the
27+
# "openssl x509" utility, name here the section containing the
28+
# X.509v3 extensions to use:
29+
# extensions =
30+
# (Alternatively, use a configuration file that has only
31+
# X.509v3 extensions in its main [= default] section.)
32+
33+
[ new_oids ]
34+
# We can add new OIDs in here for use by 'ca', 'req' and 'ts'.
35+
# Add a simple OID like this:
36+
# testoid1=1.2.3.4
37+
# Or use config file substitution like this:
38+
# testoid2=${testoid1}.5.6
39+
40+
# Policies used by the TSA examples.
41+
tsa_policy1 = 1.2.3.4.1
42+
tsa_policy2 = 1.2.3.4.5.6
43+
tsa_policy3 = 1.2.3.4.5.7
44+
45+
# For FIPS
46+
# Optionally include a file that is generated by the OpenSSL fipsinstall
47+
# application. This file contains configuration data required by the OpenSSL
48+
# fips provider. It contains a named section e.g. [fips_sect] which is
49+
# referenced from the [provider_sect] below.
50+
# Refer to the OpenSSL security policy for more information.
51+
# .include fipsmodule.cnf
52+
{% if fips is vyos_defined %}
53+
.include /run/ssl/fipsmodule.cnf
54+
{% endif %}
55+
56+
[openssl_init]
57+
providers = provider_sect
58+
59+
# List of providers to load
60+
[provider_sect]
61+
# default = default_sect
62+
# The fips section name should match the section name inside the
63+
# included fipsmodule.cnf.
64+
{% if fips is vyos_defined %}
65+
fips = fips_sect
66+
{% endif %}
67+
68+
# If no providers are activated explicitly, the default one is activated implicitly.
69+
# See man 7 OSSL_PROVIDER-default for more details.
70+
#
71+
# If you add a section explicitly activating any other provider(s), you most
72+
# probably need to explicitly activate the default provider, otherwise it
73+
# becomes unavailable in openssl. As a consequence applications depending on
74+
# OpenSSL may not work correctly which could lead to significant system
75+
# problems including inability to remotely access the system.
76+
# [default_sect]
77+
# activate = 1
78+
79+
80+
####################################################################
81+
[ ca ]
82+
default_ca = CA_default # The default ca section
83+
84+
####################################################################
85+
[ CA_default ]
86+
87+
dir = ./demoCA # Where everything is kept
88+
certs = $dir/certs # Where the issued certs are kept
89+
crl_dir = $dir/crl # Where the issued crl are kept
90+
database = $dir/index.txt # database index file.
91+
#unique_subject = no # Set to 'no' to allow creation of
92+
# several certs with same subject.
93+
new_certs_dir = $dir/newcerts # default place for new certs.
94+
95+
certificate = $dir/cacert.pem # The CA certificate
96+
serial = $dir/serial # The current serial number
97+
crlnumber = $dir/crlnumber # the current crl number
98+
# must be commented out to leave a V1 CRL
99+
crl = $dir/crl.pem # The current CRL
100+
private_key = $dir/private/cakey.pem# The private key
101+
102+
x509_extensions = usr_cert # The extensions to add to the cert
103+
104+
# Comment out the following two lines for the "traditional"
105+
# (and highly broken) format.
106+
name_opt = ca_default # Subject Name options
107+
cert_opt = ca_default # Certificate field options
108+
109+
# Extension copying option: use with caution.
110+
# copy_extensions = copy
111+
112+
# Extensions to add to a CRL. Note: Netscape communicator chokes on V2 CRLs
113+
# so this is commented out by default to leave a V1 CRL.
114+
# crlnumber must also be commented out to leave a V1 CRL.
115+
# crl_extensions = crl_ext
116+
117+
default_days = 365 # how long to certify for
118+
default_crl_days= 30 # how long before next CRL
119+
default_md = default # use public key default MD
120+
preserve = no # keep passed DN ordering
121+
122+
# A few difference way of specifying how similar the request should look
123+
# For type CA, the listed attributes must be the same, and the optional
124+
# and supplied fields are just that :-)
125+
policy = policy_match
126+
127+
# For the CA policy
128+
[ policy_match ]
129+
countryName = match
130+
stateOrProvinceName = match
131+
organizationName = match
132+
organizationalUnitName = optional
133+
commonName = supplied
134+
emailAddress = optional
135+
136+
# For the 'anything' policy
137+
# At this point in time, you must list all acceptable 'object'
138+
# types.
139+
[ policy_anything ]
140+
countryName = optional
141+
stateOrProvinceName = optional
142+
localityName = optional
143+
organizationName = optional
144+
organizationalUnitName = optional
145+
commonName = supplied
146+
emailAddress = optional
147+
148+
####################################################################
149+
[ req ]
150+
default_bits = 2048
151+
default_keyfile = privkey.pem
152+
distinguished_name = req_distinguished_name
153+
attributes = req_attributes
154+
x509_extensions = v3_ca # The extensions to add to the self signed cert
155+
156+
# Passwords for private keys if not present they will be prompted for
157+
# input_password = secret
158+
# output_password = secret
159+
160+
# This sets a mask for permitted string types. There are several options.
161+
# default: PrintableString, T61String, BMPString.
162+
# pkix : PrintableString, BMPString (PKIX recommendation before 2004)
163+
# utf8only: only UTF8Strings (PKIX recommendation after 2004).
164+
# nombstr : PrintableString, T61String (no BMPStrings or UTF8Strings).
165+
# MASK:XXXX a literal mask value.
166+
# WARNING: ancient versions of Netscape crash on BMPStrings or UTF8Strings.
167+
string_mask = utf8only
168+
169+
# req_extensions = v3_req # The extensions to add to a certificate request
170+
171+
[ req_distinguished_name ]
172+
countryName = Country Name (2 letter code)
173+
countryName_default = AU
174+
countryName_min = 2
175+
countryName_max = 2
176+
177+
stateOrProvinceName = State or Province Name (full name)
178+
stateOrProvinceName_default = Some-State
179+
180+
localityName = Locality Name (eg, city)
181+
182+
0.organizationName = Organization Name (eg, company)
183+
0.organizationName_default = Internet Widgits Pty Ltd
184+
185+
# we can do this but it is not needed normally :-)
186+
#1.organizationName = Second Organization Name (eg, company)
187+
#1.organizationName_default = World Wide Web Pty Ltd
188+
189+
organizationalUnitName = Organizational Unit Name (eg, section)
190+
#organizationalUnitName_default =
191+
192+
commonName = Common Name (e.g. server FQDN or YOUR name)
193+
commonName_max = 64
194+
195+
emailAddress = Email Address
196+
emailAddress_max = 64
197+
198+
# SET-ex3 = SET extension number 3
199+
200+
[ req_attributes ]
201+
challengePassword = A challenge password
202+
challengePassword_min = 4
203+
challengePassword_max = 20
204+
205+
unstructuredName = An optional company name
206+
207+
[ usr_cert ]
208+
209+
# These extensions are added when 'ca' signs a request.
210+
211+
# This goes against PKIX guidelines but some CAs do it and some software
212+
# requires this to avoid interpreting an end user certificate as a CA.
213+
214+
basicConstraints=CA:FALSE
215+
216+
# This is typical in keyUsage for a client certificate.
217+
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
218+
219+
# PKIX recommendations harmless if included in all certificates.
220+
subjectKeyIdentifier=hash
221+
authorityKeyIdentifier=keyid,issuer
222+
223+
# This stuff is for subjectAltName and issuerAltname.
224+
# Import the email address.
225+
# subjectAltName=email:copy
226+
# An alternative to produce certificates that aren't
227+
# deprecated according to PKIX.
228+
# subjectAltName=email:move
229+
230+
# Copy subject details
231+
# issuerAltName=issuer:copy
232+
233+
# This is required for TSA certificates.
234+
# extendedKeyUsage = critical,timeStamping
235+
236+
[ v3_req ]
237+
238+
# Extensions to add to a certificate request
239+
240+
basicConstraints = CA:FALSE
241+
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
242+
243+
[ v3_ca ]
244+
245+
246+
# Extensions for a typical CA
247+
248+
249+
# PKIX recommendation.
250+
251+
subjectKeyIdentifier=hash
252+
253+
authorityKeyIdentifier=keyid:always,issuer
254+
255+
basicConstraints = critical,CA:true
256+
257+
# Key usage: this is typical for a CA certificate. However since it will
258+
# prevent it being used as an test self-signed certificate it is best
259+
# left out by default.
260+
# keyUsage = cRLSign, keyCertSign
261+
262+
# Include email address in subject alt name: another PKIX recommendation
263+
# subjectAltName=email:copy
264+
# Copy issuer details
265+
# issuerAltName=issuer:copy
266+
267+
# DER hex encoding of an extension: beware experts only!
268+
# obj=DER:02:03
269+
# Where 'obj' is a standard or added object
270+
# You can even override a supported extension:
271+
# basicConstraints= critical, DER:30:03:01:01:FF
272+
273+
[ crl_ext ]
274+
275+
# CRL extensions.
276+
# Only issuerAltName and authorityKeyIdentifier make any sense in a CRL.
277+
278+
# issuerAltName=issuer:copy
279+
authorityKeyIdentifier=keyid:always
280+
281+
[ proxy_cert_ext ]
282+
# These extensions should be added when creating a proxy certificate
283+
284+
# This goes against PKIX guidelines but some CAs do it and some software
285+
# requires this to avoid interpreting an end user certificate as a CA.
286+
287+
basicConstraints=CA:FALSE
288+
289+
# This is typical in keyUsage for a client certificate.
290+
# keyUsage = nonRepudiation, digitalSignature, keyEncipherment
291+
292+
# PKIX recommendations harmless if included in all certificates.
293+
subjectKeyIdentifier=hash
294+
authorityKeyIdentifier=keyid,issuer
295+
296+
# This stuff is for subjectAltName and issuerAltname.
297+
# Import the email address.
298+
# subjectAltName=email:copy
299+
# An alternative to produce certificates that aren't
300+
# deprecated according to PKIX.
301+
# subjectAltName=email:move
302+
303+
# Copy subject details
304+
# issuerAltName=issuer:copy
305+
306+
# This really needs to be in place for it to be a proxy certificate.
307+
proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
308+
309+
####################################################################
310+
[ tsa ]
311+
312+
default_tsa = tsa_config1 # the default TSA section
313+
314+
[ tsa_config1 ]
315+
316+
# These are used by the TSA reply generation only.
317+
dir = ./demoCA # TSA root directory
318+
serial = $dir/tsaserial # The current serial number (mandatory)
319+
crypto_device = builtin # OpenSSL engine to use for signing
320+
signer_cert = $dir/tsacert.pem # The TSA signing certificate
321+
# (optional)
322+
certs = $dir/cacert.pem # Certificate chain to include in reply
323+
# (optional)
324+
signer_key = $dir/private/tsakey.pem # The TSA private key (optional)
325+
signer_digest = sha256 # Signing digest to use. (Optional)
326+
default_policy = tsa_policy1 # Policy if request did not specify it
327+
# (optional)
328+
other_policies = tsa_policy2, tsa_policy3 # acceptable policies (optional)
329+
digests = sha1, sha256, sha384, sha512 # Acceptable message digests (mandatory)
330+
accuracy = secs:1, millisecs:500, microsecs:100 # (optional)
331+
clock_precision_digits = 0 # number of digits after dot. (optional)
332+
ordering = yes # Is ordering defined for timestamps?
333+
# (optional, default: no)
334+
tsa_name = yes # Must the TSA name be included in the reply?
335+
# (optional, default: no)
336+
ess_cert_id_chain = no # Must the ESS cert id chain be included?
337+
# (optional, default: no)
338+
ess_cert_id_alg = sha1 # algorithm to compute certificate
339+
# identifier (optional, default: sha1)
340+
341+
[insta] # CMP using Insta Demo CA
342+
# Message transfer
343+
server = pki.certificate.fi:8700
344+
# proxy = # set this as far as needed, e.g., http://192.168.1.1:8080
345+
# tls_use = 0
346+
path = pkix/
347+
348+
# Server authentication
349+
recipient = "/C=FI/O=Insta Demo/CN=Insta Demo CA" # or set srvcert or issuer
350+
ignore_keyusage = 1 # potentially needed quirk
351+
unprotected_errors = 1 # potentially needed quirk
352+
extracertsout = insta.extracerts.pem
353+
354+
# Client authentication
355+
ref = 3078 # user identification
356+
secret = pass:insta # can be used for both client and server side
357+
358+
# Generic message options
359+
cmd = ir # default operation, can be overridden on cmd line with, e.g., kur
360+
361+
# Certificate enrollment
362+
subject = "/CN=openssl-cmp-test"
363+
newkey = insta.priv.pem
364+
out_trusted = apps/insta.ca.crt # does not include keyUsage digitalSignature
365+
certout = insta.cert.pem
366+
367+
[pbm] # Password-based protection for Insta CA
368+
# Server and client authentication
369+
ref = $insta::ref # 3078
370+
secret = $insta::secret # pass:insta
371+
372+
[signature] # Signature-based protection for Insta CA
373+
# Server authentication
374+
trusted = $insta::out_trusted # apps/insta.ca.crt
375+
376+
# Client authentication
377+
secret = # disable PBM
378+
key = $insta::newkey # insta.priv.pem
379+
cert = $insta::certout # insta.cert.pem
380+
381+
[ir]
382+
cmd = ir
383+
384+
[cr]
385+
cmd = cr
386+
387+
[kur]
388+
# Certificate update
389+
cmd = kur
390+
oldcert = $insta::certout # insta.cert.pem
391+
392+
[rr]
393+
# Certificate revocation
394+
cmd = rr
395+
oldcert = $insta::certout # insta.cert.pem

0 commit comments

Comments
 (0)