Add support for multiple admins (#8487)
Also define IAM policies for administering MinIO servermaster
parent
13a3d17321
commit
929951fd49
@ -0,0 +1,114 @@ |
||||
# MinIO Admin Multi-user Quickstart Guide [![Slack](https://slack.min.io/slack?type=svg)](https://slack.min.io) |
||||
MinIO supports multiple admin users in addition to default operator credential created during server startup. New admins can be added after server starts up, and server can be configured to deny or allow access to different admin operations for these users. This document explains how to add/remove admin users and modify their access rights. |
||||
|
||||
## Get started |
||||
In this document we will explain in detail on how to configure admin users. |
||||
|
||||
### 1. Prerequisites |
||||
- Install mc - [MinIO Client Quickstart Guide](https://docs.min.io/docs/minio-client-quickstart-guide.html) |
||||
- Install MinIO - [MinIO Quickstart Guide](https://docs.min.io/docs/minio-quickstart-guide) |
||||
|
||||
### 2. Create a new admin user with CreateUser, DeleteUser and ConfigUpdate permissions |
||||
Use [`mc admin policy`](https://docs.min.io/docs/minio-admin-complete-guide.html#policies) to create custom admin policies. |
||||
|
||||
Create new canned policy file `adminManageUser.json`. This policy enables admin user to |
||||
manage other users. |
||||
```json |
||||
cat > adminManageUser.json << EOF |
||||
{ |
||||
"Version": "2012-10-17", |
||||
"Statement": [ |
||||
{ |
||||
"Action": [ |
||||
"admin:CreateUser", |
||||
"admin:DeleteUser", |
||||
"admin:ConfigUpdate" |
||||
], |
||||
"Effect": "Allow", |
||||
"Sid": "" |
||||
}, |
||||
{ |
||||
"Action": [ |
||||
"s3:*" |
||||
], |
||||
"Effect": "Allow", |
||||
"Resource": [ |
||||
"arn:aws:s3:::*" |
||||
], |
||||
"Sid": "" |
||||
} |
||||
] |
||||
} |
||||
EOF |
||||
``` |
||||
|
||||
Create new canned policy by name `userManager` using `userManager.json` policy file. |
||||
``` |
||||
mc admin policy add myminio userManager adminManageUser.json |
||||
``` |
||||
|
||||
Create a new admin user `admin1` on MinIO use `mc admin user`. |
||||
``` |
||||
mc admin user add myminio admin1 admin123 |
||||
``` |
||||
|
||||
Once the user is successfully created you can now apply the `userManage` policy for this user. |
||||
|
||||
``` |
||||
mc admin policy set myminio userManager user=admin1 |
||||
``` |
||||
|
||||
This admin user will then be allowed to perform create/delete user operations via `mc admin user` |
||||
|
||||
### 3. Configure `mc` and create another user user1 with attached policy user1policy |
||||
``` |
||||
mc config host add myminio-admin1 http://localhost:9000 admin1 admin123 --api s3v4 |
||||
|
||||
mc admin user add myminio-admin1 user1 user123 |
||||
mc admin policy add myminio-admin1 user1policy ~/user1policy.json |
||||
mc admin policy set myminio-admin1 user1policy user=user1 |
||||
``` |
||||
|
||||
### 4. List of permissions defined for admin operations |
||||
#### Config management permissions |
||||
- admin:ConfigUpdate |
||||
|
||||
#### User management permissions |
||||
- admin:CreateUser |
||||
- admin:DeleteUser |
||||
- admin:ListUsers |
||||
- admin:EnableUser |
||||
- admin:DisableUser |
||||
- admin:GetUser |
||||
|
||||
#### Service management permissions |
||||
- admin:ListServerInfo |
||||
- admin:ServerUpdate |
||||
|
||||
#### User/Group management permissions |
||||
- admin:AddUserToGroup |
||||
- admin:RemoveUserFromGroup |
||||
- admin:GetGroup |
||||
- admin:ListGroups |
||||
- admin:EnableGroup |
||||
- admin:DisableGroup |
||||
|
||||
#### Policy management permissions |
||||
- admin:CreatePolicy |
||||
- admin:DeletePolicy |
||||
- admin:GetPolicy |
||||
- admin:AttachUserOrGroupPolicy |
||||
- admin:ListUserPolicies |
||||
|
||||
#### Give full admin permissions |
||||
- admin:* |
||||
|
||||
### 5. Using an external IDP for admin users |
||||
Admin users can also be externally managed by an IDP by configuring admin policy with |
||||
special permissions listed above. Follow [MinIO STS Quickstart Guide](https://docs.min.io/docs/minio-sts-quickstart-guide) to manage users with an IDP. |
||||
|
||||
## Explore Further |
||||
- [MinIO Client Complete Guide](https://docs.min.io/docs/minio-client-complete-guide) |
||||
- [MinIO STS Quickstart Guide](https://docs.min.io/docs/minio-sts-quickstart-guide) |
||||
- [MinIO Admin Complete Guide](https://docs.min.io/docs/minio-admin-complete-guide.html) |
||||
- [The MinIO documentation website](https://docs.min.io) |
@ -0,0 +1,154 @@ |
||||
/* |
||||
* MinIO Cloud Storage, (C) 2019 MinIO, Inc. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
* you may not use this file except in compliance with the License. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
|
||||
package iampolicy |
||||
|
||||
import ( |
||||
"fmt" |
||||
|
||||
"github.com/minio/minio/pkg/policy/condition" |
||||
) |
||||
|
||||
// AdminAction - admin policy action.
|
||||
type AdminAction string |
||||
|
||||
const ( |
||||
// HealAdminAction - allows heal command
|
||||
HealAdminAction = "admin:Heal" |
||||
|
||||
// Service Actions
|
||||
|
||||
// ListServerInfoAdminAction - allow listing server info
|
||||
ListServerInfoAdminAction = "admin:ListServerInfo" |
||||
|
||||
// ServerUpdateAdminAction - allow MinIO binary update
|
||||
ServerUpdateAdminAction = "admin:ServerUpdate" |
||||
|
||||
//Config Actions
|
||||
|
||||
// ConfigUpdateAdminAction - allow MinIO config management
|
||||
ConfigUpdateAdminAction = "admin:ConfigUpdate" |
||||
|
||||
// User Actions
|
||||
|
||||
// CreateUserAdminAction - allow creating MinIO user
|
||||
CreateUserAdminAction = "admin:CreateUser" |
||||
// DeleteUserAdminAction - allow deleting MinIO user
|
||||
DeleteUserAdminAction = "admin:DeleteUser" |
||||
// ListUsersAdminAction - allow list users permission
|
||||
ListUsersAdminAction = "admin:ListUsers" |
||||
// EnableUserAdminAction - allow enable user permission
|
||||
EnableUserAdminAction = "admin:EnableUser" |
||||
// DisableUserAdminAction - allow disable user permission
|
||||
DisableUserAdminAction = "admin:DisableUser" |
||||
// GetUserAdminAction - allows GET permission on user info
|
||||
GetUserAdminAction = "admin:GetUser" |
||||
|
||||
// Group Actions
|
||||
|
||||
// AddUserToGroupAdminAction - allow adding user to group permission
|
||||
AddUserToGroupAdminAction = "admin:AddUserToGroup" |
||||
// RemoveUserFromGroupAdminAction - allow removing user to group permission
|
||||
RemoveUserFromGroupAdminAction = "admin:RemoveUserFromGroup" |
||||
// GetGroupAdminAction - allow getting group info
|
||||
GetGroupAdminAction = "admin:GetGroup" |
||||
// ListGroupsAdminAction - allow list groups permission
|
||||
ListGroupsAdminAction = "admin:ListGroups" |
||||
// EnableGroupAdminAction - allow enable group permission
|
||||
EnableGroupAdminAction = "admin:EnableGroup" |
||||
// DisableGroupAdminAction - allow disable group permission
|
||||
DisableGroupAdminAction = "admin:DisableGroup" |
||||
|
||||
// Policy Actions
|
||||
|
||||
// CreatePolicyAdminAction - allow create policy permission
|
||||
CreatePolicyAdminAction = "admin:CreatePolicy" |
||||
// DeletePolicyAdminAction - allow delete policy permission
|
||||
DeletePolicyAdminAction = "admin:DeletePolicy" |
||||
// GetPolicyAdminAction - allow get policy permission
|
||||
GetPolicyAdminAction = "admin:GetPolicy" |
||||
// AttachPolicyAdminAction - allows attaching a policy to a user/group
|
||||
AttachPolicyAdminAction = "admin:AttachUserOrGroupPolicy" |
||||
// ListUserPoliciesAdminAction - allows listing user policies
|
||||
ListUserPoliciesAdminAction = "admin:ListUserPolicies" |
||||
// AllAdminActions - provides all admin permissions
|
||||
AllAdminActions = "admin:*" |
||||
) |
||||
|
||||
// List of all supported admin actions.
|
||||
var supportedAdminActions = map[AdminAction]struct{}{ |
||||
AllAdminActions: {}, |
||||
HealAdminAction: {}, |
||||
ListServerInfoAdminAction: {}, |
||||
ServerUpdateAdminAction: {}, |
||||
ConfigUpdateAdminAction: {}, |
||||
CreateUserAdminAction: {}, |
||||
DeleteUserAdminAction: {}, |
||||
ListUsersAdminAction: {}, |
||||
EnableUserAdminAction: {}, |
||||
DisableUserAdminAction: {}, |
||||
GetUserAdminAction: {}, |
||||
AddUserToGroupAdminAction: {}, |
||||
RemoveUserFromGroupAdminAction: {}, |
||||
ListGroupsAdminAction: {}, |
||||
EnableGroupAdminAction: {}, |
||||
DisableGroupAdminAction: {}, |
||||
CreatePolicyAdminAction: {}, |
||||
DeletePolicyAdminAction: {}, |
||||
GetPolicyAdminAction: {}, |
||||
AttachPolicyAdminAction: {}, |
||||
ListUserPoliciesAdminAction: {}, |
||||
} |
||||
|
||||
func parseAdminAction(s string) (AdminAction, error) { |
||||
action := AdminAction(s) |
||||
if action.IsValid() { |
||||
return action, nil |
||||
} |
||||
|
||||
return action, fmt.Errorf("unsupported action '%v'", s) |
||||
} |
||||
|
||||
// IsValid - checks if action is valid or not.
|
||||
func (action AdminAction) IsValid() bool { |
||||
_, ok := supportedAdminActions[action] |
||||
return ok |
||||
} |
||||
|
||||
// adminActionConditionKeyMap - holds mapping of supported condition key for an action.
|
||||
var adminActionConditionKeyMap = map[Action]condition.KeySet{ |
||||
AllAdminActions: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
HealAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
ListServerInfoAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
ServerUpdateAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
ConfigUpdateAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
CreateUserAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
DeleteUserAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
ListUsersAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
EnableUserAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
DisableUserAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
GetUserAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
AddUserToGroupAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
RemoveUserFromGroupAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
ListGroupsAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
EnableGroupAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
DisableGroupAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
CreatePolicyAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
DeletePolicyAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
GetPolicyAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
AttachPolicyAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
ListUserPoliciesAdminAction: condition.NewKeySet(condition.AllSupportedAdminKeys...), |
||||
} |
Loading…
Reference in new issue