Downloading and Installing

Running the command line scripts below will warn you of any missing dependencies. You can also do this yourselves directly by running perl Build.PL. The current dependencies (and one recommendation) are:

You are also encouraged to create a configuration file to setup various defaults for you. Suitable contents for this are given in the Configuration File section below and a sample file PeCR.cfg appears in the release. This will need editing before use.

Requesting a new Host Certificate requires a valid personal certificate (referenced using authcert and authkey: see the Configuration File section).

bin/cli request --server --cn "rjavig6.dl.ac.uk" -c PeCR.cfg --pin "pinforhost" \
--keyout ./newhostkey.pem
# You'll now be prompted for a passphrase (and conformation) to protect ./newhostkey.pem
# and then the passphrase for the private key specified in authkey in the Config File.
# CA Policy requires a min of 16 characters for passphrases that protect private keys
# You may also just press <ENTER> when prompted for a host password since that they
# are usually installed without password protection, instead relying on filesystem security

Once the request has been approved AND the certificate signed it can then be downloaded as described under "Retrieving a Certificate"

Retrieving a Certificate

To retrieve a personal UK eScience Certificate

bin/cli retrieve -c PeCR.cfg --certout ./newusercert.pem --keyin ./newuserkey.pem
# You'll now be prompted for the passphrase that protects ./newuserkey.pem
# that you provided when you made your request.

To retrieve a Host Certificate

# This is the same as for a User certificate except we have provided
# matching names to the host request to facilitate cut+paste
bin/cli retrieve -c PeCR.cfg --certout ./newhostcert.pem --keyin ./newhostkey.pem
# You'll now be prompted for the passphrase provided when you made your request.

Bulk scripts

There are two additional components of PeCR for Bulk requests. One is a file containing a list of FQDNs (to be used as certificate subject names / CNs) and the other is a directory or directories into which ALL the keys (and respectively certs) of the Bulk will be placed, or indeed obtained from in the case of a Bulk Renew. Care should be taken that previous values are not overwritten when doing such a Renew. The respective key and certificate directories can be set in the config file as well as on the command line.

The FQDNs.txt file should contain one FQDN per line, no additional whitespace.

You should also set the authkey and authcert (your personal certificate) in your config file if you're doing new bulkrequests.

A new feature of the CA Portal is that your RA Operator has a "Manage Bulk" link to facilitate the approval of Bulks.

Keys are expected to have the name FQDN_key.pem and certificates FQDN_cert.pem

Restrictions

All certificates in the Bulk must be within the same RA's domain (i.e. the same as your personal certificate) and their FQDNs must be within the same domain.

To save you having to type in the same password (or just return) lots of times, we assume that the passphrases of private keys for the certificates to be renewed are identical; likewise we encrypt with a single password (or return) for all new keys generated.

There is a maximum of 1000 requests in one bulk - please contact if this is insufficient for your needs.

You won't currently get a reminder when your certificates are ready to download (to avoid inundating you with emails). We are hoping to sort this in the future, but in the meantime expect the certificates to be ready by close of play on the day after your RA Operator has approved them.

You won't currently get a reminder when the certificates in your Bulk are about to expire. We are hoping to sort this in the future, but in any case it is good practice to setup your own reminders using tools such as Nagios.

Once a bulk is created you can't add to it [although you can do Bulkrenews with a FQDNs.txt for certificates of several Bulks, and some that aren't in a Bulk - the scripts will treat them as they are, but your RA will have to do one approval for each Bulk and one for each standalone].

There is no Bulkrevoke script and there are no plans to add it in the future.

New Bulk Requests

# keydir and certdir must exist and be set in your config file if they aren't present on the commandline
bin/cli bulkrequest -c PeCR.cfg --cnfile FQDNs.txt --pin "pinforbulk"
# You'll now be prompted for the passphrase (and conformation) to protect all the keys that are stored in keydir
# * They must all have the same passphrase.
# * You may just press <ENTER> when prompted for these passphrases since they are usually installed
# without password protection, instead relying on filesystem security.
# You'll then be asked for the passphrase for your certificate's private key (authkey in the Config File).
# NB: a 500 error usually means wrong passphrase for your personal certificate's private key.

Once the requests have all been approved (using the RA Operator's Manage Bulk i/f) AND the corresponding certificates signed (see Restrictions above) they can be downloaded as described under "Bulk Retrievals" below.

Bulk Retrievals

# For retrieving after a NEW request then you can just use the directories in your config file
# For renewals, to avoid overwriting old certificates, you should provide them as shown
bin/cli bulkretrieve -c PeCR.cfg --cnfile FQDNs.txt --keydir new_bulkreqs --certdir new_bulkreqs
# You'll now be prompted for the passphrase provided when you made your request.

Bulk Renewals

If you have a number of certificates that are already part of a Bulk (including under the previous regime) then they can be renewed together. Your RA Operator will again be able to take advantage of the new "Manage Bulk" i/f to make his/her job easier. They'll need gathering and placing in the same directory, in separate key and certificate .pem files with the name format described above.

# keydir and certdir must exist and be set in your config file if they aren't present on the commandline (like below)
# The files in keydir and certdir (regardless of whether you have separate directories or not) must have correct
# permissions for hostkeys and hostcerts and be named according to the style described above
bin/cli bulkrenew -c PeCR.cfg --cnfile FQDNs.txt --renewkeydir new_bulkreqs --keydir old_keydir --certdir old_certdir
# You'll now be prompted for the passphrase (and conformation) to protect all the keys that are stored in
# your renewkeydir (they must all have the same passphrase).
# You'll then be prompted for the passphrase for the private keys of the certs being renewed (again they
# must all be the same).
# You may also just press <ENTER> when prompted for these passphrases since they
# are usually installed without password protection, instead relying on filesystem security.
# A 500 error usually means you've got entered the wrong passphrase for the certificates being renewed.

Reference

Options

--cn lowercase-name
Use lowercase-name as the Common Name (CN) in new user and host certificate requests. Renewals get their CN from the existing certificate.

--cnfile cnfilename
The cnfilename is the file containing a list of FQDNs (to be used as certificate subject names / CNs). These should be one per line with no whitespace, not even blank lines.

--pin alphanumeric-PIN
The alphanumeric-PIN should be at least 10 alphanumeric characters and will be used as the PIN that you have to provide to your RA Operator for new user and host certificate requests.

--authcert certfilename
Use the file certfilename as the certificate for renewals. See also --authkey.

--authkey keyfilename
Use the file keyfilename as the private key used for renewals. See also --authcert.

--keyin keyfilename
Use the file keyfilename to get the private key (created with the --keyout option during the corresponding request or rewnew) to match the certificate being downloaded during retrieval.

--keyout keyfilename
Use keyfilename as the filename to store the private key generated in a new or renew request. This will then need to be provided in the --keyin option during retrieval.

--keydir keydirname
Use keydirname as the directory in which to store the private keys generated by bulk new requests. Also the directory from which to get the previous key when doing a renewal.

--certdir certdirname
Use certdirname as the directory in which to store the certificates downloaded during bulk retrieval. Also the directory from which to get the previous certificate when doing a renewal.

--renewkeydir renewkeydirname
Use renewkeydirname as the directory in which to store the private keys generated by bulk renew requests. It is only used by Bulkrenew, keydir and certdir being used at retrieval.

--server
This is used for new requests to state that a host certificate is required.

-d
Provides some debugging information about the requests being made and the options used.

--reason "appropriate reason"
For revocation requests you must give an appropriate reason for why you are requesting your certificate is revoked. Since this is likely to be more than a single word it is likely that you'll have to enclose it in quotes to protect the embedded spaces from the shell.

Config File

These are the several values you can set in each of the various sections of the config file