-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[APM] Agent API Key Management #77966
Comments
Pinging @elastic/apm-ui (Team:apm) |
@graphaelli Looks good to me - I can very quickly do a mock of the create flyout for creating keys and add it to this issue so it's ready for implementation. |
FYI we have been involved by the Stack / Elasticsearch team in a work to homogeneize API keys. |
FYI our initiative to expose a dedicated view to manage Agent API Keys is well aligned with the transversal initiative on API keys. |
I assume in addition to the UI, there will be an API to manage these keys? So instead of automating it with apm-server today, a user could automate it by talking to the Kibana APM API. |
@ruflin Yes, sounds reasonable that we should document the API and thereby making it publicly accessible. |
I have updated description based on refinement to:
This raises an issue that I thought was already resolved - there doesn't appear to be a way to query keys by permission (all keys with APM application access) or to add metadata keys so they can be found later. I'd rather not use a hack like naming them in a certain way just to be able to find them later. Labeling this issue blocked for the moment while we resolve this. |
Hey team, I just wanted to make sure y’all were aware of the API Key Management UI under Stack Management. How does that UI relate to this one from a product and user perspective? Should there be cross-linking between the two? Is there any reusable code from that UI that can be used for this UI? |
Hey @cjcenizal, Yes we are aware of the existing API Management UI. The UI we are building is tailor-made for creating API keys to be used between APM agents and APM server. From what I can tell there is no UI for creating API keys - is that correct? If it's possible to tag API keys (eg. "apm") and the existing UI supports linking to this, this could make sense. Example of the url I'm thinking of:
|
Thanks @sqren! I'm going to tag in the @elastic/kibana-security team to answer your questions since they own that plugin. |
👋 hey folks - thanks for the ping, CJ. Allowing API Keys to be "tagged" would likely be something that we'd want to implement within ES. One possible solution is to add support for generic metadata (elastic/elasticsearch#48182), which Kibana and other solutions could take advantage of.
It's funny you ask. @thomheymann started work on a PR for this just recently (#82005). We had a discussion earlier today with @arisonl and @bytebilly, where we decided to postpone work on this. API Keys are used for a number of different things, and we want to take a step back and think about this more holistically before adding more UIs around them. I'd suggest doing the same here until we have a better idea of what we want to implement. Our hope is to have more concrete thoughts around this in the next couple of weeks. It's possible that we'll introduce new constructs or change existing ones around API Keys, so tailoring a ux around today's API Keys may not work for us in the near future. |
Cross linking #78222 to ensure efforts are aligned (or conciously kept separated). |
Thanks @simitt. Even with a centralized UI for managing API keys in Kibana, I still think it makes sense to have a dedicated APM view that only shows apm api keys. |
We had some discussion in the context of the broader plan for API keys, and we agreed it would be better to have a separate UI for APM API keys rather than considering this feature in the scope of #78222. Prioritization of metadata (or other alternatives to identify keys) will be discussed in the next few weeks. We can then synchronize on timelines. |
Sounds good. Thanks for the update @bytebilly |
With elastic/elasticsearch#70292 merged I'll mark this as no longer blocked. |
related to elastic/elasticsearch#73705, should make this possible. |
I don't have full visibility on the use of API keys and metadata that you are envisioning, so I want to point out that relying on metadata should not be considered a security paradigm since anyone with proper permissions can create API keys with arbitrary metadata, potentially the very same as what is set for APM. You could rely on the API key creator in conjunction with metadata to make it safer. This works well if the creator is an APM service account, rather than the end user interacting with the system. We already implemented that for Fleet, so there may be some similarities. Happy to discuss more if you will. |
@bytebilly I don't think this is going to be a security issue but I'll explain our use case and then you can tell me how I'm wrong :D Without the ability to filter by metadata we would have to refer the user to the general API keys view, where they'd have to manually sift through the list of possible 1000s of keys to find the ones relevant to APM. By filtering by metadata, we can show them just the relevant APM keys. If somebody has created a non-apm key and tagged it with "apm" (accidentally or maliciously) it will show up. This might create some confusion but I don't see any security concerns here. The only action the user can take is to revoke the key if they don't recognise it. Also, if a malicious actor succeeds in creating an API key it will show up in the general API key UI anyway, which should already be cause for concern, no? |
@sqren I agree with you. My concern was not specific to the view of keys, so I don't think it's a blocker here. |
with elastic/elasticsearch#75335 this is getting a lot closer to feasible. We still need pagination support which is on the way with elastic/elasticsearch#76144.
returns
|
pagination has landed, description updated accordingly - this is no longer blocked. |
Closing this issue. Issues have been created for documenting agent key management in APM Server and adding docs for the public APM app API. |
In order to create an APM agent key, users must have at least the Example (part of
Apart from providing appropriate error messages in the UI when certain privileges are missing, documentation will also be added for the APM Server and for the public APM app API. |
Metadata support added in elastic/elasticsearch#48182
Summary
APM has supported API Key authentication between agents and server for awhile. So far, the easiest way to manage keys is using the
apm-server apikey
subcommand. This is particularly burdensome for our ESS users. Here, we introduce a UI for managing those keys, matching the functionality provided by the current tool for creating and invalidating keys.For the initial UI, only immediate invalidation is needed - scheduled expiration is not needed.
For creation, keys should be able to include a scheduled expiration and include any combination equivalent of these 3 permissions:
Design
This UI could fit in with settings, like:
though the key names should not actually be links.
The create key button triggers a flyout similar to the one for create alert including:
@formgeist has signed off on the initial design and should be tagged for review of the final flyout.
Future
We can tackle integration with the getting started guide as a follow up -
secret_token
is still supported and will be for some time. Alerts/UI notification for soon to expire keys would also be a nice follow up to MVP.Security
To create a key, users must have the
manage_api_key
cluster privilege to create keys - failure to create the key due to permissions should mention this requirement.API Keys are only available per these conditions:
Elasticsearch API Calls
Create
Before creating a key, apm-server does a
has_privileges
check as explained here, adjusting the privileges as needed and ensuring the returnedhas_all_requested
value istrue
:To create the key, again adjusting for privileges specified:
When the key is created the user should be shown a message stating that they should save it as it can't be displayed again. The value shown should be base64 encoding of the
id + ":" + key
. This requirement may be lifted by the time this is implemented so be sure to verify it.Invalidate
To invalidate a key:
List
API Keys can be retrieved by convention via metadata using the paginated get api key api.
returns
Tasks:
The text was updated successfully, but these errors were encountered: