Rotate Fastly automation token for Emergency Alerts application
🚧 This process should not be necessary unless a token has been compromised or lost.
GOV.UK Emergency Alerts has a Fastly account token for evicting objects from the CDN cache. The token should not normally need to be changed. Under exceptional circumstances it may be necessary to change the token, for example if the token has been compromised.
Changing a Fastly automation tokens requires superuser
access. Ask someone
from govuk-platform-engineering@ or govuk-senior-tech-members@ to do this for
you.
It doesn’t matter who creates the token, as long as they have superuser access. Any superuser can delete or rotate any API token in the GOV.UK Fastly account.
Follow these steps to revoke old tokens and issue new one.
The new token will allow purge requests to the 3 Emergency Alerts services on Fastly and nothing else.
Please do not create multiple tokens, even though this was done in the past. Having 3 separate tokens does not improve security in this case; it only creates toil.
- Log into https://manage.fastly.com/.
- Go to Account tokens.
- Filter by the string “Emergency Alerts” to narrow down the list.
- Delete any lost or compromised tokens by pressing the trash bin icon in the rightmost column.
- Go to API tokens.
- Choose Create Token, near the top-right of the page. The UI may prompt you for your account password.
- Under Type, choose Automation token. Do not create a User token.
- Name the token
GOV.UK Emergency Alerts
. - Under Scope, tick the two Purge boxes:
purge_all
andpurge_select
. Ensure nothing else is ticked under the Scope heading. - Under Access, choose One or more services and select
Production GOV.UK
,Staging GOV.UK
andIntegration GOV.UK
, then choose Apply. - Under Expiration, choose Never expire. Do not set an expiry date.
- Choose Create Token.
- Copy the token and securely transfer it to the person from Emergency Alerts team who is requesting it. For example, calling the person via Google Meet and pasting it into the chat would be acceptable. Avoid sending the token by email or any communication tool that might leave lasting copies.
The person from Emergency Alerts team will then update the configuration in their 3 AWS accounts: preview, staging and production. For each account, they will need to:
- Update
fastly-api-key
in SSM Parameter Store. - Find the
eas-app-govuk-alerts
service ineas-app-cluster
in ECS. - Stop the running task within the
eas-app-govuk-alerts
dwiserviceapp. ECS will automatically start a new task with the new credentials. - Check that the key works by rebuilding the public alerts site for that environment. It will automatically rebuild after the container app restarts.