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

Add metadata to API Keys created by server #5090

Merged
merged 1 commit into from
Apr 14, 2021
Merged

Conversation

axw
Copy link
Member

@axw axw commented Apr 14, 2021

Motivation/summary

Add application: "apm" in the metadata of API Keys created by APM Server, so they can later be identified as having been created by/for APM. The metadata must not be used for auth; it is purely for informational purposes.

Metadata will be shown when running apm-server apikey info with the --json flag, but not in the default text format.

Checklist

How to test these changes

  1. Create an API Key with apm-server apikey create
  2. Run apm-server apikey info --json --id <id-from-step-1>, check the metadata shows {"application": "apm"}

Related issues

#3461
elastic/kibana#77966

Add `application: "apm"` in the metadata of API Keys
created by APM Server, so they can later be identified
as having been created by/for APM. The metadata must
not be used for auth; it is purely for informational
purposes.
@axw axw added the v7.13.0 label Apr 14, 2021
@axw axw mentioned this pull request Apr 14, 2021
3 tasks
@apmmachine
Copy link
Contributor

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #5090 opened

  • Start Time: 2021-04-14T03:36:17.806+0000

  • Duration: 42 min 40 sec

  • Commit: c767d0f

Test stats 🧪

Test Results
Failed 0
Passed 6274
Skipped 120
Total 6394

Trends 🧪

Image of Build Times

Image of Tests

@axw axw marked this pull request as ready for review April 14, 2021 04:18
@axw axw requested review from a team and sorenlouv April 14, 2021 04:19
@axw
Copy link
Member Author

axw commented Apr 14, 2021

@sqren tagged you for review just to check that the metadata I've proposed here is OK.

@axw axw merged commit 90d05c3 into elastic:master Apr 14, 2021
@axw axw deleted the apikey-metadata branch April 14, 2021 09:07
mergify bot pushed a commit that referenced this pull request Apr 14, 2021
Add `application: "apm"` in the metadata of API Keys
created by APM Server, so they can later be identified
as having been created by/for APM. The metadata must
not be used for auth; it is purely for informational
purposes.

(cherry picked from commit 90d05c3)

# Conflicts:
#	changelogs/head.asciidoc
axw added a commit that referenced this pull request Apr 15, 2021
* Add metadata to API Keys created by server (#5090)

Add `application: "apm"` in the metadata of API Keys
created by APM Server, so they can later be identified
as having been created by/for APM. The metadata must
not be used for auth; it is purely for informational
purposes.

(cherry picked from commit 90d05c3)

# Conflicts:
#	changelogs/head.asciidoc

* Delete head.asciidoc

Co-authored-by: Andrew Wilkins <[email protected]>
mergify bot pushed a commit that referenced this pull request Apr 27, 2021
Add `application: "apm"` in the metadata of API Keys
created by APM Server, so they can later be identified
as having been created by/for APM. The metadata must
not be used for auth; it is purely for informational
purposes.

(cherry picked from commit 90d05c3)

# Conflicts:
#	changelogs/7.13.asciidoc
@stuartnelson3 stuartnelson3 self-assigned this May 3, 2021
@stuartnelson3
Copy link
Contributor

Tested against commit https://github.com/elastic/apm-server/commits/0aa1b50a5b680be19556d53f870fa9723bdc9a03, {"application": "apm"} is present.

# ./apm-server version
apm-server version 7.13.0 (amd64), libbeat 7.13.0 [0aa1b50a5b680be19556d53f870fa9723bdc9a03 built 2021-04-27 15:36:50 +0000 UTC]
# ./apm-server apikey create -E output.elasticsearch.username=admin -E output.elasticsearch.password=changeme
API Key created:

Name ........... apm-key
Expiration ..... never
Id ............. KsKLMXkBBOTslOUzyQld
API Key ........ tdeCQFN2S-akzUIouGQEJw (won't be shown again)
Credentials .... S3NLTE1Ya0JCT1RzbE9VenlRbGQ6dGRlQ1FGTjJTLWFrelVJb3VHUUVKdw== (use it as "Authorization: APIKey
<credentials>" header to communicate with APM Server, won't be shown again)
~/w/a/apm-server-7.13.0-linux-x86_64 (master %=)
# ./apm-server apikey info --json --id KsKLMXkBBOTslOUzyQld -E output.elasticsearch.username=admin -E output.ela
sticsearch.password=changeme
{
        "api_keys": [
                {
                        "id": "KsKLMXkBBOTslOUzyQld",
                        "name": "apm-key",
                        "creation": 1620033915229,
                        "invalidated": false,
                        "username": "admin",
                        "metadata": {
                                "application": "apm"
                        }
                }
        ]
}

@stuartnelson3 stuartnelson3 removed their assignment May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants