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

[Fleet] Deprecate expiration option in POST /enrollment_api_keys #191575

Open
jillguyonnet opened this issue Aug 28, 2024 · 2 comments
Open

[Fleet] Deprecate expiration option in POST /enrollment_api_keys #191575

jillguyonnet opened this issue Aug 28, 2024 · 2 comments
Labels
Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@jillguyonnet
Copy link
Contributor

jillguyonnet commented Aug 28, 2024

Update: I realised that the Security API does allow setting the key expiration on creation (no expiry by default). If the intent is to have the Fleet API reflect that, then we should keep this option and pass it to the Security API instead. I didn't find another issue that mentions this.

The request schema for the POST /enrollment_api_keys endpoint allows an optional expiration option:

export const PostEnrollmentAPIKeyRequestSchema = {
body: schema.object({
name: schema.maybe(schema.string()),
policy_id: schema.string(),
expiration: schema.maybe(schema.string()),
}),

However, this option is never used in the backend:

export async function generateEnrollmentAPIKey(
soClient: SavedObjectsClientContract,
esClient: ElasticsearchClient,
data: {
name?: string;
expiration?: string;
agentPolicyId: string;
forceRecreate?: boolean;
}
): Promise<EnrollmentAPIKey> {

It is also not possible to specify an expiration when creating an enrollment token in the UI:
Image

If this option is deprecated, perhaps it could be removed altogether as part of the upcoming API breaking changes: #189746

@jillguyonnet jillguyonnet added the Team:Fleet Team label for Observability Data Collection Fleet team label Aug 28, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jillguyonnet
Copy link
Contributor Author

jillguyonnet commented Aug 28, 2024

A detail that could be addressed as part of this: the log for enrollment token creation currently reads:

Creating enrollment API key [object Object]

Edit: fixed in #191807

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

No branches or pull requests

2 participants