Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Determine which company_id you need to generate a new encryption key pair for. You can find this under System > Companies. Click edit and look for the number at the end in the URL bar.
  2. Remove the existing private_keypublic_key, and private_key_passphrase values stored for your company_id from the company_setting table. The following is a query that will do just that (replace COMPANYID with your actual company ID).

    Code Block
    languagesql
    titleRemove key pair query
    UPDATE `company_settings` SET `value`='' WHERE `company_id`=COMPANYID AND `key` IN ('private_key', 'public_key', 'private_key_passphrase')
  3. Find your API key. If you don't already have an API user, create one.
  4. SSH into your server and navigate to the directory where Blesta is installed.
  5. Execute the following command, replacing USER with your API username, KEY with your API user key, and COMPANYID with your company ID.

    Code Block
    php index.php api/companies/generateKeyPair.json -u USER -k KEY -m POST -p "company_id=COMPANYID&bits=3072"
    Info

    Generating encryption keys is hard work. This make take a minute or so to complete. When finished you should receive output similar to

    No Format
    {"response":{"privatekey":"-----BEGIN RSA PRIVATE KEY-----\nMIIG4wIBAAKCAYEAr8kl
    87IAUSUFaXVNARrPvx1PzZhYU+f7i2xQvIqnVwLfmTU+\n6myDcmCerTWru3XpFciWl2nEeR52DAQaaR
    7YwZr8L4chJmly9AbIUuxW1eml59y+\nytz+Yl6fdxfVpmSSeYUv6+xX6CFaF49R3OkFhcm6FxzY9RxM
    ...
  6. You're done! You can not now go back into Blesta and set a new Private Key Passphrase if you want.

...