Overview
The proposed solution for this is to introduce a new policy attribute for roles (e.g. host, user) called api_key_enabled. This attribute will default to true if not explicitly provided, and will dictate whether Conjur:
-
Generates an API key when the role is created by policy:
This is relevant for newly created roles. If api_key_enabled: false, then this role will never receive a randomly generated API key.
-
Allows an API key to be rotated for a role:
This prevents an API key from being created after the initial role creation.
-
Allows an API key to be validated for a role:
This covers the case when an existing role (that has an API key) is updated to set api_key_enabled to false. In this case the API key already exists, but the Role model will always return false for api_key_valid?.
Scenarios
| Scenario |
api_key_enabled: true |
api_key_enabled: false |
Role (host/user) created |
API key is generated and stored in the database. |
API key in the database is set to null. |
| Rotate role key |
API key is rotated and new value is stored in database. |
Value in database is unchanged and server responds with an error that keys are disabled for the role and cannot be rotated. |
Default authentication authn |
API in request is validated against key in database. |
API key validation always returns false and authentication fails.
|
Update role to set api_key_enabled: true |
No change |
If key is null, generate value and store it in database. |
Update role to set api_key_enabled: false |
Set api key in DB to null |
No change to database. |
Prototype
Branches for prototype exploration for this proposal are available at:
Areas not covered in prototype
- Error messages (specifically for CLI) when attempting to authenticate as a role that has no API key.
- Impact on docs for authenticators (to recommend adding this attribute).
Rough Effort Estimate
- Code Changes: 18 days
- Docs Updates: 8 days
Overview
The proposed solution for this is to introduce a new policy attribute for roles (e.g.
host,user) calledapi_key_enabled. This attribute will default totrueif not explicitly provided, and will dictate whether Conjur:Generates an API key when the role is created by policy:
This is relevant for newly created roles. If
api_key_enabled: false, then this role will never receive a randomly generated API key.Allows an API key to be rotated for a role:
This prevents an API key from being created after the initial role creation.
Allows an API key to be validated for a role:
This covers the case when an existing role (that has an API key) is updated to set
api_key_enabledtofalse. In this case the API key already exists, but the Role model will always returnfalseforapi_key_valid?.Scenarios
api_key_enabled: trueapi_key_enabled: falsehost/user) creatednull.authnapi_key_enabled: truenull, generate value and store it in database.api_key_enabled: falsenullPrototype
Branches for prototype exploration for this proposal are available at:
Areas not covered in prototype
Rough Effort Estimate