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 apikey subcommand #3157

Merged
merged 55 commits into from
Jan 14, 2020
Merged

Add apikey subcommand #3157

merged 55 commits into from
Jan 14, 2020

Conversation

axw
Copy link
Member

@axw axw commented Jan 14, 2020

Continuation of #3063

jalvz and others added 12 commits January 13, 2020 10:29
Co-Authored-By: Andrew Wilkins <[email protected]>
- Don't print error twice (i.e. by calling printErr and then returning to RunE)
  For now, just use Run and call os.Exit ourselves.
- Update "create" to just pass in the privileges requested for the API Key to
  HasPrivileges, rather than all of them.
- Update "create" to inform the auth'd user of which requested privileges they
  do not have.
@axw axw changed the title Add apikey command Add apikey subcommand Jan 14, 2020
axw added 4 commits January 14, 2020 18:07
- Revert param type change for authorization.NewBuilder
- Add a TODO to stop swallowing all DeletePrivileges errors
@codecov-io
Copy link

codecov-io commented Jan 14, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@f592de2). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff            @@
##             master    #3157   +/-   ##
=========================================
  Coverage          ?   78.89%           
=========================================
  Files             ?      106           
  Lines             ?     5587           
  Branches          ?        0           
=========================================
  Hits              ?     4408           
  Misses            ?     1179           
  Partials          ?        0
Impacted Files Coverage Δ
elasticsearch/security_api.go 0% <ø> (ø)

axw added 4 commits January 14, 2020 18:40
- Don't take value of "json" flag before it's resolved
- If no privilege flags are specified, pass ActionsAll into
  createAPIKeyWithPrivileges, not ActionAny.
@axw axw requested a review from simitt January 14, 2020 11:54
@@ -8,7 +8,7 @@ apm_server:
privileges: ['sourcemap:write','event:write','config_agent:read']
resources: '*'
beats:
cluster: ['manage_index_templates','monitor','manage_ingest_pipelines','manage_ilm']
cluster: ['manage_index_templates','monitor','manage_ingest_pipelines','manage_ilm', 'manage_security','manage_api_key']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is adding the cluster roles to beats role necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used by a system test that tests what happens when the user can create API keys, but doesn't have the privilege themself.

I'm not sure if beats_user has those privileges normally (I didn't add that bit). If not, I think maybe we should create a user dynamically for this test. In a follow up, preferably.

Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all the major comments were addressed, and we can create a follow up issue for smaller things.

Thanks @jalvz for all the effort you put into that, I think the CLI tool is pretty exhaustive and will be a great support for our users.

@graphaelli graphaelli merged commit 2b02570 into elastic:master Jan 14, 2020
@graphaelli graphaelli mentioned this pull request Jan 14, 2020
1 task
graphaelli pushed a commit to graphaelli/apm-server that referenced this pull request Jan 14, 2020
axw added a commit that referenced this pull request Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants