簡介
本檔案將說明復原的程式 cloud-user
雲原生部署平台(CNDP)策略控制功能(PCF)中的密碼。
必要條件
需求
思科建議您瞭解以下主題:
注意:思科建議您必須具有對PCF CLI的雲使用者和許可權根訪問許可權。
採用元件
本文中的資訊係根據以下軟體和硬體版本:
本文中的資訊是根據特定實驗室環境內的裝置所建立。文中使用到的所有裝置皆從已清除(預設)的組態來啟動。如果您的網路運作中,請確保您瞭解任何指令可能造成的影響。
背景資訊
使用者 cloud-user
用於CLI訪問PCF設定以進行操作和維護(OAM)工作。根據所有產品的思科安全策略,預設情況下密碼的最大期限設定為90天。
問題
假設您以使用者身份訪問PCF設定 cloud-user
將密碼到期日期過後,PCF將拒絕您訪問它。在這種情況下,您必須首先恢復雲使用者使用者的密碼,然後需要將密碼到期設定為「never」。
在PCF中恢復雲使用者密碼的過程
以worker-15節點為例 cloud-user
密碼已過期。
步驟1.登入到Cluster Manager,然後從那裡通過ssh訪問worker-15。
它會要求更改密碼,然後您必須提供新密碼。新密碼必須不同於舊密碼。您必須現在能夠登入worker-15。
稍後,您可以將密碼改回舊密碼。
§cloud-user@pcf-cm-1:~$ ssh xx.xx.xx.xx //worker-15 IP address
§Authorized uses only. All activity may be monitored and reported.
§Password:
§You are required to change your password immediately (password aged)
§Changing password for cloud-user.
§(current) UNIX password:
§New password:
§Retype new password:
§Retype new password:
§Welcome to Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-49-generic x86_64)
§
§ * Documentation: https://help.ubuntu.com
§ * Management: https://landscape.canonical.com
§ * Support: https://ubuntu.com/advantage
§
§ * Canonical Livepatch is available for installation.
§ - Reduce system reboots and improve kernel security. Activate at:
§ https://ubuntu.com/livepatch
§
§9 packages can be updated.
§0 of these updates are security updates.
§To see these additional updates run: apt list --upgradable
§
§Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings
§cloud-user@pcf-worker-15:~$
步驟2.備份 common-password
和 pwquality.conf
檔案。
cloud-user@pcf-worker-15:~$ cd /etc/pam.d/
cloud-user@pcf-worker-15:/etc/pam.d$ ls -lrt common-password
-rw-r--r-- 1 cloud-user cloud-user 1770 Apr 19 08:01 common-password
cloud-user@pcf-worker-15:/etc/pam.d$ cp common-password common-password_bkp
cloud-user@pcf-worker-15:/etc/pam.d$ cd /etc/security/
cloud-user@pcf-worker-15:/etc/security$ ls -lrt pwquality.conf
-rw-r--r-- 1 cloud-user cloud-user 2172 Apr 19 08:00 pwquality.conf
cloud-user@pcf-worker-15:/etc/security$ cp pwquality.conf pwquality.conf_bkp
cloud-user@pcf-worker-15:~$
步驟3.編輯 common-password
和 pwquality.conf
檔案。
§cloud-user@pcf-worker-15:/etc/security$
§cloud-user@pcf-worker-15:/etc/security# sudo sed -i 's/14/8/' pwquality.conf
§cloud-user@pcf-worker-15:/etc/security# cat pwquality.conf | grep "minlen"
§# minlen = 8
§minlen = 8 //This line must contain minlen =8
§cloud-user@pcf-worker-15:/etc/security#
§cloud-user@pcf-worker-15:/etc/security# cd /etc/pam.d/
§cloud-user@pcf-worker-15:/etc/pam.d# sudo sed -i '26 s/password/#password/' common-password
§cloud-user@pcf-worker-15:/etc/pam.d# sudo sed -i '28 s/password/#password/' common-password
§cloud-user@pcf-worker-15:/etc/pam.d# cat common-password | grep password
§# /etc/pam.d/common-password - password-related modules common to all services
§# used to change user passwords. The default is pam_unix.
§# The "sha512" option enables salted SHA512 passwords. Without this option,
§password requisite pam_pwquality.so retry=3 minlen=8 ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1 enforce_for_root
§#password requisite pam_pwhistory.so remember=5 use_authtok
§password requisite pam_pwquality.so try_first_pass retry=3
§#password required pam_pwhistory.so use_authtok remember=5
§password [success=1 default=ignore] pam_unix.so obscure try_first_pass sha512
§password requisite pam_deny.so
§password required pam_permit.so
§cloud-user@pcf-worker-15:/etc/pam.d#
步驟4.更改的密碼策略 cloud-user
使用者。驗證當前密碼到期日期。
cloud-user@pcf-worker-15:~$ sudo chage -l cloud-user
Last password change : May 21, 2021
Password expires : Aug 19, 2021
Password inactive : Sep 18, 2021
Account expires : never
Minimum number of days between password change : 7
Maximum number of days between password change : 90
Number of days of warning before password expires : 7
cloud-user@pcf-worker-15:~$
必須將密碼到期更改為 never
此命令。
cloud-user@pcf-worker-15:~$
cloud-user@pcf-worker-15:~$ sudo chage -m 0 -M -1 cloud-user
驗證密碼到期是否已更改為 never
.
cloud-user@pcf-worker-15:~$ sudo chage -l cloud-user
Last password change : May 21, 2021
Password expires : never
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : -1
Number of days of warning before password expires : 7
cloud-user@pcf-worker-15:~$
5.更改 cloud-user
舊密碼的密碼。
§cloud-user@pcf-worker-15:~# sudo passwd cloud-user
§New password:
§Retype new password:
§Retype new password:
§passwd: password updated successfully
§cloud-user@pcf-worker-15:~#
可以應用此過程恢復已定義的CNDP PCF中其他使用者的密碼。