Regenerating a New Set of Certificates for Sensor to Server Communication when the Originals Expire
search cancel

Regenerating a New Set of Certificates for Sensor to Server Communication when the Originals Expire

book

Article ID: 376576

calendar_today

Updated On:

Products

Carbon Black EDR (formerly Cb Response)

Issue/Introduction

When the original sensor to server certificates expire, the sensors will no longer communicate with the server. This article goes over getting the sensors connected back up, generating a new set of client and server (self-signed) certificates that can be swapped out for continued communication.

Environment

  • Carbon Black EDR Server: 7.7.0 and higher

Cause

The default certificates are good for 10 years. 

Resolution

Phase 1: Disabling Client Checks

These config changes need to be done for Primary and Minion nodes.

  1. Edit /etc/cb/nginx/conf.d/includes/cb.server.base_sensor to set the Nginx ssl_verify_client from optional to off. 

    sed -i '/s/optional/off/' /etc/cb/nginx/conf.d/includes/cb.server.base_sensor
  2. Edit /etc/cb/cb.conf, to disable client and revocation checks. Setting EnforceClientCerts=False and adding EnforceClientCertRevocation=False 
    sed -i -e '/^EnforceClientCertRevocation=/d' -e 's/^EnforceClientCerts=.*/EnforceClientCerts=False\nEnforceClientCertRevocation=False/' /etc/cb/cb.conf

Phase 2: Generating a New Client CA Certificate Set

  1. Stop the services. How to Start, Stop and Restart EDR Application Services
  2. Regenerate the cb-client-ca certificate set.
    1. 7.9.0 and Higher 
      /usr/share/cb/cbssl certs --regenerate client-ca --force
    2. 7.8.0 - 7.8.1 
      export FORCE_REGENERATE=client-ca && /usr/share/cb/cbssl certs --regenerate client-ca
  3. Clustered instances, sync the client CA certificate to continue ingestion on the minion nodes.
    /usr/share/cb/cbcluster sync-certs
  4. Start the EDR services.
  5. Revoke all sensor group certificates so they regenerate using the new client CA. 
    /usr/share/cb/cbssl sensor_certs -c /etc/cb/cb.conf --revoke --group-name '*'

Phase 3: Generate a Temporary Self-signed Server Certificate. 

Note: If a custom certificate is already uploaded to the server, skip to Phase 4.

  1. Download the attached temp_server_cert.sh file
  2. Create a temporary folder on the EDR server, placing the temp_server_cert.sh file in the folder
  3. Change into the new folder directory
  4. Update the script permissions
    chmod 700 temp_server_cert.sh
  5. Run the script:
    ./temp_server_cert.sh $(hostname)
  6. Transfer the <hostname>.pem and the <hostname>.key file to an endpoint with console access. 
  7. In the Console, navigate to [Username] > Settings > Server Certificates
  8. Click + Add certificate
    1. Name: Temporary
    2. Upload Certificate: Upload the .pem file
    3. Upload Private Key: Upload the .key file
    4. Click Add to save. 

Phase 4: Update Sensor Groups Server Certificate

Note: It's suggested to create a new group or use a group with minimal sensors that are easily accessible to validate they recieve the temporary cert and stay online. 

  1. Edit each Sensor Group settings by setting the "Assign Server Certificate" to the newly created temp certificate.
  2. Wait for sensor to show the temporary cert name in the "Server Certificate" column in the Sensors page.  

Phase 5: Allow Sensors to Check In

  1. Wait until all active sensors show this new "temporary" certificate name in the Server Certificate column on the sensors before going to the next steps. 
  2. Before going to Phase 6. Any sensor that has not connected and received the new cert will need to be reinstalled.

Phase 6: Generate a New "Legacy" Self-signed Certificate

  1. Stop the EDR services. 
  2. Generate the new "Legacy" server certificate: 
    1. 7.9.0 and Higher: Any sensor or group still set to Legacy will prompt before continuing:
      /usr/share/cb/cbssl certs --regenerate legacy --force
    2. 7.8.0 - 7.8.1: Any sensor or group still set to Legacy will be ignored.:
      export FORCE_REGENERATE=legacy && export IGNORE_CERT_USAGE=legacy  && /usr/share/cb/cbssl certs --regenerate legacy
  3. Clustered instances, sync the new Legacy server certificate to continue ingestion on the minion nodes 
    /usr/share/cb/cbcluster sync-certs
  4. Reset Client Checks
    1. Edit /etc/cb/nginx/conf.d/includes/cb.server.base_sensor to set the Nginx check to optional. 
      sed -i 's/off/optional/' /etc/cb/nginx/conf.d/includes/cb.server.base_sensor
    2. Edit /etc/cb/cb.conf, to re-enable client and revocation checks. Setting EnforceClientCerts=True and adding EnforceClientCertRevocation=True
      sed -i -e '/^EnforceClientCert.*=.*$/{s/True/False/}' /etc/cb/cb.conf
  5. Start the EDR services.
  6. Log back into the console. 
    1. Go into the [Username] > Settings > Server Certificates
    2. Verify the "Legacy" certificate has a new thumbprint and updated expiration date. 
    3. Assign the sensor groups back to "Legacy" server certificate.
  7. When all sensors are now using the new Legacy server certificate, the temporary certificate can be deleted from the console.

Phase 7: Installation Packages and Cloned Machines

  1. All previous installation packages should be deleted. Download new installation packages from the console to be created with the new certificates. 
  2. VDI Cloned: The Golden image will need to be re-installed with a new installtion package. 

Additional Information