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 mc admin accesskey commands #5038

Merged
merged 16 commits into from
Oct 4, 2024

Conversation

taran-p
Copy link
Contributor

@taran-p taran-p commented Sep 18, 2024

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers
under the terms of the Apache 2 license.
By creating this pull request I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 license.

Description

Adds mc admin accesskey commands that are equivalent to mc idp ldap accesskey commands, but for builtin users.

mc idp ldap accesskey create-with-login is not brought over as it is unnecessary for builtin users.

Motivation and Context

mc idp ldap accesskey commands currently have no builtin equivalents.

How to test this PR?

Use commands on builtin users. For mc admin accesskey list, minio/minio#20381 is necessary.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Optimization (provides speedup with no functional changes)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Fixes a regression (If yes, please add commit-id or PR # here)
  • Unit tests added/updated
  • Internal documentation updated
  • Create a documentation update request here

@zveinn
Copy link
Contributor

zveinn commented Oct 1, 2024

@taran-p can you resolve the conflicts ? and when you're done.. please tag someone again to take a look

@taran-p taran-p marked this pull request as ready for review October 2, 2024 17:16
@shtripat
Copy link
Contributor

shtripat commented Oct 3, 2024

Testing with latest MinIO master and seeing below

$ mc  mc admin accesskey create m1 --access-key user1 --secret-key user1234                                   
Access Key: user1                                                                                                                                 
Secret Key: user1234                                                                                                                              
Expiration: NONE                                                                                                                                  
Name:                                                                                                                                             
Description:                                                                                                                                      

$ mc  mc admin accesskey ls m1                                                                                
$ mc admin accesskey info    m1 user1
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xfe275c]

goroutine 1 [running]:
github.com/minio/mc/cmd.nilExpiry(...)
        github.com/minio/mc/cmd/idp-ldap-accesskey-info.go:184
github.com/minio/mc/cmd.commonAccesskeyInfo(0x6883b9?)
        github.com/minio/mc/cmd/idp-ldap-accesskey-info.go:174 +0x4dc
github.com/minio/mc/cmd.mainAdminAccesskeyInfo(0xc00071d801?)
        github.com/minio/mc/cmd/admin-accesskey-info.go:49 +0x13
github.com/minio/cli.HandleAction({0x115f840?, 0x13fdf28?}, 0x4?)
        github.com/minio/[email protected]/app.go:490 +0x50
github.com/minio/cli.Command.Run({{0x133e545, 0x4}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x13716fa, 0x21}, {0x0, ...}, ...}, ...)
        github.com/minio/[email protected]/command.go:242 +0x935
github.com/minio/cli.(*App).RunAsSubcommand(0xc0005056c0, 0xc0005b0d00)
        github.com/minio/[email protected]/app.go:380 +0xc5b
github.com/minio/cli.Command.startApp({{0x1345787, 0x9}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1388bd4, 0x2e}, {0x0, ...}, ...}, ...)
        github.com/minio/[email protected]/command.go:346 +0xaf8
github.com/minio/cli.Command.Run({{0x1345787, 0x9}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1388bd4, 0x2e}, {0x0, ...}, ...}, ...)
        github.com/minio/[email protected]/command.go:117 +0x418
github.com/minio/cli.(*App).RunAsSubcommand(0xc000487dc0, 0xc0006296c0)
        github.com/minio/[email protected]/app.go:380 +0xc5b
github.com/minio/cli.Command.startApp({{0x133f4df, 0x5}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1355e26, 0x14}, {0x0, ...}, ...}, ...)
        github.com/minio/[email protected]/command.go:346 +0xaf8
github.com/minio/cli.Command.Run({{0x133f4df, 0x5}, {0x0, 0x0}, {0x0, 0x0, 0x0}, {0x1355e26, 0x14}, {0x0, ...}, ...}, ...)
        github.com/minio/[email protected]/command.go:117 +0x418
github.com/minio/cli.(*App).Run(0xc000505180, {0xc00003e1e0, 0x6, 0x6})
        github.com/minio/[email protected]/app.go:260 +0xa7b
github.com/minio/mc/cmd.Main({0xc00003e1e0, 0x6, 0x6})
        github.com/minio/mc/cmd/main.go:142 +0x445
main.main()
        github.com/minio/mc/main.go:28 +0x2c

Just created user not getting listed and info command panics. Please check.

@taran-p
Copy link
Contributor Author

taran-p commented Oct 3, 2024

@shtripat accesskey info issue fixed. Not listing root access keys is a server side issue.

Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

Works fine. One suggestion on below

./mc admin accesskey edit m1 user1
Successfully edited access key `user1`. 

while edit, it should ask for editing at least one value, otherwise its just making a server round trip without any changes.

cmd/admin-accesskey-remove.go Outdated Show resolved Hide resolved
Copy link
Contributor

@shtripat shtripat left a comment

Choose a reason for hiding this comment

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

lgtm

@harshavardhana harshavardhana merged commit 07eeb10 into minio:master Oct 4, 2024
5 checks passed
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.

4 participants