Skip to content

Latest commit

 

History

History
46 lines (39 loc) · 2.78 KB

gitaly-token-rotation.md

File metadata and controls

46 lines (39 loc) · 2.78 KB

Gitaly token rotation

Execution

To disable enforcement of gitaly authentication:

  • Disable enforcement of gitaly authentication by setting default_attributes['omnibus-gitlab']['gitlab_rb']['gitaly']['auth_transitioning'] = true in gprd-base-stor-gitaly
  "default_attributes": {
    [...]
    "omnibus-gitlab": {
      "gitlab_rb": {
        [...]
        "gitaly": {
          "auth_transitioning": true,
          [...]

Backup and replace the current auth_token

  • Save the current auth_token in case we need to revert.
    • ./bin/gkms-vault-show gitlab-omnibus-secrets gprd | jq -r '.["omnibus-gitlab"].gitlab_rb.gitaly.auth_token' within chef-repo
    • Save it it 1Password and document the name it was saved under.
    • Also backup the whole file locally in case it gets corrupted later during the change ./bin/gkms-vault-show gitlab-omnibus-secrets gprd > gitlab-omnibus-secrets.bak
  • Create a new random token echo "$(pwgen 16 1)-gprdtoken"
  • Update the auth token in the gitlab-omnibus-secrets gprd vault by setting gitaly['auth_token']
  • Update the auth token in the gitlab-omnibus-secrets gprd vault for the application by setting ["omnibus-gitlab"].gitlab_rb.gitlab_rails.gitaly_token
  • and apply that to the fleet
    • knife ssh -C3 roles:gprd-base-fe-api 'sudo chef-client'
    • knife ssh -C3 roles:gprd-base-stor-gitaly 'sudo chef-client'
    • knife ssh -C3 roles:gprd-base-fe-web 'sudo chef-client'
    • knife ssh -C3 roles:gprd-base-be-sidekiq 'sudo chef-client'
    • knife ssh -C3 roles:gprd-base-console-node 'sudo chef-client'

Verify that the tokens are updated in all the places and ensure that authentication is working as expected.

Rollback

Follow the execution steps, but instead of creating a new token via pwgen set the old token in the vault.