Linux服务器如何编写,如何在linux服务器上实现tacacs认证

要想在Linux实现终端访问,你绕不开的是tacacs和radius认证,如何实现tacacs认证呢?其实并不难,今天小编就给大家带来教程。

Linux服务器实现tacacs认证,通过PAM(可插拔的认证模块)实现。PAM的接口文件位于/etc/pam.d文件夹下,模块位于/lib/security文件夹中(有些服务器位于lib64/security/)。

dc34018a86b441886442f9781e2dfb29.png

默认PAM安装包中不包括tacacs认证模块,需要下载源代码进行编译,具体步骤如下(已Centos为例):

1、确认linux服务器中gcc(c编译器)、autoreconf(shell脚本工具)、yum(安装程序工具)是否安装。

例:rpm -qa |grep yum查看yum是否安装,/etc/yum.repos.d/CentOS-Base.repo中有yum默认程序源配置,一般都是http://mirrors.163.com/centos/6/os/$basearch/。

autoreconf需要安装automake和libtool,autoreconf、libtool在163镜像中没有,rpm文件见附件。安装命令为:rpm -Uvh 程序名

2、将pam_tacplus-1.3.9.tar.gz拷贝到服务器中,位置自选。tar zxvf pam_tacplus-1.3.9.tar.gz解压文件。

3、编译安装pam tacacs模块。

$ autoreconf -i

$ ./configure && make && sudo make install

4、模块默认安装在/usr/local/lib/security,若要修改位置需要再研究。将生成的pam_tacplus.so拷贝到/lib64/security下的

Libraries have been installed in:

/usr/local/lib/security

If you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- add LIBDIR to the `LD_RUN_PATH' environment variable

during linking

- use the `-Wl,-rpath -Wl,LIBDIR' linker flag

- have your system administrator add LIBDIR to `/etc/ld.so.conf'

5、修改/etc/pam.d/sshd文件,在auth类型中增加以下内容

tacacs down local配置

auth       [success=done new_authtok_reqd=done ignore=ignore default=die]   pam_tacplus.so debug server=**.**.**0.199 secret=194.120/32

tacacslocal配置

auth       sufficient   pam_tacplus.so debug server=*.*.*.* secret=*****

注:tacacs认证也需在本地创建帐户,可不设密码。

相较于保密性相对较差的radius,tacacs无疑被更多的应用于企业所用的服务器当中。而且还能支持多协议,所以,这一块的内容可是不得不学的哦、

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值