Role-Based Access Control
Use these M4500 CLI commands to enable role-based access control (RBAC), create roles, rules, and feature groups, and assign roles to users.
Role-Based Access Contro (RBAC) allows you to create roles which define CLI executive permissions of individual functions, and assign roles to a user let him own the suitable authorization to manage and operate the system
User Role
A role contains one or multiple rules that define the operations allowed for the user who is assigned the role, and one user can have multiple roles. For example, if role1 allows managing layer 3 routing functions and role2 allows managing VLAN function, then a user who has both role1 and role2 can manage routing and VLAN functions.
By default, the switch supports the following user roles, which you cannot change or delete:
- network-admin: it has full access commands to the entire system.
- network-operator: it can access read-only commands to the entire system.
CLI command string inside a rule
A CLI command string is used to define a rule whether to allow one or one kind of CLI commands to execute. The format of command string may be whole and explicit CLI command, likes “ip igmp snooping querier vlan 1”, or use wildcard character ‘*’ on the tail of command string to match any string after prefix string, likes “ip igmp snooping *”.
Feature
Features are system predefined sets of CLI commands which are divided by related functions.
Feature Group
Feature group provides to bond multiple features into a group name and assign to a role. The system administrator could customize different feature groups according to functional categories and give it an appropriate nickname.
Rule
A rule defines what operation could be allowed to execute for a role, in other words, a role is made up of one or many rules. A rule can be applied only one action which is a CLI command string, a feature, or a feature group. Every role has an invisible default rule “deny all commands”, if a user enters a command which can’t match any rule of its roles, this command won’t be permitted to execute.
Each rule must be assigned rule ID which is a unique integer between 1 and 256. All Rules in one role are applied in descending order of role ID, and it means when one role has many rules and some of their definition are conflicting, then the greater ID will be higher priority than less one.
For example, below role1 can execute all related commands about “show ip igmp”, except the command and sub-commands of “show ip igmp snooping”:
Switch(config)# role name role1 Switch(config-role)# rule 1 permit command “show ip igmp *” Switch(config-role)# rule 2 deny command “show ip igmp snooping *”
One user could have many roles and there isn’t any different priority between roles. However, if rules are conflicting between roles, the rule that is “permit” action will be higher priority than another rule that is “deny” action.
For example, below User1 has role1 and role2, therefore, User1 can show all related commands of “ip igmp”. Since rule1 of role2 conflicts to rule1 of role1 and “permit” action is higher priority, the rule1 of role2 is invalid.
Switch(config)# role name role1 Switch(config-role)# rule 1 permit command “show ip igmp *”
Switch(config)# role name role2 Switch(config-role)# rule 1 deny command “show ip igmp groups *”
Switch(config)# username User1 role role1 Switch(config)# username User1 role role2
role based access control enable
This command is used to enable RBAC function.
When enabling RBAC function, only users who have the role 'network-admin' will build rule merged table immediately, other login users won't allow to execute any CLI command until he logout and login again to rebuild its rule merged table.
| Default | Disabled |
| Format | role based access control enable |
| Mode | Global Config |
no role based access control enable
This command is used to disable RBAC function.
| Format | no role based access control enable |
| Mode | Global Config |
role name
This command is used to create a new role or configure an existing role.
-
Role name only allows to include alphabetic, numeric, dash, dot or underscore characters only. Name
must start with a letter and the size of the name string must be less than or equal to 31 characters.
- Role name is case sensitive.
- System default role “network-admin” and “network-operator” can’t be destroyed or modified.
- The maximum number of roles is 256.
- A role can’t be deleted, if any user still uses it.
| Default | None |
| Format | role name <role-name> |
| Mode | Global Config |
no role name
This command is used to destroy an existing role.
| Format | no role name <role-name> |
| Mode | Global Config |
role description
This command is used to set a description to a role.
-
Description could use single quotation mark (‘) or double quotation marks (“) to wrap the text which
includes space character.
- The maximum length of description is 255 characters.
| Default | None |
| Format | description <text> |
| Mode | Role Interface |
no role description
This command is used to clear a description to a role.
| Format | no description |
| Mode | Role Interface |
rule command
This command is used to add a rule of command string to a role.
- Rule ID is an integer between 1 and 256, and it shall be unique inside one role.
- Maximum length of rule command string is 255 characters.
-
Rule command isn't case sensitive and it's converted to lower case automatically. All space characters
put to the head or tail of command string will be deleted, and multiple space characters inside a command string will convert to a single space character.
-
Wildcard character ‘*’ can match any string after prefix string, and it shall put to the tail of command
string.
-
Every word inside a command string must be a whole command word, except the last word with
wildcard character ‘*’ could be incomplete, likes “show mac-addr*.
-
RBAC doesn't support "No form" format of rule command string, because normal command (e.g.
“shutdown”) and "No form" command (e.g. “no shutdown”) are bonded together to deal with access permission.
-
RBAC Rule command shall not start with keyword "do", because keyword "do" will be removed before a
command is executed.
| Default | None |
| Format | rule <rule-id> <deny | permit> command <command-string> |
| Mode | Role Interface |
no rule (to delete a rule of command string)
This command is used to delete a rule of command string from a role.
| Format | no rule <rule-id> |
| Mode | Role Interface |
rule feature
This command is used to add a rule of feature to a role.
- Rule ID is an integer between 1 and 256, and it shall be unique inside one role.
- Feature name comes from an existing feature.
| Default | None |
| Format | rule <rule-id> <deny | permit> <read | read-write> feature <name> |
| Mode | Role Interface |
no rule (to delete a rule of feature)
This command is used to delete a rule of feature from a role.
| Format | no rule <rule-id> |
| Mode | Role Interface |
rule feature group
This command is used to add a rule of feature group to a role.
- Rule ID is an integer between 1 and 256, and it shall be unique inside one role.
- Feature group name comes from an existing feature group.
- Feature group name is case sensitive.
| Default | None |
| Format | rule <rule-id> <deny | permit> <read | read-write> feature-group <name> |
| Mode | Role Interface |
no rule (to delete a rule of feature group)
This command is used to delete a rule of feature group from a role.
| Format | no rule <rule-id> |
| Mode | Role Interface |
rule <rule-id> <deny | permit> <read | read-write>
This command is used to add a rule which denies or permits to execute all “show commands” or all commands.
Rule ID is an integer between 1 and 256, and it shall be unique inside one role
| Default | None |
| Format | rule <rule-id> <deny | permit> <read | read-write> |
| Mode | Role Interface |
no rule (to delete a rule of read-write commands)
This command is used to delete a rule of read or read-write commands from a role.
| Format | no rule <rule-id> |
| Mode | Role Interface |
rule renumber
This command is used to change a rule ID to another one.
- Rule ID is an integer between 1 and 256, and it shall be unique inside one role.
- Old rule ID comes from an existing rule, and new rule ID shall not overlap to an existing rule ID.
| Default | None |
| Format | rule <old-rule-id> renumber <new-rule-id> |
| Mode | Role Interface |
role feature-group name
This command is used to create a new feature group or configure an existing feature group.
-
Feature group name only allows to include alphabetic, numeric, dash, dot or underscore characters only.
Name must start with a letter and the size of the name string must be less than or equal to 63 characters.
- Feature group name is case sensitive.
- The maximum number of feature groups is 256.
- A feature group can’t be deleted, if any rule of a role still uses the feature group.
| Default | None |
| Format | role feature-group name <name> |
| Mode | Global Config |
no role feature-group name
This command is used to delete an existing feature group.
| Format | no role feature-group name <name> |
| Mode | Global Config |
feature
This command is used to add a feature into a feature group.
Feature name is a system pre-defined name, and you need to assign the existing feature name.
| Default | None |
| Format | feature <feature-name> |
| Mode | Feature Group Interface |
no feature
This command is used to remove a feature from a feature group.
| Format | no feature <feature-name> |
| Mode | Feature Group Interface |
username role
This command is used to to assign a role to a user.
- Username comes from an existing user.
- Role name comes from an existing role
-
User 'admin' is a system account of administrator and it shall always own the system default role
'network-admin'.
- When RBAC function enables, a user can't access any command if he doesn’t be assigned any role.
| Default | None |
| Format | username <user-name> role <role-name> |
| Mode | Global Config |
no username role
This command is used to remove a role from a user.
| Format | no username <user-name> role <role-name> |
| Mode | Global Config |
show role
This command is used to to display information about roles.
| Default | None |
| Format | show role [name <role-name>] |
| Mode | Privileged EXEC |
Display Message
| Parameter | Definition |
|---|---|
| Role Based Access Control | Indicates RBAC function is enabled or disabled now. |
| Current numbers of roles | Indicates how many numbers of roles are created now. |
| Maximum numbers of roles | Indicates maximum numbers of roles can be created on the device. |
| Role | The role name. |
| Description | Description of this role. |
| ID | Rule ID |
| Permit | Indicates permit or deny this role to execute this rule. |
| Read & Write | Indicate this rule is “read” or “read-write”. The “read” means “it can execute ‘show command’ only”, and “read-write” means “it can execute ‘all commands’. |
| Type | Indicates type of this rule is command string, feature, or feature group. |
| Content | Detailed definition of this rule. |
show role feature
This command is used to to display information about features.
| Default | None |
| Format | show role feature [detail | name <feature-name>] |
| Mode | Privileged EXEC |
Display Message
| Parameter | Definition |
|---|---|
| Feature name | The system pre-defined feature name. |
| Command strings of feature | This feature contains related command strings. |
show role feature group
This command is used to to display information about feature groups.
| Default | None |
| Format | show role feature-group [detail | name <feature-group-name>] |
| Mode | Privileged EXEC |
Display Message
| Parameter | Definition |
|---|---|
| Current numbers of feature group | Indicates how many numbers of feature groups are created now. |
| Maximum numbers of feature group | Indicates maximum numbers of feature groups can be created on the device. |
| feature group name | The name of this feature group. |
| Feature name | The system pre-defined feature name. |
| Command strings of feature | This feature contains related command strings. |
show role user
This command is used to to display information of roles according to users.
Commands “show role user current”, “show role feature *”, and “show role feature groups *” are RBAC common permitted commands, and that is in order to get what commands can be executed for every user.
| Default | None |
| Format | show role user [current | name <username>] |
| Mode | Privileged EXEC |
Display Message
| Parameter | Definition |
|---|---|
| Username | The name of assigned user. |
| Authenticated method | Indicates what kind of login authenticated method to use by this user. Possible values are LOCAL, RADIUS, and TACACS |
| Current numbers of total commands per user | The total command strings which include rule commands, features, and feature-groups of all roles are assigned to this user. |
| Maximum numbers of total commands per user | The maximun numbers of total commands can be set to one user. |
| Role | The role name. |
| Description | Description of this role. |
| ID | Rule ID |
| Permit | Indicates permit or deny this role to execute this rule. |
| Read & Write | Indicate this rule is “read” or “read-write”. The “read” means “it can execute ‘show command’ only”, and “read-write” means “it can execute ‘all commands’. |
| Type | Indicates type of this rule is command string, feature, or feature group. |
| Content | Detailed definition of this rule. |