密码设置复杂度和期限

简介:

以下是通过man pam_cracklib查看获得的解释
一 PAM_CRACKLIB模块可以做的密码策略:
1.回文限制
2.字符数量限制
3.字符类型限制
4.重复字符限制
5.新密码和老密码重复字符数量限制
6.新密码和老密码的相似度记忆
7.记忆最近几次的密码不能和老密码重复

authtok_type=XXX
           The default action is for the module to use the following prompts when requesting passwords: "New UNIX password: " and "Retype UNIX password: ". 
           The example word UNIX can be replaced with this option, by default it is empty.
           当输入新密码时的默认提示
           
difok=N
           This argument will change the default of 5 for the number of character changes in the new password that differentiate it from the old password. 
           这个参数将改变新密码不同于老密码5个字符的默认设置
maxrepeat=N
           Reject passwords which contain more than N same consecutive characters. The default is 0 which means that this check is disabled.
           拒绝包含超过N个连续相同的字符.默认是0,意思是不用检查

maxsequence=N
           Reject passwords which contain monotonic character sequences longer than N. The default is 0 which means that this check is disabled. Examples of such sequence are 12345 
           or fedcb. Note that most such passwords will not pass the
           simplicity check unless the sequence is only a minor part of the password.           
           拒绝密码包含大于N的单纯字符序列.默认不检查,注意大多数密码不会通过简单性检查除非这个序列是密码的次要部分
dictpath=/path/to/dict
           Path to the cracklib dictionaries.           

           
二 报错实例           
如果是和以前用过的相同就会报错:
Password has been already used. Choose another.
如果新密码和老密码一样就会提示:
Password unchanged
如果新密码和老密码相似度太高会提示:
is too similar to the old one
如果设置的复杂度不够会提示:
BAD PASSWORD: it is too short
如果是比如密码设置有连续的多个字符就会提示:
BAD PASSWORD: it is too simplistic/systematic
如果设密码超过重复字符限制:

BAD PASSWORD: contains too many same characters consecutively

三 配置实例

password    requisite     /lib64/security/pam_cracklib.so try_first_pass retry=3 difok=3  
authtok_type=you_must_enter_at_least_3_charactors type=  minlen=8  ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1 dictpath=/usr/share/cracklib/pw_dict
password    sufficient    /lib64/security/pam_unix.so try_first_pass use_authtok nullok sha512 shadow remember=3

控制标识符解释:
optional The module is required for authentication if it is the only module listed
for a service.
required The module must succeed for access to be granted. PAM continues
to execute the remaining modules in the stack whether the module
succeeds or fails. PAM does not immediately inform the user of the
failure.
requisite The module must succeed for access to be granted. If the module
succeeds, PAM continues to execute the remaining modules in the
stack. However, if the module fails, PAM notifies the user immediately
and does not continue to execute the remaining modules in the stack.
sufficient If the module succeeds, PAM does not process any remaining modules
of the same operation type. If the module fails, PAM processes the
remaining modules of the same operation type to determine overall
success or failure.

四 密码过期

/etc/login.defs 文件,可以设置当前密码的有效期限,如果想单独为每个用户设置不同期限使用chage命令.


五 一般的密码策略

Password must meetthe following complexity requirements:
- Enforce password history: 5 passwords remembered
- Maximum password age: 90 days
- Not contain the user's account name or parts of the user's full name thatexceed two consecutive characters
- Be at least 7 characters in length

- Contain characters from three of the following four categories:
1. English uppercase characters (A through Z)
2. English lowercase characters (a through z)
3. Base 10 digits (0 through 9)
4. Non-alphabetic characters (for example, !, $, #, %)
Complexity requirements are enforced when passwords are changed or created


















本文转自chenzudao51CTO博客,原文链接:http://blog.51cto.com/victor2016/1940209 ,如需转载请自行联系原作者



相关文章
|
算法 C语言 C++
二叉树三种遍历(动态图+代码深入理解)
二叉树三种遍历(动态图+代码深入理解)
4002 3
二叉树三种遍历(动态图+代码深入理解)
|
7月前
|
安全 开发者 Docker
Docker
Docker以轻量级容器技术重塑软件开发,实现应用构建、交付与运行的一体化。它打破环境差异,提升资源利用率,推动微服务与云原生架构发展,构建高效CI/CD流水线,成为现代软件开发的核心基石。(238字)
|
存储 安全 网络安全
如何配置密码策略 - 概述和指南
Active Directory(AD)默认密码策略是确保用户账户安全的重要组成部分,涵盖密码长度、复杂性、历史记录及有效期等关键设置。通过组策略或PowerShell可调整这些策略,以满足企业安全需求。然而,高强度密码策略可能影响用户体验,且面对日益复杂的攻击手段,传统策略已显不足。ADSelfService Plus作为一款企业级AD域密码管理工具,提供密码自助重置、锁定账户解锁、密码黑名单及状态报告等功能,在提升安全性的同时优化用户体验,为企业AD域管理带来高效解决方案。
1064 6
|
人工智能 PyTorch 算法框架/工具
Ascend Extension for PyTorch是个what?
Ascend Extension for PyTorch 是针对华为昇腾处理器的PyTorch框架适配插件,旨在让PyTorch开发者能充分利用昇腾AI处理器的强大计算能力。此扩展通过最小化对原生PyTorch的改动,实现了对昇腾NPU的支持,包括动态图特性、自动微分等功能的完整继承,并提供了与原生PyTorch一致的使用体验。项目详情及源码可在昇腾社区获取。
Ascend Extension for PyTorch是个what?
|
SQL 弹性计算 安全
在云上轻松部署达梦数据库
达梦数据库(DM Database)是达梦数据库有限公司开发的关系型数据库管理系统,广泛应用于政府、金融、能源等行业。它具备高性能、高安全、兼容性强、易管理等特点,支持多种操作系统,适用于关键业务系统、政务系统及大数据处理等场景。在阿里云上,可通过一键部署快速使用达梦数据库DM8。
|
网络协议 安全 测试技术
Nping工具详解:网络工程师的瑞士军刀
### Nping工具详解:网络工程师的瑞士军刀 Nping是Nmap项目的一部分,支持TCP、UDP、ICMP和ARP等多种协议,用于生成和分析网络数据包。它提供灵活的命令行界面,适用于网络探测、安全测试和故障排除。本文介绍Nping的基础与高级用法,包括发送不同类型的网络请求、自定义TCP标志位、路由跟踪等,并通过实战案例展示其应用。掌握Nping有助于更好地理解和管理网络环境。 (239字符)
1354 9
|
存储 Java 数据库连接
南大通用 GBase 8s JDBC字符集参数详解
本文详细介绍了南大通用GBase 8s V8.8 数据中四个关键的JDBC字符集参数:CLIENT_LOCALE、DB_LOCALE、NEWCODESET和NEWLOCALE,涵盖它们的功能、配置方法及其在数据库操作中的作用,旨在帮助开发者和数据库管理员提升数据处理的效率与准确性。
|
Ubuntu 应用服务中间件 数据库
Nginx配置:阻止非国内IP地址访问的设置方法
此外,出于用户隐私和法律合规性的考虑,应慎重考虑阻止特定国家或地区IP地址的决策。在某些情况下,这可能被视为歧视性或违反当地法律。
1465 3
|
运维 安全 测试技术
【答案】2023年国赛信息安全管理与评估正式赛答案-模块3 CTF
【答案】2023年国赛信息安全管理与评估正式赛答案-模块3 CTF
【答案】2023年国赛信息安全管理与评估正式赛答案-模块3 CTF
|
网络协议 JavaScript 前端开发
将websocket封装成一个class,断线可重连
将websocket封装成一个class,断线可重连
780 3