5.7. Performing Bulk Issuance
			There can be instances when an administrator needs to submit and generate a large number of certificates simultaneously. A combination of tools supplied with Certificate System can be used to post a file containing certificate requests to the CA. This example procedure uses the 
PKCS10Client command to generate the requests and the sslget command to send the requests to the CA.
		- Since this process is scripted, multiple variables need to be set to identify the CA (host, port) and the items used for authentication (the agent certificate and certificate database and password). For example, set these variables for the session by exporting them in the terminal:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
The local system must have a valid security database with an agent's certificate in it. To set up the databases:- Export or download the agent user certificate and keys from the browser and save to a file, such as
agent.p12. - If necessary, create a new directory for the security databases.
mkdir ${d}mkdir ${d}Copy to Clipboard Copied! Toggle word wrap Toggle overflow  - If necessary, create new security databases.
certutil -N -d ${d}certutil -N -d ${d}Copy to Clipboard Copied! Toggle word wrap Toggle overflow  - Stop the Certificate System instance.
systemctl stop pki-tomcatd@instance_name.service
systemctl stop pki-tomcatd@instance_name.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow  - Use
pk12utilto import the certificates.pk12util -i /tmp/agent.p12 -d ${d} -W p12filepassword# pk12util -i /tmp/agent.p12 -d ${d} -W p12filepasswordCopy to Clipboard Copied! Toggle word wrap Toggle overflow If the procedure is successful, the command prints the following output:pk12util: PKCS12 IMPORT SUCCESSFUL
pk12util: PKCS12 IMPORT SUCCESSFULCopy to Clipboard Copied! Toggle word wrap Toggle overflow  - Start the Certificate System instance.
systemctl start pki-tomcatd@instance_name.service
systemctl start pki-tomcatd@instance_name.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow  
 - Two additional variables must be set. A variable that identify the CA profile to be used to process the requests, and a variable that is used to send a post statement to supply the information for the profile form.
export post="cert_request_type=pkcs10&xmlOutput=true&profileId=caAgentServerCert&cert_request=" export url="/ca/ee/ca/profileSubmitSSLClient"
export post="cert_request_type=pkcs10&xmlOutput=true&profileId=caAgentServerCert&cert_request=" export url="/ca/ee/ca/profileSubmitSSLClient"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
This example submits the certificate requests to thecaAgentServerCertprofile (identified in theprofileIdelement of thepoststatement. Any certificate profile can be used, including custom profiles. - Test the variable configuration.
echo ${d} ${p} ${f} ${nick} ${cahost} ${caport} ${post} ${url}echo ${d} ${p} ${f} ${nick} ${cahost} ${caport} ${post} ${url}Copy to Clipboard Copied! Toggle word wrap Toggle overflow  - Generate the certificate requests using (for this example)
PKCS10Client:time for i in {1..10}; do /usr/bin/PKCS10Client -d ${d} -p ${p} -o ${f}.${i} -s "cn=testms${i}.example.com"; cat ${f}.${i} >> ${f}; done perl -pi -e 's/\r\n//;s/\+/%2B/g;s/\//%2F/g' ${f} wc -l ${f}time for i in {1..10}; do /usr/bin/PKCS10Client -d ${d} -p ${p} -o ${f}.${i} -s "cn=testms${i}.example.com"; cat ${f}.${i} >> ${f}; done perl -pi -e 's/\r\n//;s/\+/%2B/g;s/\//%2F/g' ${f} wc -l ${f}Copy to Clipboard Copied! Toggle word wrap Toggle overflow  - Check the status and the transaction logs for the CA.
/etc/init.d/pki-ca status tail -f /var/log/pki-ca/transactions&
/etc/init.d/pki-ca status tail -f /var/log/pki-ca/transactions&Copy to Clipboard Copied! Toggle word wrap Toggle overflow  - Submit the bulk certificate request file created in step 4 to the CA profile interface using
sslget. For example:cat ${f} | while read thisreq; do /usr/bin/sslget -n "${nick}" -p ${p} -d ${d} -e ${post}${thisreq} -v -r ${url} ${cahost}:${caport}; donecat ${f} | while read thisreq; do /usr/bin/sslget -n "${nick}" -p ${p} -d ${d} -e ${post}${thisreq} -v -r ${url} ${cahost}:${caport}; doneCopy to Clipboard Copied! Toggle word wrap Toggle overflow