Dell Networking SONiC 基于角色的访问控制
Summary: 本文介绍 Dell Networking SONiC 中基于角色的访问控制。
This article applies to
This article does not apply to
This article is not tied to any specific product.
Not all product versions are identified in this article.
Instructions
什么是基于角色的访问控制?
基于角色的访问控制 (RBAC) 提供访问和授权控制。根据定义的角色向用户授予权限。管理员可以基于作业功能创建用户角色,以允许用户进行适当的系统访问。RBAC 对每个角色的权限进行了限制,以允许您对任务进行分区。
用户角色在登录时对用户进行身份验证和授权,并将用户置于 EXEC 模式。
每个用户角色都分配用于确定用户可以输入的命令以及用户可以执行的操作的权限。RBAC 提供了一种管理用户权限的有效方法。
Dell Networking SONiC 中提供的用户角色
| 角色 | 权限 |
|---|---|
| Admin | 管理员用户对系统具有完全读/写访问权限。这意味着它可以完全访问所有 show 命令、Linux shell 和配置。 |
| 运算符 | 操作员对系统的读取访问权限有限。这意味着它可以访问某些 show 命令,但不能在交换机中执行任何配置。 |
提醒:在 Dell SONiC 4.1 中,引入了两个新的用户角色,同一用户可以具有多个角色。
| 角色 | 权限 |
|---|---|
| Secadmin | secadmin 用户有权访问系统中与安全相关的所有命令。 |
| Netadmin | netadmin 用户有权访问管理流经交换机的流量的配置功能。 |
配置语法:
| 配置 | 说明 |
|---|---|
| admin@DELLSONiC:~$ sonic-cli | 输入 Dell SONiC CLI |
| DELLSONiC# 配置终端 | 进入配置模式。 |
| DELLSONiC(config)# username password role | 配置用户名、密码和角色。 |
要验证已配置的用户的角色,请使用已配置的命令 show users 。此命令显示本地配置的用户和角色。
输出示例:
DELLSONiC # show users configured ---------------------------------------------------------------------- User Role(s) ---------------------------------------------------------------------- admin1 admin oper operator从 Dell SONiC 4.1 开始,我们可以将多个角色配置为单个用户。下面是如何向单个用户配置多个角色的示例:
DELLSONiC (config)# username testuser password testuser role operator,netadmin,secadmin DELLSONiC(config)# exit DELLSONiC # show users configured ---------------------------------------------------------------------- User Role(s) ---------------------------------------------------------------------- testuser netadmin,operator,secadmin
例子:
为了解释用户角色,我们将创建两个具有不同角色的用户:
- 为用户 操作员 分配了一个操作员角色
- 为用户 admin1 分配管理员角色
使用操作员 (即操作员 角色)登录。
提醒:以操作员、secadmin 或 netadmin 用户身份登录时,我们被置于 Dell Management Framework CLI 中。
让我们以具有操作员角色的用户 操作员身份登录交换机。我们可以使用 “ ?“以查看特定模式下用户角色中支持的命令。
sonic login: oper Password: Linux sonic 5.10.0-8-2-amd64 #1 SMP Debian 5.10.46-5 (2021-09-23) x86_64 You are on ____ ___ _ _ _ ____ / ___| / _ \| \ | (_)/ ___| \___ \| | | | \| | | | ___) | |_| | |\ | | |___ |____/ \___/|_| \_|_|\____| -- Software for Open Networking in the Cloud -- Unauthorized access and/or use are prohibited. All access and/or use are subject to monitoring. Help: http://azure.github.io/SONiC/ sonic# ? copy Perform file operations delete Delete the file from local filesystem dir Show folder contents exit Exit from the CLI ls Show folder contents ping Send ICMP ECHO_REQUEST to network hosts ping6 Send ICMPv6 ECHO_REQUEST to network hosts show Display running system information terminal Set terminal settings traceroute Print the route packets take to the host traceroute6 Print the route packets take to the IPv6 host用户 操作员 具有操作员角色。操作员仅对系统具有读取访问权限;因此,用户 操作人员 无法执行任何配置。此外,操作员不能像管理员用户那样运行所有 show 命令。
提醒:在 Dell Networking SONiC 4.0.5 及更低版本上,具有操作员角色的用户可以进入配置模式。但是,在配置模式下执行的任何命令都被拒绝。
输出示例:
DELLSONiC# show version | grep Soft Software Version : 4.0.5-Enterprise_Base DELLSONiC(config)# interface-naming standard % Error: Client is not authorized to perform this operation DELLSONiC(config)# hostname DeLLSoNiC % Error: Client is not authorized to perform this operation DELLSONiC(config)# exit DELLSONiC# clear logging DELLSONiC# show logging count DELLSONiC# show audit-log %Error: Client is not authorized to perform this operation DELLSONiC# show users oper ttyS0 2023-08-02 21:03这也可在审核日志中看到,具有管理员角色的用户可以访问这些日志。
使用管理员角色 admin1 登录。
提醒:当以管理员用户身份登录时,我们被放置在 Linux shell 中。提示 admin@sonic:~$。我们必须使用 命令 sonic-cli 访问 Dell Management Framework CLI。
Debian GNU/Linux 10 DELLSONiC ttyS0 DELLSONiC login: admin1 Password: admin1@DELLSONiC:~$ sonic-cli DELLSONiC# show version | grep Soft Software Version : 4.0.5-Enterprise_Base DELLSONiC# show audit-log Aug 02 21:06:01.052692+00:00 2023 DELLSONiC INFO mgmt-framework#clish[146]: User "admin1" command "startup" status - success Aug 02 21:05:53.366544+00:00 2023 DELLSONiC INFO login[27960]: pam_unix(login:session): session opened for user admin1 by LOGIN(uid=0) Aug 02 21:05:46.787657+00:00 2023 DELLSONiC INFO systemd[1]: Stopped Serial Getty on ttyS0. Aug 02 21:05:46.203662+00:00 2023 DELLSONiC INFO login[4203]: pam_unix(login:session): session closed for user oper Aug 02 21:05:45.855977+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "exit" status - success Aug 02 21:05:09.966551+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "show users" status - success Aug 02 21:04:52.730615+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "show audit-log" status - failure Aug 02 21:04:46.843617+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "show logging count" status - success Aug 02 21:04:43.031486+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "clear logging" status - success Aug 02 21:04:39.074016+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "exit" status - success Aug 02 21:04:26.504755+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "hostname DeLLSoNiC" status - failure Aug 02 21:04:11.674915+00:00 2023 DELLSONiC INFO mgmt-framework#clish[134]: User "oper" command "interface-naming standard" status - failure
使用错误的凭据登录:
现在,让我们使用具有管理员角色的 admin1 用户的错误凭据登录。
提醒:只有管理员用户才能访问审核日志。
DELLSONiC login: admin1 Password: ==========>Wrong password is given Login incorrect DELLSONiC login: admin1 Password: Last login: Wed Aug 2 21:05:53 UTC 2023 on ttyS0 Linux DELLSONiC 4.19.0-9-2-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 You are on ____ ___ _ _ _ ____ / ___| / _ \| \ | (_)/ ___| \___ \| | | | \| | | | ___) | |_| | |\ | | |___ |____/ \___/|_| \_|_|\____| -- Software for Open Networking in the Cloud -- Unauthorized access and/or use are prohibited. All access and/or use are subject to monitoring. Help: http://azure.github.io/SONiC/ **Note the login failure for admin1 admin1@DELLSONiC:~$ sonic-cli DELLSONiC# show audit-log Aug 02 21:07:28.896480+00:00 2023 DELLSONiC INFO mgmt-framework#clish[155]: User "admin1" command "startup" status - success Aug 02 21:07:20.219496+00:00 2023 DELLSONiC INFO login[7169]: pam_unix(login:session): session opened for user admin1 by LOGIN(uid=0) Aug 02 21:07:12.635575+00:00 2023 DELLSONiC NOTICE login[7169]: FAILED LOGIN (1) on '/dev/ttyS0' FOR 'admin1', Authentication failure Aug 02 21:07:08.763918+00:00 2023 DELLSONiC NOTICE login[7169]: pam_unix(login:auth): authentication failure; logname=LOGIN uid=0 euid=0 tty=/dev/ttyS0 ruser= rhost= user=admin1
Affected Products
Enterprise SONiC Distribution, PowerSwitch E3200-ON Series, Dell EMC Networking N3200-ON, PowerSwitch S5212F-ON, PowerSwitch S5224F-ON, PowerSwitch S5232F-ON, PowerSwitch S5248F-ON, PowerSwitch S5296F-ON, PowerSwitch Z9100-ON, PowerSwitch Z9264F-ON
, PowerSwitch Z9332F-ON, PowerSwitch Z9432F-ON
...
Article Properties
Article Number: 000216535
Article Type: How To
Last Modified: 19 Sep 2023
Version: 8
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.