Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deepin Integration]~[V23-Release] 4.14.7 by UTsweetyfish@deepin-community/shadow by deepin-community-ci-bot[bot] #8806

Closed
deepin-bot bot opened this issue May 28, 2024 · 5 comments
Assignees
Labels
Project:integrated 集成管理相关 吴波 吴波
Milestone

Comments

@deepin-bot
Copy link

deepin-bot bot commented May 28, 2024

Package information | 软件包信息

包名 版本
shadow 1:4.14+dfsg1-0deepin3

Package repository address | 软件包仓库地址

deb [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/CI:/TestingIntegration:/test-integration-pr-1513/testing/ ./

Changelog | 更新信息

shadow (1:4.14+dfsg1-0deepin3) unstable; urgency=medium

  • Use --enable-logind=yes --enable-lastlog configure flag
  • Build-Depends add libltdl-dev pkgconf libsystemd-dev
@deepin-bot deepin-bot bot added the Project:integrated 集成管理相关 label May 28, 2024
@deepin-bot deepin-bot bot added this to the V23-Release milestone May 28, 2024
@deepin-bot deepin-bot bot moved this to In progress in v23-集成管理 May 28, 2024
@deepin-bot
Copy link
Author

deepin-bot bot commented May 28, 2024

Integration Test Info

Test suggestion | 测试建议

如果您指的是测试 Linux 系统上的 shadow 包(负责用户和组管理的 shadow-utils),这里有一些建议用于测试和验证 shadow 包的安装和功能。

1. 确认安装

首先,确保 shadow 包已安装。可以使用包管理器进行检查:

Debian/Ubuntu:

dpkg -l | grep shadow

RHEL/CentOS:

rpm -qa | grep shadow-utils

2. 创建和管理用户

创建新用户

测试通过 useradd 创建新用户:

sudo useradd testuser

验证新用户是否创建成功:

id testuser

设置密码

为新用户设置密码:

sudo passwd testuser

3. 修改用户属性

修改用户的登录 shell

sudo usermod -s /bin/bash testuser

验证修改:

grep testuser /etc/passwd

修改用户的主目录

sudo usermod -d /home/testuser2 -m testuser

验证修改:

grep testuser /etc/passwd

4. 删除用户

删除用户及其主目录

sudo userdel -r testuser

验证删除:

id testuser

5. 创建和管理组

创建新组

sudo groupadd testgroup

验证新组是否创建成功:

getent group testgroup

将用户添加到组

重新创建 testuser 并将其添加到 testgroup

sudo useradd testuser
sudo usermod -aG testgroup testuser

验证用户是否已添加到组:

groups testuser

6. 验证 /etc/passwd 和 /etc/shadow 文件

确保用户和组信息正确写入 /etc/passwd/etc/shadow 文件:

检查 /etc/passwd

grep testuser /etc/passwd

检查 /etc/shadow

sudo grep testuser /etc/shadow

7. 使用 chage 命令

chage 命令用于管理用户密码的有效期和到期时间。

查看和修改用户密码策略

sudo chage -l testuser
sudo chage -M 90 testuser

这将密码有效期设置为90天。

8. 验证 pam_tally2

pam_tally2 模块用于管理用户的登录尝试。

安装和配置 pam_tally2

首先,确保已安装:

sudo apt-get install libpam-modules-bin

配置 PAM:
编辑 /etc/pam.d/common-auth 文件,添加以下内容:

auth required pam_tally2.so onerr=fail deny=5 unlock_time=1800

测试登录尝试

尝试用错误的密码登录 testuser 多次,确保锁定机制生效。

9. 编写自动测试脚本

编写一个脚本自动执行上述测试步骤:

#!/bin/bash

echo "Creating new user..."
sudo useradd testuser || { echo "Failed to create user"; exit 1; }

echo "Setting password for new user..."
echo "testpassword" | sudo passwd testuser --stdin || { echo "Failed to set password"; exit 1; }

echo "Modifying user shell..."
sudo usermod -s /bin/bash testuser || { echo "Failed to modify user shell"; exit 1; }

echo "Modifying user home directory..."
sudo usermod -d /home/testuser2 -m testuser || { echo "Failed to modify user home directory"; exit 1; }

echo "Deleting user..."
sudo userdel -r testuser || { echo "Failed to delete user"; exit 1; }

echo "Creating new group..."
sudo groupadd testgroup || { echo "Failed to create group"; exit 1; }

echo "Adding user to group..."
sudo useradd testuser
sudo usermod -aG testgroup testuser || { echo "Failed to add user to group"; exit 1; }

echo "Verifying group membership..."
groups testuser || { echo "Failed to verify group membership"; exit 1; }

echo "Testing completed successfully!"

保存脚本为 test_shadow.sh,并给予执行权限:

chmod +x test_shadow.sh

运行脚本进行自动测试:

./test_shadow.sh

通过这些步骤,您可以全面测试 shadow 包的功能,确保用户和组管理功能正常工作。如果遇到问题,请查阅相关文档或社区资源,以获取更多帮助。
以上内容由gpt生成

Influence | 影响范围

用户创建、登录、密码过期时限、用户认证相关

ADDITIONAL INFORMATION | 额外补充

影响范围较大,请发散测试场景

@deepin-bot
Copy link
Author

deepin-bot bot commented May 28, 2024

IntegrationProjector Notify the author
@UTsweetyfish: Integrated issue updated

@deepin-bot
Copy link
Author

deepin-bot bot commented May 28, 2024

IntegrationProjector Bot
Deepin Testing Integration Project Manager Info
Link to deepin-community/Repository-Integration#1513

@Zeno-sole Zeno-sole assigned babyfengfjx and unassigned Zeno-sole and hudeng-go May 28, 2024
@babyfengfjx babyfengfjx assigned kobe337 and unassigned babyfengfjx May 28, 2024
@babyfengfjx babyfengfjx moved this from In progress to 测试中 in v23-集成管理 May 28, 2024
@babyfengfjx babyfengfjx added the 吴波 吴波 label May 28, 2024
@babyfengfjx
Copy link

@kobe337 请开展集成验证,需要重点进行发散,通知其他组员同步升级使用。

@kobe337
Copy link

kobe337 commented May 29, 2024

验证通过
【环境】:
镜像:https://cdimage.uniontech.com/community/releases/23-RC/amd64/
仓库:提测单仓库
内核:Linux deepin-PC 6.6.25-amd64-desktop-hwe #23.01.00.25 SMP PREEMPT_DYNAMIC Wed Apr 10 21:20:25 CST 2024 x86_64 GNU/Linux

【结论】:
测试通过,暂无严重问题及影响,安装校验,版本核对,覆盖如下场景:
1、命令基本使用:useradd、getsubids、newgidmap、newuidmap、passwd、usermod、userdel、groupadd、gruops、chage等
2、图形化界面,新建用户,删除用户,注销、重启登陆等操作。

@kobe337 kobe337 assigned Zeno-sole and unassigned kobe337 May 29, 2024
@kobe337 kobe337 moved this from 测试中 to 测试通过 in v23-集成管理 May 29, 2024
@Zeno-sole Zeno-sole moved this from 测试通过 to 已集成 in v23-集成管理 May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project:integrated 集成管理相关 吴波 吴波
Projects
Archived in project
Development

No branches or pull requests

4 participants