Setting up a private key and a private certificate

This topic describes the procedure for setting up a private key and a private certificate for deploying WORM solutions by using IBM Cloud® Object Storage.

The first step involves creating a certificate signing request (CSR) and registering the client certificate with IBM Cloud Object Storage Manager via Client Registration REST API and obtaining a private key (RSA based) signed with IBM Cloud Object Storage Manager Certificate Authority. Once the signed private certificate is obtained, we can use the RSA private key and private certificate for creating the locked vaults on the IBM Cloud Object Storage system. Additionally, for HTTPS (TLS) communication, the root CA certificate of the IBM Cloud Object Storage system is also required.

Note:
  • A private account must be created before an automation script or procedure is run.
  • A private account must be created each time an incorrect IBM Cloud Object Storage CA certificate is specified while generating the Keystore.
  1. Create a directory that will hold private key and certificates by issuing this command:
    mkdir mydomain2.com.ssl/
  2. To generate a keystore that will store the private key, CSR, and certificates, issue the following command in the /opt/ibm/MCStore/jre/bin directory:
    keytool -genkey -alias mydomain2 -keyalg RSA -keysize 2048 -keystore mydomain2.jks
    Note: You should make a note of the alias name as it has to be used in the later steps.
  3. Generate CSR by issuing the following command:
    keytool -certreq -alias mydomain2 -keyalg RSA -file mydomain2.csr -keystore mydomain2.jks
  4. Create a private account on IBM Cloud Object Storage Manager.
  5. Using the private account created, send the CSR to IBM Cloud Object Storage Manager to be signed by issuing the following command:
    
    curl -u <privateuser>:<password> 
    -k 'https://<COS Manager IP>/manager/api/json/1.0/clientRegistration.adm' 
    -d 'expirationDate=1508869800000' --data-urlencode 'csr=-----BEGIN NEW CERTIFICATE REQUEST-----
    
    MIICzjCCAbYCAQAwWTELMAkGA1UEBhMCSU4xCzAJBgNVBAgTAktBMRIwEAYDVQQHEwlCYW5nYWxv
      cmUxDDAKBgNVBAoTA1NEUzENMAsGA1UECxMESVNETDEMMAoGA1UEAxMDSUJNMIIBIjANBgkqhkiG
      9w0BAQEFAAOCAQ8AMIIBCgKCAQEApfVgjnp9vBwGA6Y/g54DBr1wWtWeSAwm680M42O1PUuRwV92
      9UDBK9XEkY2Zb+o08Hvspd5VMU97bV7cnN8Fi8WuujHCdgAVuezTT0ZCHjVHl2L6CYql7hmWIazk
      TOaROoYlhzZCgQrDyVNIw6XuvkWo3eUIRyi1r6nafUFiqUtMEerEhEYa6cmm5qpeb2GKYJdeN53W
      SF0yrUCi9gRgPJiAq6lVSl+wWekbI6lwIAtJVyojx93lRl/KdxfFmh/sriUx//a6+I0OBli6EmEV
      BsHeG2HccS1diJ4+eUetXvfkYMjO6kRvYraSVKX022a4Jqki8iYDNf4XvRzOz5YbLQIDAQABoDAw
      LgYJKoZIhvcNAQkOMSEwHzAdBgNVHQ4EFgQUrgpT7F8Z+bA9qDxqU8PDg70zFj4wDQYJKoZIhvcN
      AQELBQADggEBADW4xuxBaaH9/ZBLOll0tXveSHF8Q4oZo2MhSWf34Shu/ZxC17H8NqCCMyxqVdXI
      6kbdg1se5WLCq/JJA7TBcgCyJJqVjADt+RC+TGNc0NlsC7XpeRYLJtxqlKilsWnKJf5oRvA1Vg5P
      nkTjCE9XvUzhJ/tTQjNBJSh8nN7Tbu/q5mTIGG9imARPro2xQpvwiFMHrq/f1uNeZ3SeuLxwQtkK
      4zge7XwyY63lrKsN0z2a4CPNzU0q68TGL1aE93QDpJYusSeTB0m2om4iTSNgsQKRmYqGDSXM3no/
      90UeTAgHjhJ82bGEOfP9FVm+6FnYydr1Endg1aEizC+sArk4e8E=
      -----END NEW CERTIFICATE REQUEST-----' -v
    
    Note: The expiration time should be specified in milliseconds.
  6. Curl command provides a certificate in the response, as follows:
    
    "-----BEGIN CERTIFICATE-----
    \nMIIEczCCAlugAwIBAgIQeijQBskfm0v3kYQcBOBmxTANBgkqhkiG9w0BAQ0FADCB\nkTELMAkGA1UE
    BhMCVVMxETAPBgNVBAgMCElsbGlub2lzMRAwDgYDVQQHDAdDaGlj\nYWdvMRMwEQYDVQQKDApDbGV2ZX
    JzYWZlMRkwFwYDVQQDDBBkc05ldCBNYW5hZ2Vy\nIENBMS0wKwYDVQQFEyQwMmQxMjk5ZS05Nzc3LTRl
    NmItODg3Yy0wYmMzNzJkODU1\nMzc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6ySn/qZR3e3Xl0rVqqukgCqO\nBnQhI5WN4HkONkyaquJruTLHUlWX5T01q/y
    LnrRt8TCBA4qnX7HMlEmQkXiF5Poj\nBcyCTctYu1HlijHjsWO9kztUfljI5OkVyS1q1FqcZQiziHHRi
    AEWbnrYn6Fgq13g\nIws7Lw9Utogj54tPCwJ8gEkoW4eTO4tnZmPTTdWlmVhTdEjVRxE8fotztHJuVis
    P\nmFCxBPWJZ8IP9t2C/4Zi1PuqXI/8YZx8LPIcQUcRxeLURIgQrpb7
    \n-----END CERTIFICATE-----\n"
  7. Remove the '/n' character from the certificate (from BEGIN to END CERTIFICATE) and store the certificate in a file.
  8. Get the CA certificate of IBM Cloud Object Storage Manager and import into the keystore created in step 2. To import the CA certificate, issue the following command:
    
    keytool -importcert -trustcacerts -noprompt -alias cleversafeca -file
    <cleversafe-cafile-loc>  -keystore mydomain2.jks -storepass  <keystore-password>
  9. Import the certificate into the keystore by issuing the following command:
    
    keytool -importcert -trustcacerts -alias mydomain2 -file <client-cert-location> -keystore 
    mydomain2.jks -storepass  <keystore-password>
    Note: You can set up a private key and a private certificate by using this script mcstore_lockedvaultpreconfig.sh available at /opt/ibm/MCStore/scripts, as follows:
    Setting up a private key and private certificate by using the automation script
    1. Run mcstore_lockedvaultpreconfig.sh <keystorealiasname> <keycertLocationDirectory> <COSManagerIP> <username> <expirationDays> <COSCACertFile>, where the first 4 arguments are mandatory and the last two (expirationDays and COSCACertFile) are optional.

      If the expiration date (expirationDays) is not specified, then the command will take the default expiration time, which is 365 days.

      If the IBM Cloud Object Storage CA certificate (COSCACertFile) is not specified, then the CA file will be downloaded from the IBM Cloud Object Storage Manager.

    2. For more information on the description of the parameters, see the mmcloudgateway man page.
      For example,
      ./mcstore_lockedvaultpreconfig.sh test /root/svt 9.10.0.10 newuser2
      The system displays output similar to this:
      
      Enter KeyStore Password:
      Enter Private Account Password:
      Validating the inputs and the configuration....
      COS Manager is reachable. Proceeding with Configuration...
      
      Transparent Cloud Tiering Server RPM already installed. Proceeding with Configuration...
      
      Python libraries are already installed. Proceeding with Configuration...
      
      CURL already installed. Proceeding with Configuration...
      
      Downloading COS CA Certificate....
      Validation completed for inputs and the proceeding with configuration....
      Generating a new Keystore and Private Key...
      What is your first and last name?
        [Unknown]:  dmeo1
      What is the name of your organizational unit?
        [Unknown]:  dmeo1
      What is the name of your organization?
        [Unknown]:  demo2
      What is the name of your City or Locality?
        [Unknown]:  demo1
      What is the name of your State or Province?
        [Unknown]:  demo
      What is the two-letter country code for this unit?
        [Unknown]:  KA
      Is CN=dmeo1, OU=dmeo1, O=demo2, L=demo1, ST=demo, C=KA correct? (type "yes" or "no")
        [no]:  yes
      
      Importing COS CA Certificate to Key Store.....
      Certificate was added to keystore
      Generating a CSR....
      Sending CSR to CleverSafe to be signed.....
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100  2990  100  1781  100  1209   5310   3605 --:--:-- --:--:-- --:--:--  5316
      Retrieving Certificate from Response.....
      Importing Client Certificate to Keystore.....
      Certificate reply was installed in keystore
      Pre-configuration for Locked Vault completed successfully.
      IMPORTANT: /root/svt/test.ssl contains private key, keystore and private certificate.
      You must keep a back up of /root/svt/test.ssl.