首页 安全基础 网络安全 安全协议 病毒分析 防火墙 OS安全 无线安全 Web安全 PKI与PMI 入侵检测 经典案例
安全审计 设备安全 安全管理 安全标准 法律法规 隔离网闸 DB安全 XML安全 开源项目 资源下载 安全论坛 备份恢复
 当前位置:首页>>OS安全>>unix安全>>正文
使用PAM进行统一身份的认证(续)
文章出处:www.lslnet.com   发布时间:2004-11-21   点击:0
 

    PAM中的模块

    模块导引, 这里对最常用的10个模块做了描述.想知道更多的信息, 你可以察看/usr/doc/pam* 下的文件.

    1) Chroot
pam_chroot

Management groups provided:
account; session; authentication

    为用户提供了一伪造的文件系统.

    2) Cracklib pluggable password strength-checker
pam_cracklib

Management groups provided:
password

    需要库libcrack 和议本系统字典/usr/lib/cracklib_dict.检查密码的可靠性对下列问题进行检查:
Palindrome - 回文 速度和倒读都一样
Case Change Only - 仅仅是大小写的变化
Similar - 过于相似Simple - 太简单了Rotated - 是旧密码的循环

Password component

可识别的参数
debug; type=XXX; retry=N; difok=N; minlen=N; dcredit=N;
ucredit=N; lcredit=N; ocredit=N;

Description:
提示用户输入密码,并检查密码是否可靠.

debug - 透过syslogd来写信息.
type=XXX - 系统的名字
retry=N - 可重试的次数
difok=N - 至少要有多少个字符不同
minlen=N - 新密码的长度加一的最小值
dcredit=N ucredit=N lcredit=N ocredit=N -
最少要有多少的数字,大写字母,小写字母和其它字母.

    3) Deny
pam_deny

Management groups provided:
account; authentication; password; session

用于拒绝提供服务.

Account component
仅仅是返回一个错误 PAM_ACCT_EXPIRED.

#
# add this line to your other login entries to disable all accounts
#
login account required pam_deny.so

Authentication component
仅仅是返回一个错误 PAM_AUTH_ERR. 当调用 pam_authenticate()时.返回 PAM_CRED_UNAVAIL, 当调用 pam_setcred() 时.

#
# add this line to your existing OTHER entries to prevent
# authentication succeeding with default applications.
#
OTHER auth required pam_deny.so

Password component

Recognized arguments:
Description:
拒绝用户修改密码.返回PAM_AUTHTOK_ERR.

Examples/suggested usage:

#
# add this line to your other login entries to prevent the login
# application from being able to change the user's password.
#
login password required pam_deny.so

Session component

阻止用户在主机上开始一个session.

Examples/suggested usage:
#
# An example to see how to configure login to refuse the user a
# session (politely)
#
login session required pam_motd.so file=/etc/system_time
login session required pam_deny.so

    4) Anonymous access module
pam_ftp.so

Management groups provided:
authentication

Overview of module

提供了匿名ftp认证.

Authentication component
参数:
debug; users=XXX,YYY,...; ignore

丹用户名为ftp或anonymous时,将密码安@分为 PAM_RUSER 和 PAM_RHOST; 相应的设置pam-items. 用户名被设为 ftp.

debug - syslog
users=XXX,YYY,...- 允许的用户名.
ignore - 不关心用户的email地址.

The group access module
pam_group

Management groups provided:
authentication

System dependencies:
需要设置 /etc/security/group.conf

Network aware:
需要正确设置PAM_TTY item.

Overview of module
基于用户名和它们使用的终端来决定是否提供服务.

Authentication component


    5) The last login module
pam_lastlog

Management groups provided:
auth

System dependencies:
所用的信息包含在/var/log/wtmp中.

Overview of module

这个模块维护 /var/log/wtmp . 增加打开的一项当调用 pam_open_seesion()
当pam_close_session()时关闭该项.它也显示一条信息表示用户上次何时登陆.
``Last login on ...'' 该模块维护 /var/log/wtmp.

Authentication component

Recognized arguments:

debug; nodate; noterm; nohost; silent; never

Description:

debug - write more information to syslog(3).
nodate - 不显示上次登陆的时间
noterm - 不显示上次登陆的终端.
nohost - 不显示上次登陆的主机.
silent - 不显示上次登陆的信息,值更新 /var/log/wtmp.
never - 如果/var/log/wtmp 不包含上次登陆的信息. 显示``welcome..."

Examples/suggested usage:这个木块可以用来显示该用户收到了new mail,当它们登陆到系统中时.

#
# do we have any mail?
#
login session optional pam_lastlog.so


    6) The resource limits module
pam_limits

Management groups provided:
session

/etc/security/limits.conf内核支持 resource limits.

Overview of module

通过 Linux-PAM open-session hook 设置用户的session可使用的系统资源上限

Session component

Recognized arguments:

debug; conf=/path/to/file.conf

root不受限制
conf=/path/to/file.conf 指定替代缺省的配置文件的文件名

例如:
为了使用这个模块 /etc/security/limits.conf 必须是root只读的


The fields listed above should be filled as follows...可以是用户名,用户组名(@group) 或统配符 * 表示缺省规则
可以是 hard soft
hard 强制实行 由管理员设置 由Linux Kernel执行 . 用户无权改变.
soft 非强制执行. 用户可以改变 在之前存在的 hard limits 允许下.
可以是下列值:
core - core 文件的大小 (KB)
data - 最大的data大小 (KB)
fsize - maximum filesize (KB)
memlock - max locked-in-memory address space (KB)
nofile - max number of open files
rss - max resident set size (KB)
stack - max stack size (KB)
cpu - max CPU time (MIN)
nproc - max number of processes
as - address space limit
maxlogins - max number of logins for this user.

通过加一个(-)来完全取消限制 (Example: ``bin -'', ``@admin -'').注意用户的优先级比组的优先级要高.

下面是一个例子:
# EXAMPLE /etc/security/limits.conf file:
# =======================================
#
* soft core 0
* hard rss 10000
@student hard nproc 20
@faculty soft nproc 20
@faculty hard nproc 50
ftp hard nproc 0
@student - maxlogins 4


    7) The no-login module
pam_nologin

Management groups provided:

authentication

Overview of module

提供了标准的unix nologin服务.

Authentication component

Recognized arguments:
Description:
当/etc/nologin文件存在时就拒绝login.


    8) The Password-Database module
pam_pwdb

Management groups provided:

account; authentication; password; session

Overview of module

用于取代 pam_unix_* 模块. 它使用了通用的 Password Database
library 接口函数.

Account component

Recognized arguments:

debug

例如:
/etc/pam.d/login 一定会有下面一行.
#
# Ensure users account and password are still active
#
login account required pam_pwdb.so

Authentication component

可用的阐述:
debug; use_first_pass; try_first_pass; nullok; nodelay

debug就没什么好说的了.
use_first_pass try_first_pass 在我的另一篇文章中已经所得很清楚了.
nullok时所允许空密码登陆.
nodelay在失败后不停留. 这一延时是为了抵挡基于字典的暴力入侵.

Password component

Recognized arguments:
debug; nullok; not_set_pass; use_authtok; try_first_pass;
use_first_pass; md5; bigcrypt; shadow; radius; unix

Description:

not_set_pass 不为栈中的其它模块保留密码.
md5是所用MD5算法来代替标准的算法.
bigcrypt是指处理长度超过8个字符的密码.
unix使用标准的加密方式.
shadow使用shadow文件.
radius:使用远程拨入用户服务器.

Session component

它只是通过 syslog(3) 来纪录一下.
例如:
#
# pwdb - unix like session opening and closing
#
login session required pam_pwdb.so

    9) The rhosts module
pam_rhosts_auth

Management groups provided:
authentication

对使用 rlogin 和 rsh 进行安全性检查.

Authentication component
可用参数:

no_hosts_equiv; no_rhosts; debug;
no_warn; privategroup; promiscuous; suppress

Description:

它通过 /etc/hosts.equiv 和 ~/.rhosts 来确认.

no_hosts_equiv 忽略 /etc/hosts.equiv 的内容.
no_rhosts 忽略 ~/.rhosts的内容.
privategroup 通常~/.rhost必须只有宿主才能写否则就失败. 这一选项是同组可写的 ~/.rhosts 也被使用.
promiscuous 不使用这一选项 配置文件中的 '+' 项 将被忽略.
suppress 禁止模块用 syslog(3) 来发警告信息.


    10) The securetty module
pam_securetty

Management groups provided:

authentication

Overview of module
提供了标准的安全终端的检查(使用/etc/securitty)


- Bricks Team

 

作者:
[返回顶部↑]  [推荐好友] [查看评论]  
用户名: 新注册) 密码: 匿名评论 [查看评论]  发表评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 
↑文章搜索
  关键字:  
  范  围:  
  开始搜索  
※相关文章※
 

◎UNIX系统下的应急响应工具
◎使用PAM进行统一身份的认证
◎UNIX系统下的应急响应工具
◎UNIX系统被删文件的恢复策
◎SCO UNIX网络安全管理
◎Solaris安全手册
◎UNIX安全问题

 
※热点文章※
  ·UNIX IP Stack 调整指南
·一些FreeBSD相关的安全问题
·Unix系统安全必读
·如何看FreeBSD的系统日志
·Unix安全
·Solaris系统管理员安全手册
·部分防止Solaris溢出的方法
 

关于我们 | 征搞启示 | 版权信息 | 联系我们 | 友情链接

版权所有:中国信息安全组织 © 2003-2005 Power by DedeCms