passwd没读取/etc/pam.d/system-auth
发布日期:2021-06-30 22:17:56
浏览次数:2
分类:技术文章
本文共 1351 字,大约阅读时间需要 4 分钟。
前言
对passwd做了些完善,给同事测试,说不好使。原因是/etc/pam.d/system-auth中配置的策略项不好使。
这不是埋汰gnu那帮大神么 ?去看了下passwd检查口令安全性的实现,果真没有读取/etc/pam.d/system-auth的内容…,只读取了etc/login.defs.
具体检查在obscure.c::simple()函数中, 看名字就知道obscure.c是检查对象安全的。 simple()函数里面写死的判断,大神们还加了注释,说如果口令如果小于8位,必须有2种类型(数字,大写,小写,特殊字符)的字符./* * The scam is this - a password of only one character type * must be 8 letters long. Two types, 7, and so on. */
其实口令至少要有多长,已经在etc/login.defs做了限制,已经检查了.
进行了修正, 要满足至少3种类型(数字,大写,小写,特殊字符)的字符才算合规。修正后的代码
/* * a nice mix of characters. */static bool simple (unused const char *old, const char *new){ bool digits = false; bool uppers = false; bool lowers = false; bool others = false; int size; int i; for (i = 0; '\0' != new[i]; i++) { if (isdigit (new[i])) { digits = true; } else if (isupper (new[i])) { uppers = true; } else if (islower (new[i])) { lowers = true; } else { others = true; } } // 至少有3种情况才合格 size = 0; if (digits) { size++; } if (uppers) { size++; } if (lowers) { size++; } if (others) { size++; } return (size < 3); // return true is password too simple /* * The scam is this - a password of only one character type * must be 8 letters long. Two types, 7, and so on. */ /* size = 9; if (digits) { size--; } if (uppers) { size--; } if (lowers) { size--; } if (others) { size--; } if (size <= i) { return false; } */ // return true;}
转载地址:https://lostspeed.blog.csdn.net/article/details/80714714 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
做的很好,不错不错
[***.243.131.199]2024年05月05日 06时45分00秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
如何输入多组数据并输出每组数据的和?
2019-04-30
行阶梯型矩阵
2019-04-30
MATLAB指定路径保存图片方法
2019-04-30
JavaScript 表单操作与MD5加密
2019-04-30
JAVA学习笔记6 - 数组
2019-04-30
JAVA学习笔记10 - 继承
2019-04-30
Android 开发学习笔记 00 - Getting Started
2019-04-30
【学习笔记】Android Activity
2019-04-30
Android使用Retrofit_00_Getting Started
2019-04-30
Android使用Retrofit_01_OAuth2 + GitHub
2019-04-30
OpenCV杂记 - Mat in C++
2019-04-30
location区段
2019-04-30
nginx访问控制、基于用户认证、https配置
2019-04-30
linux内存的寻址方式
2019-04-30
how2heap-double free
2019-04-30
how2heap-fastbin_dup_consolidate
2019-04-30
orw_shellcode_模板
2019-04-30
fmt在bss段(neepusec_easy_format)
2019-04-30
python 函数式编程
2019-04-30