一次性口令 opie
OPIE (One-time Passwords In Everything)是FreeBSD下的一个安全口令管理工具,可以通过一个预先设置的秘密口令(passphrase) 计算出当前的一次性登录口令。具体介绍请看下面这个链接
http://cnsnap.cn.freebsd.org/doc/zh_CN.GB2312/books/handbook/one-time-passwords.html
这里介绍一下在Linux环境下的具体安装配置
下载软件包
opie-24-630.src.rpm
Winkey
安装
[root@martian SPECS]# rpm -ivh opie-24-630.src.rpm
[root@martian SPECS]# rpmbuild -bb opie.spec
[root@martian SPECS]# rpm -ivh /usr/src/redhat/RPMS/i386/opie-2.4-630.i386.rpm
[root@martian SPECS]# rpmbuild -bb opie.spec
[root@martian SPECS]# rpm -ivh /usr/src/redhat/RPMS/i386/opie-2.4-630.i386.rpm
初始化
使用Winkey.exe 设置一个passphrase 计算出一次性口令 并在 Response 中输入
[root@martian SPECS]# opiepasswd -n 1000 -s LinuxServer
Updating root:
You need the response from an OTP generator.
New secret pass phrase:
otp-md5 1000 LinuxServer
Response:reid klan nair afar silt char
ID root OTP key is 1000 LinuxServer
REID KLAN NAIR AFAR SILT CHAR
Updating root:
You need the response from an OTP generator.
New secret pass phrase:
otp-md5 1000 LinuxServer
Response:reid klan nair afar silt char
ID root OTP key is 1000 LinuxServer
REID KLAN NAIR AFAR SILT CHAR
设置ssh使用opie认证
打开以下sshd_config 选项
PasswordAuthentication no
ChallengeResponseAuthentication yes
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
ChallengeResponseAuthentication yes
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
设置/etc/pam.d/sshd
加入
auth required /lib/security/pam_opie.so
注释掉
#auth required pam_stack.so service=system-auth
重启sshd
opie 是通过pam模块pam_opie 达到口令认证目的,所以任何使用pam认证模块的程序都可以用opie来实现一次性口令,并且如果能够用程序自动设置、管理和定时更新秘密口令并且提供一个访问接口用于获取当前的一次性口令,那就可以真正做到一次性口令过期和唯一性,我觉得这个东西关键还在于秘密口令的管理上,如果你知道了这个秘密口令,那就可以获取到任意多个一次性口令,而且这些一次性口令在未使用情况下都是有效的,并不存在过期问题,它只能保证一次性口令在网络传输过程中的安全,因为即使被截获了,只要当前已经使用过了,那也是一个过期口令。
阅读内文 Tags: Linux, opie, 口令