密码设置复杂度和期限

简介:

以下是通过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 ,如需转载请自行联系原作者



相关文章
|
监控 Linux
如何检查 Linux 内存使用量是否耗尽?这 5 个命令堪称绝了!
本文介绍了在Linux系统中检查内存使用情况的5个常用命令:`free`、`top`、`vmstat`、`pidstat` 和 `/proc/meminfo` 文件,帮助用户准确监控内存状态,确保系统稳定运行。
2232 6
|
人工智能 网络协议 算法
5 分钟搞懂 ECN
5 分钟搞懂 ECN
3165 0
|
算法 C语言 C++
二叉树三种遍历(动态图+代码深入理解)
二叉树三种遍历(动态图+代码深入理解)
3245 3
二叉树三种遍历(动态图+代码深入理解)
|
iOS开发 MacOS
还在为 iTerm 多窗口操作烦恼?tmux 这款神器轻松帮你解决(下)
粉在之前文章中教过大家如何结合 zsh 让 iterm2 发挥最佳效果。 什么还没有看过?赶紧看下补一下前提知识:收集了这么多实用技巧,帮助你的 iterm2 成为最帅的那个! 上篇文中,阿粉提到每次上线发布的时候,都会打开很多 iTerm 窗口,通过 tab 页拖拽方式让所有窗口可以同时显示。
1369 0
还在为 iTerm 多窗口操作烦恼?tmux 这款神器轻松帮你解决(下)
|
缓存 Linux 开发工具
CentOS 7- 配置阿里镜像源
阿里镜像官方地址http://mirrors.aliyun.com/ 1、点击官方提供的相应系统的帮助 :2、查看不同版本的系统操作: 下载源1、安装wget yum install -y wget2、下载CentOS 7的repo文件wget -O /etc/yum.
261218 0
|
开发工具 git
成功解决git rebase问题:First, rewinding head to replay your work on top of it...
成功解决git rebase问题:First, rewinding head to replay your work on top of it...
|
7月前
|
存储 安全 网络安全
如何配置密码策略 - 概述和指南
Active Directory(AD)默认密码策略是确保用户账户安全的重要组成部分,涵盖密码长度、复杂性、历史记录及有效期等关键设置。通过组策略或PowerShell可调整这些策略,以满足企业安全需求。然而,高强度密码策略可能影响用户体验,且面对日益复杂的攻击手段,传统策略已显不足。ADSelfService Plus作为一款企业级AD域密码管理工具,提供密码自助重置、锁定账户解锁、密码黑名单及状态报告等功能,在提升安全性的同时优化用户体验,为企业AD域管理带来高效解决方案。
484 6
|
11月前
|
人工智能 PyTorch 算法框架/工具
Ascend Extension for PyTorch是个what?
Ascend Extension for PyTorch 是针对华为昇腾处理器的PyTorch框架适配插件,旨在让PyTorch开发者能充分利用昇腾AI处理器的强大计算能力。此扩展通过最小化对原生PyTorch的改动,实现了对昇腾NPU的支持,包括动态图特性、自动微分等功能的完整继承,并提供了与原生PyTorch一致的使用体验。项目详情及源码可在昇腾社区获取。
Ascend Extension for PyTorch是个what?
|
11月前
|
SQL 弹性计算 安全
在云上轻松部署达梦数据库
达梦数据库(DM Database)是达梦数据库有限公司开发的关系型数据库管理系统,广泛应用于政府、金融、能源等行业。它具备高性能、高安全、兼容性强、易管理等特点,支持多种操作系统,适用于关键业务系统、政务系统及大数据处理等场景。在阿里云上,可通过一键部署快速使用达梦数据库DM8。
|
12月前
|
存储 Java 数据库连接
南大通用 GBase 8s JDBC字符集参数详解
本文详细介绍了南大通用GBase 8s V8.8 数据中四个关键的JDBC字符集参数:CLIENT_LOCALE、DB_LOCALE、NEWCODESET和NEWLOCALE,涵盖它们的功能、配置方法及其在数据库操作中的作用,旨在帮助开发者和数据库管理员提升数据处理的效率与准确性。