When trying to go through some material for self-signing a certificate, one of the steps required me to set policy conditions in this config file. See: https://www.phildev.net/ssl/opensslconf.html
The idea is that when you select policy_match=match
, certain fields in the CA's certificate "must match with the corresponding fields in the client certificate to be signed". Why would a CA's certificate have to have matching fields with a client's certificate?
It all doesn't make sense to me since the client could be an arbitrary entity that has nothing in common with the CA. Can someone explain the scenario in which these would have to match?
It is an arbitrary, administrative decision for the creator of CA what client certificates they want to enable to be signed by the CA.
The policy_match
in the following configuration line:
policy = policy_match
is a chosen name that corresponds to a particular section in the configuration file. That section defines in details each of the
[ policy_match ]
countryName = match
stateOrProvinceName = match
localityName = supplied
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
Each of the DN fields for the client certificate can be assigned to have the same value as the CA (match
), be required to be specified (supplied
), or be optional (optional
).
The same guide suggests another policy that matches your criteria of "the client could be an arbitrary entity that has nothing in common with the CA":
[ policy_anything ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = optional
Yet if you wanted to create a CA for your organisation, that would allow issuing only certificates for that part of your organisation you can freely set for example:
policy = policy_branch_1
[ policy_branch_1 ]
countryName = match
stateOrProvinceName = match
localityName = match
organizationName = optional
organizationalUnitName = optional
commonName = supplied
emailAddress = supplied
Which would required the issued certificates to have first three DN fields matching the CA's certificate.
-subj
if used), and thus the new cert, to match the field in the CA cert/name -- but it does not check order: the RDNs in the CSR can be in any order but the cert uses the order of the policy settings, unless you use -preserveDN
as stated on the man page. — Jul 08, 2020 at 18:33 External links referenced by this document: