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 使用者可存取系統中的所有安全性相關命令。
Netadmin netadmin 使用者可存取管理流經交換器的流量的組態功能。


組態語法:

組態 說明
admin@DELLSONiC:~$ sonic-cli 輸入 Dell SONiC 命令介面 (CLI)
DELLSONiC# 設定終端機 進入組態模式。
DELLSONiC(config)# username password 角色 設定使用者名稱、密碼和角色。 

若要確認已設定的使用者角色,請使用設定的命令顯示使用者。此命令會顯示本機設定的使用者和角色。
 
範例輸出:
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

例子:
為了說明使用者角色,我們正在建立兩個不同角色的使用者:

  • 使用者 操作人員 被指派為操作員角色
  • 使用者 管理員 1 被指派為管理員角色


操作員   角色登入。

注意:以操作員、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

此功能也可在稽核記錄中看到,具有系統管理員角色的使用者可以存取這些記錄。


系統管理員 1 登入(管理員角色)。

注意:以系統管理員使用者身分登入時,我們會放置在 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.