租用问题

质量为本、客户为根、勇于拼搏、务实创新

< 返回租用问题列表

如何在linux服务器上实现tacacs认证

发布时间:2023-01-11 08:12:39

  要想在Linux实现终端访问,你绕不开的是tacacs和radius认证,如何实现tacacs认证呢?其实其实不难,今天小编就给大家带来教程。
  Linux服务器实现tacacs认证,通过PAM(可插拔的认证模块)实现。PAM的接口文件位于/etc/pam.d文件夹下,模块位于/lib/security文件夹中(有些服务器位于lib64/security/)。


  默许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⑴.3.9.tar.gz拷贝到服务器中,位置自选。tar zxvf pam_tacplus⑴.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无疑被更多的利用于企业所用的服务器当中。而且还可以支持多协议,所以,这一块的内容可是不能不学的哦、