Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Adding support for NATS/Blobstore cert rotation without recreating vms #2323

Merged
merged 11 commits into from
Oct 7, 2021

Conversation

lnguyen
Copy link
Member

@lnguyen lnguyen commented Sep 28, 2021

Currently rotating nats or blobstore certs, vms need to be recreated so BOSH agent can get the new certs.

This was proposed #2309 and is the PR for the changes on the director side

camilalonart and others added 10 commits September 28, 2021 14:36
- Config functions to calculate blobstore and nats config shas
- New database columns on VM to track current deployed config shas
- Methods to test if the config has changed since VM was last deployed

Signed-off-by: Joseph Palermo <jpalermo@pivotal.io>
[#179396629] Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM

Signed-off-by: Brian Upton <bupton@vmware.com>
* The update_settings method of the agent class now takes a generic hash
  in preparation for adding more settings to it.
* Updated the UpdateInstanceSettingsStep to re-use the existing method
  on the Instance class instead of re-implementing it.

[#179396629] Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM

Signed-off-by: Joseph Palermo <jpalermo@vmware.com>
Extracts the blobstore credential redaction into a method on the
blobstore in prepartion to use it elsewhere

[#179396629] Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM

Signed-off-by: Brian Upton <bupton@vmware.com>
- Only if the blobstore has been changed

[#179396629] Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM
- Only if the nats signing credentials or server CA have changed
- Also persist the new sha1 into the database

[#179396629] Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM

Signed-off-by: Joseph Palermo <jpalermo@pivotal.io>
…ing deploy

[#179396629] Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM

Signed-off-by: Joseph Palermo <jpalermo@pivotal.io>
Signed-off-by: Long Nguyen <nguyenlo@vmware.com>
This pre-populates the new blobstore_config_sha1 and nats_config_sha1
columns with the current SHAs when the database is migrated to add the
columns. These values are read off of the Bosh::Director::Config global
class because:

1. The Sequel gem's migration system does not allow outside parameters
   to be passed to the migrations. So it is not possible to pass in the
   full config object directly.
2. The config file path is passed in to the migrate script, so we cannot
   load the file directly in the migration (unless we assume the config
   file path)

Loading the global state onto the Config method required calling the
aptly named `configure_evil_config_singleton!` method, previously only
called when the BOSH Director app is launched.

[#179396629] TAS-29 Rotation of certificates/credentials stored in the bosh-agent metadata can be updated without recreating the VM
…rectors.

This is due to config class tries to read or create uuid if it doesn't exist.

Signed-off-by: Brian Upton <bupton@vmware.com>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 28, 2021

CLA Missing ID

  • ❌ The commit (4c60a45 ,c66778fe582f4009a71913501cecd3b718cafbd2 ,f50313165796c43a9de7b19163497889d22fe6a4 ,9c299b8a17ae32d89afc0c41ee0dc278aab0034c ,3b031a55e4eabbdb6aa7389d9fef444f52aab219) is missing the User's ID, preventing the EasyCLA check. Consult GitHub Help to resolve.For further assistance with EasyCLA, please submit a support request ticket.

Copy link
Contributor

@bgandon bgandon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've learnt a lot while reading that diff, thanks. This looks like a very neat piece of changes, I appreciate the effort in submitting readable individual commits. Approving with no further remarks.

}
end

AgentClient.with_agent_id(vm.agent_id, @model.name).update_settings(settings)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this class agent_client.* is used only this place doesn't use it anymore. Maybe we should add a comment to make sure why it doesn't use agent_client.*.

@beyhan
Copy link
Member

beyhan commented Oct 7, 2021

What kind of tests have been executed with this change? I also added two general comments to the Feature proposal: #2309 (comment)

@jpalermo
Copy link
Member

jpalermo commented Oct 7, 2021

What kind of tests have been executed with this change?

We've run all of the unit tests and we've done manual testing of this change and the bosh agent change. We've tested new director with old agent, old director with new agent, and new director with new agent.

We've also tested a full certificate/credential rotation with new director and new agent to verify the happy path works and no VM recreations are needed to rotate the nats and blobstore certificates and credentials.

We have NOT run all of the integration tests or Bosh Acceptance Tests. We will probably not run those before merging as they are very expensive to setup and run. We'll instead fix any bugs uncovered by failures in those test suites after the fact (but before we release a new version of the bosh director)

@jpalermo jpalermo merged commit dbbc328 into master Oct 7, 2021
@jpalermo jpalermo deleted the update_agent_certs_in_update_settings branch October 7, 2021 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants