Before you can use the SCEP subsystem, you need to enable the SCEP Server in the general configuration. This section explains the business logic and options for the enrollment workflow.
It is important to understand that the default workflow has three operational modes which are autodetected based on parameters of the request. It is a common problem that the workflow does not behave as excepted because you got into the wrong operational mode due to a non-compliant client (e.g Cisco ASA).
Anonymously request a certificate for the first time - requires that the SCEP request is self-signed, which means the certificate used for the outer signature must match the key of the CSR and the subject of the request must match the subject of the signer certificate (which is a self-signed certificate in this case). Especially Ciso ASA fails here as the certificate subject does not match the request subject.
Request renewal by sending a new request signed with the existing certificate. This requires that the full subject of request and signer certificate matches! With the default profiles the PKI will enforce the DC/O parts of the entity certificates so this is a common problem when new certificates are created using the old configuration. Best strategy is to create the new request from the old certificate to ensure the subjects match. Please note that reuse of keys is not supported, you must generate a new key for each new request.
Enrollment On Behalf¶
Request a certificate with the help of a Trusted Third Party - the request is signed using a certificate issued from the PKI which is qualified as “Authorized Signer (see below)” for the given endpoint. This branch is always choosen if the subject of request and signer do not match, so it is often hit by accident when Renewal or Initial Enrollment are made with “wrong” subjects.
The workflow validates incoming requests against five stages. Parameters are described in detail in the section on policy settings.
- technical parameters:
- Check if key algorithm, key size and hash algorithm match the policy. If any of those checks fails, the request is rejected.
- A request can either be self-signed and provide a challenge password or use an HMAC for authentication or is signed by a trusted certificate (renewal or “signer on behalf”). You can also disable authentication or dispatch unauthorized requests to an operator for review.
- subject duplicate check:
- The database is checked for valid certificates with the same subject. If issuing the certificate would exceed the configured maximum count, the request is dispatched to an operator wo can either reject the request or take actions to meet the policy.
- The basic idea is to check requests based on the subject or additonal parameters against an external source to see if enrollment is possible. The check counts against the approval point counter, the workflow does not take any special action if the check fails.
- approval point:
- The first four stages are usually run in one step when the request hits the server. Before the certificate is issued, the request must have a sufficient number of approval points. Each operator approval is worth one point. A passed eligibility check is also worth one.
The workflow fetches all information from the configuration system at
scep.<servername> where the servername is taken from the scep wrapper configuration.
Here is a complete sample configuration (found in scep/generic.yaml):
# By default, all scep endpoints wll use the default token defined # by the scep token group, if you pass a name here, it is considered # a group name from the alias table #token: ca-one-special-scep # A renewal request is only accpeted if the used certificate will # expire within this period of time. renewal_period: 000060 # If the request was a replacement, optionally revoke the replaced # certificate after a grace period revoke_on_replace: reason_code: keyCompromise delay_revocation_time: +000014 workflow: type: certificate_enroll param: # key: name in workflow context, value: parameter from scep wrapper # server and interface are always set, the mapping below is # the default set that is used when no map is given transaction_id: transaction_id signer_cert: signer_cert pkcs10: pkcs10 _url_params: url_params #_pkcs7: pkcs7 authorized_signer: rule1: # Full DN subject: CN=.+:pkiclient,.* rule2: # Full DN subject: CN=my.scep.enroller.com:generic,.* policy: # Authentication Options # Initial requests need ONE authentication. # Activate Challenge Password and/or HMAC by setting the appropriate # options below. # if set requests can be authenticated by an operator allow_man_authen: 1 # if set, no authentication is required at all and hmac/challenge is # not evaluated even if it is set/present in the request! allow_anon_enroll: 0 # Approval # If not autoapproved, allow opeerator to add approval by hand allow_man_approv: 1 # if the eligibiliyt check failed the first time # show a button to run a recheck (Workflow goes to PENDING) allow_eligibility_recheck: 0 # Approval points requirede (eligibity and operator count as one point each) # if you set this to "0", all authenticated requests are auto-approved! approval_points: 1 # The number of active certs with the same subject that are allowed # to exist at the same time, deducted by one if a renewal is seen # set to 0 if you dont want to check for duplicates at all max_active_certs: 1 # option will be removed # allow_expired_signer: 0 # If an initial enrollment is seen # all existing certificates with the same subject are revoked auto_revoke_existing_certs: 1 # allows a "renewal" outside the renewal window, the notafter date # is aligned to the old certificate. Set revoke_on_replace option # to revoke the replaced certificate. # This substitutes the "replace_window" from the OpenXPKI v1 config allow_replace: 1 response: # The scep standard is a bit unclear if the root should be in the chain # or not. We consider it a security risk (trust should be always set # by hand) but as most clients seem to expect it, we include the root # by default. # The getca response contains the certificate of the SCEP server itself # and of the current active issuer (which can but need not to be the same!) # You can define weather to have only the certificate itself (endentity), # the chain without the root (chain) or the chain including the root # (fullchain). # Note: The response is cached internally in the datapool so changes # will not show up immediately - to list the cached items use # openxpkicli list_data_pool_entries --arg namespace=scep.cache.getca # You can delete by setting the empty string as value with # set_data_pool_entry (value="" force=1) getca: ra: fullchain issuer: fullchain profile: cert_profile: tls_server cert_subject_style: enroll # Mapping of names to OpenXPKI profiles to be used with the # Microsoft Certificate Template Name Ext. (220.127.116.11.4.1.311.20.2) profile_map: pc-client: tls_client # HMAC based authentication hmac: verysecret # see below how to get a per-request password challenge: value: SecretChallenge eligible: initial: value@: connector:scep.generic.connector.initial args: '[% context.cert_subject_parts.CN.0 %]' expect: - Build - New renewal: value: 1 connector: initial: class: Connector::Proxy::YAML # this file must have a key/value list with the key being # the subject and the value being a true value # e.g. "pc1234.example.org: 1" LOCATION: /home/pkiadm/cmdb.yaml
The renewal period values are interpreted as OpenXPKI::DateTime relative date but given without sign.
Upgrade from OpenXPKI v1 enrollment workflow¶
If you are upgrading from OpenXPKI 1.x enrollment workflow to the new one, you must adjust several parameters in the scep server configuration.
The logic for replace has changed, replace is now always assumed when you are outside the renewal period:
# old syntax renewal_period: 000014 replace_period: 05 # new syntax renewal_period: 000014 # note that the policy node already exists! policy: allow_replace: 1
signer on behalf
The name of the key has changed from authorized_signer_on_behalf to authorized_signer only:
# old syntax authorized_signer_on_behalf: rule1: ...... # new syntax authorized_signer: rule1: ......
In OpenXPKI 1.0 the default profile was set in the CGI wrapper configuration. This has been moved to a seperate node in the endpoint configuration:
profile: cert_profile: tls_server cert_subject_style: enroll
Are now read from the profiles, so there is no longer an extra definition in the workflow.
Signer on Behalf¶
The section authorized_signer is used to define the certificates which are accepted to do a “request on behalf”. The list is given as a hash of hashes, were each entry is a combination of one or more matching rules.
Possible rules are subject, profile and identifier which can be used in any combination. The subject is evaluated as a regexp against the signer subject, therefore any characters with a special meaning in perl regexp need to be escaped! Identifier and profile are matched as is. The rules in one entry are ANDed together. If you want to provide alternatives, add multiple list items. The name of the rule is just used for logging purpose.
The request must carry the password in the challengePassword attribute. The sample config above shows a static password example but it is also possible to use request parameters to lookup a password using connectors:
challenge: mode: bind value@: connector:scep.connectors.challenge args: - "[% context.cert_subject %]" connectors: challenge: class: Connector::Builtin::Authentication::Password LOCATION: /home/pkiadm/democa/passwd.txt
This will use the cert_subject to validate the given password against a list found in the file /home/pkiadm/democa/passwd.txt. For more details, check the man page of OpenXPKI::Server::Workflow::Activity::Tools::ValidateChallengePassword
A request is considered to be a renewal if the request is not self-signed but the signer subject matches the request subject. Renewal requests pass authentication if the signer certificate is valid in the current realm and neither revoked nor expired. You can allow expired certificates by setting renewal.notafter (Not implemented yet!).
If you set the allow_man_authen policy flag, request that fail any of the above authentication methods can be manually authenticated via the UI.
To completly skip authentication, set allow_anon_enroll policy flag.
The policy setting max_active_certs gives the maximum allowed number of valid certificates sharing the same subject. If the certificate count after issuance of the current request will exceed this number, the workflow stops in the PENDING_POLICY_VIOLATION state. If this parameter is not set, no checks are done. There are several settings that influence this check, based on the operation mode:
If you set the auto_revoke_existing_certs policy flag, all certificates with the same subject will be revoked prior to running this check. This does not make much sense with max_active_certs larger than 1 as all certificates will be revoked as soon as a new enrollment is started! The intended use is replacement of broken systems where the current certificate is no longer used anyway.
If the request is a renewal or replacement request, it is allowed to exceed the max_active_certs by one.
The default config has a static value of 1 for renewals and 0 for initial requests. If you set approval_points to 1, this will result in an immediate issue of certificate renewal requests but requires operator approval on initial enrollments.
Assume you want to use an ldap directory to auto approve initial requests based on the mac address of your client:
eligible: initial: value@: connector:your.connector args: - "[% context.cert_subject %]" - "[% context.url_mac %]" connectors: devices: ## This connector just checks if the given mac ## exisits in the ldap class: Connector::Proxy::Net::LDAP::Simple LOCATION: ldap://localhost:389 base: ou=devices,dc=mycompany,dc=com filter: (macaddress=[% ARGS.1 %]) binddn: cn=admin,dc=mycompany,dc=com password: admin attrs: macaddress
To have the mac in the workflow, you need to pass it with the request as an url parameter to the wrapper: http://host/scep/scep?mac=001122334455.
For more options and samples, see the perldoc of OpenXPKI::Server::Workflow::Activity::Tools::EvaluateEligibility
A request is approved if it reaches the number of approvals defined by the approval_points policy setting. As written above, you can use a data source to get one approval point via the eligibility check. If a request has an insufficient number of approvals, the workflow will stop and an operator must give an approval using the WebUI. By raising the approval points value, you can also enforce a four-eyes approval. If you do not want manual approvals, set the policy flag allow_man_approv to zero - all requests that fail the eligibility check will be immediately rejected.
SCEP Server Token¶
This is the cryptographic token used to sign and decrypt the SCEP communication itself. It is not related to the issuing process of the requested certificates!
The crypto configuration of a realm (crypto.yaml) defines a default token to be used for all scep services inside this realm. In case you want different servers to use different certificates, you can add additional token groups and reference them from the config using the token key.
The value must be the name of a token group, which needs to be registered as an anonymous alias:
openxpkiadm alias --realm democa --identifier <identifier> --group democa-special-scep --gen 1
Note that you need to care yourself about the generation index. The token will then be listed as anonymous group item:
openxpkiadm alias --realm democa === anonymous groups === democa-special-scep: Alias : democa-special-scep-1 Identifier: O9vtjge0wHpYhDpfko2O6xYtCWw NotBefore : 2014-03-25 15:26:18 NotAfter : 2015-03-25 15:26:18
Profile Selection / Certificate Template Name Extension¶
This feature was originally introduced by Microsoft and uses a Microsoft specific OID (18.104.22.168.4.1.311.20.2). If your request contains this OID and the value of this oid is listed in the profile map, the workflow will use the given profile definition to issue the certificate. If no OID is present or the value is not in the map, the default profile from the server configuration is used.
The map is a hash list:
profile_map: tlsv2: tls_server_v2 client: tls_client
Subject rendering is based on the profile and subject information given in the config:
profile: cert_profile: tls_server cert_subject_style: enroll
The subject will be created using Template Toolkit with the parsed subject hash as input vars. The vars hash will use the name of the attribute as key and pass all values as array in order of appearance (it is always an array, even if the attribute is found only once!). You can also add SAN items but there is no way to filter or remove san items that are passed with the request, yet.
Example: The default TLS Server profile contains an enrollment section:
enroll: subject: dn: CN=[% CN.0 %],DC=Test Deployment,DC=OpenXPKI,DC=org
The issued certificate will have the common name extracted from the incoming request but get the remaining path compontens as defined in the profile.
Revoke on Replace¶
If you have a replace request (signed renewal with signer validity outside the renewal window), you can trigger the automatic revocation of the signer certificate. Setting a reason code is mandatory, supported values can be taken from the openssl man page (mind the CamelCasing), the delayed_revocation_time is optional and can be relative or absolute date as consumed by OpenXPKI::DateTime, any empty value becomes “now”:
revoke_on_replace: reason_code: superseded delayed_revocation_time: +000002
The above gives your friendly admins a 48h window to replace the certificates before they show up on the next CRL.
Note: Without any other measures, this will obviously enable an attacker who has access to a leaked key to obtain a new certificate. We used this to replace certificates after the Heartbleed bug with the scep systems seperated from the public network.