Custom attributes (transient CSR data)
Custom attributes are pieces of data that are embedded only in the CSR. The CA can use them when deciding whether to sign the certificate, but they are discarded after that and aren’t transferred to the final certificate.
Default behavior
The puppetserver ca list
command doesn’t
display custom attributes for pending CSRs, and basic autosigning (autosign.conf) doesn’t check them before signing.
Configurable behavior
If you use policy-based autosigning your policy executable receives the complete CSR in PEM format. The executable can extract and inspect the custom attributes, and use them to decide whether to sign the certificate.
The simplest method is to embed a pre-shared key of some kind in the custom attributes. A policy executable can compare it to a list of known keys and autosign certificates for any pre-authorized nodes.
A more complex use might be to embed an instance-specific ID and write a policy executable that can check it against a list of your recently requested instances on a public cloud, like EC2 or GCE.
Manually checking for custom attributes in CSRs
You can check for custom attributes by using OpenSSL to dump a CSR in pem
format to text format, by running this
command:
openssl req -noout -text -in <name>.pem
In the output, look for the Attributes
section which
appears below the Subject Public Key Info
block:
Attributes: challengePassword :342thbjkt82094y0uthhor289jnqthpc2290
Recommended OIDs for attributes
Custom attributes can use any public or site-specific OID, with the exception of the OIDs used for core X.509 functionality. This means you can’t re-use existing OIDs for things like subject alternative names.
One useful OID is the challengePassword
attribute
— 1.2.840.113549.1.9.7
. This is a
rarely-used corner of X.509 that can easily be repurposed to hold a pre-shared key.
The benefit of using this instead of an arbitrary OID is that it appears by name
when using OpenSSL to dump the CSR to text; OIDs that openssl req
can’t recognize are displayed as numerical
strings.
You can also use the Puppet-specific OIDs.