Privilege Management
Privilege management system of Palo refers to the privilege management mechanism of Mysql achieving table level fine-grained permission control and supporting white list mechanism.
Word explanation
-
User identity
user_identity
In the privilege system, a user is identified by a a
User Identity
. User identity consists of two parts:user name and
userhost
.username
is defined as the user name, which is composed of English cases.userhost
indicates the IP address of the user links.user_identity
is presented in the form ofusername@'userhost'
, indicating theusername
fromuserhost
.Another presentation of
user_identity
isusername@['domain']
, wheredomain
means domain name, which can be resolved to a group of ip through DNS or BNS (Baidu name service). The final presentation is a group ofusername@'userhost'
, so we useusername@'userhost'
to present in the following. -
Privilege
Privilege
The objects of privilege are nodes, databases, tables or resources. Different privileges represent different operation privileges.
-
Role
Role
Palo can create custom-named roles which can be seen as a collection of a set of privileges. A newly-created user can be given a role, which means the user will be automatically given the privileges owned by the role. Subsequent privilege changes to a role will also be reflected in the all privileges of the user belonging to this role.
-
User property
user_property
User property is directly attached to a user, not a user ID. That is, both
cmy@'192.%'
andcmy@['domain']
have the same set of user properties, which belong to the usercmy
, notcmy@'192.%'
orcmy@['domain']
.User properties include but are not limited to: maximum number of user connections, load cluster configuration, etc.
Supported operations
- Create a user: CREATE USER
- Delete a user: DROP USER
- Grant: GRANT
- Revoke: REVOKE
- Create a role: CREATE ROLE
- Drop a role: DROP ROLE
- View user privileges: SHOW GRANTS
- View created roles: SHOW ROELS
- View use property: SHOW PROPERTY
- Set user property: SET PROPERTY
Privilege descriptions
Palo currently supports the following privileges:
-
Node_priv
It means node changing privilege, including addition, deletion, offline and other operations of FE, BE, BROKER nodes. At present, this privilege can only be granted to Root users.
-
Grant_priv
It means changing privilege, which allows the performances such as granting, revocation, addition / deletion / change of user / role, etc.
-
Select_priv
It means privilege of read-only for databases and tables.
-
Load_priv
It means privilege of writing for databases and tables, including Load、Insert、Delete and other operations.
-
Alter_priv
It means privilege of changing databases and tables, including renaming database / table, addition / deletion / changing column and other operations.
-
Create_priv
It means privilege of creating databases and tables.
-
Drop_priv
It means privilege of deleting databases and tables.
-
Usage_priv
it means privilege of using some Resources.
Best practices
-
The following users and roles will be created automatically when Palo is initialized:
- Role admin: The role has Admin_priv, which means all privileges except node change.
- admin@'%':the user admin, the user is allowed to log in from any node, and the role is admin.
- Deleting or changing privileges for roles or users created by default is not supported.
- Users of the role admin can be created more than one.
-
Some instructions that may lead to conflicts
-
Domain name and ip conflict:
Suppose the following user is created:
CREATE USER cmy@['domain'];
and be granted with authorization:
GRANT SELECT_PRIV ON *.* TO cmy@['domain']
The domain name is resolved into two ip: iP1 and iP2
After supposing, we grant a separate authorization to
cmy@'ip1'
:GRANT ALTER_PRIV ON *.* TO cmy@'ip1';
Then the privilege of
cmy@'ip1'
is changed toSELECT_PRIV and ALTER_PRIV.And when we change the privilege of cmy@['domain'] again, cmy@'ip1'
will not follow the change. -
Repeated ip conflict:
Suppose the following user is created:
CREATE USER cmy@'%' IDENTIFIED BY "12345"; CREATE USER cmy@'192.%' IDENTIFIED BY "abcde";
In terms of priority,
'192.%'
takes precedence over'%'
. Therefore, when the usercmy
attempts to log in to Palo with password'12345'
from computer192.168.1.1
, the user will be rejected.
-
-
When the user forgets the password
Public cloud user can refer to Reset administrator password.
Refer to SET PASSWORD command to reset the password after login.