Kerberos+LDAP+NFSv4 实现单点登录(中)

五.nfs服务器的安装
1.安装nfs-kernel-server
[email protected]:~# apt-get install nfs-kernel-server nfs-common

修改/etc/default/nfs-kernel-server文件

NEED_SVCGSSD=""
改为
NEED_SVCGSSD="yes"

重启nfs-kernel-server

[email protected]:~# /etc/init.d/nfs-kernel-server stop
[email protected]:~# /etc/init.d/nfs-kernel-server start
[email protected]:~# ps -e |grep gss
10275 ?        00:00:00 rpc.svcgssd

2.安装libnss-ldapd、nslcd
为了获取ldap用户信息,要安装libnss-ldapd、nslcd
在新立得选上libnss-ldapd、nslcd会自动将libpam-ldapd、nscd、nslcd-utils三个包打上安装标记,可手工将该三个包去掉安装标记,不需此三个包

[email protected]:~# apt-get install libnss-ldapd nslcd

注意安装nslcd配置过程中,提示输入LDAP服务器地址的输入框默认了uri ldapi:/// ,一定要将 ldapi 改为 ldap ,因为ldapi:///表示用在unix域

1)nslcd
安装过程中
ldap server uri 填 ldap://192.168.1.101/
ldap服务器搜索起点 填 dc=ctp,dc=net

查看配置文件

[email protected]:~# cat /etc/nslcd.conf
#The user and group nslcd should run as.
uid nslcd
gid nslcd

#The location at which the LDAP server(s) should be reachable.
#填LDAP服务器地址,即kdc服务器地址
uri ldap://192.168.1.101/

#The search base that will be used for all queries.
base dc=ctp,dc=net

[email protected]:~#

2)libnss-ldapd
安装过程中
name services to configure 选 [*] passwd

新建测试目录
[email protected]:~# mkdir /home/linlin/share

将该目录属性改为用户ID及用户组ID都为4001,即为ldap用户krblinlin的uidNumber/gidNumber,但并在nfs客/服两主机本地不存在该ID用户
[email protected]:~# chown 4001:4001 /home/linlin/share

2.1)假定没选[*] passwd

[email protected]:~$ ls -ld /home/linlin/share
drwxr-xr-x 2 4001 4001 4096 9月  18 21:13 /home/linlin/share

则取不到ldap用户信息

2.2)可重设libnss-ldapd,选上[*] passwd
[email protected]bian:~# dpkg-reconfigure libnss-ldapd

...
┌───────────┤  正在设定 libnss-ldapd  ├──────────────────────────┐
│  For this package to work, you need to modify the /etc/nsswitch.conf file to use the ldap datasource. │
│  You can select the services that should have LDAP lookups enabled. The new LDAP lookups will be added│
│as the last datasource. Be sure to review these changes.                                               │
│  Name services to configure:                                                                          │
│    [ ] hosts                                                                                          │
│    [ ] netgroup                                                                                       │
│    [ ] networks                                                                                       │
│    [*] passwd                                                                                         │
│    [ ] protocols
...

/etc/nsswitch.conf: enable LDAP lookups for passwd
[email protected]:~#

查看配置文件,可见passwd一行后添加了ldap

[email protected]:~# cat /etc/nsswitch.conf
passwd:         compat ldap
group:          compat
shadow:         compat
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis
[email protected]:~#
[email protected]:~$ ls -ld /home/linlin/share
drwxr-xr-x 2 krblinlin 4001 4096 9月  18 21:13 /home/linlin/share

则已获取显示ldap用户信息,krblinlin为ldap用户,同时也是Kerberos用户
获取用户信息很重要,因为nfs客/服两端的认证用户信息要匹配,即两边的域+用户名要一致

注:本实验只获取ldap用户的用户名,无法获取ldap用户的所属用户组名(如上仍显示用户组ID 4001),但不影响实验效果

3.网络共享
本实验目的NFSv4认证采用安全性强的gss/krb5认证(Kerberos),而不是弱的系统认证(AUTH_SYS)

编辑/etc/exports文件

[email protected]:~# cat /etc/exports
/home/linlin/share  gss/krb5(rw,sync,no_subtree_check)
[email protected]:~#

执行导出
[email protected]:~# exportfs -r

查看导出

[email protected]:~# exportfs -v
/home/linlin/share
        gss/krb5(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,root_squash,no_all_squash)
[email protected]:~#

4.问题解决
nfs服务器没有启动rpc.idmapd,导致nfs客户机没写权限
1)

[email protected]:~# rpc.idmapd
rpc.idmapd: libnfsidmap: using (default) domain: ctp.net
rpc.idmapd: libnfsidmap: Realms list: ‘CTP.NET‘
rpc.idmapd: libnfsidmap: loaded plugin /lib/x86_64-linux-gnu/libnfsidmap/nsswitch.so for method nsswitch

[email protected]:~# ps -e|grep rpc
  634 ?        00:00:00 rpciod
  757 ?        00:00:00 rpcbind
 1188 ?        00:00:00 rpc.svcgssd
 1261 ?        00:00:00 rpc.mountd
[email protected]:~#

手工运行rpc.idmapd仍没启动rpc.idmapd

2)
原来nfs服务器的nfs-common要重启

[email protected]:~# /etc/init.d/nfs-common stop
[email protected]:~# /etc/init.d/nfs-common start

[email protected]:~# ps -e|grep rpc
  634 ?        00:00:00 rpciod
  757 ?        00:00:00 rpcbind
14256 ?        00:00:00 rpc.svcgssd
14258 ?        00:00:00 rpc.mountd
15023 ?        00:00:00 rpc.statd
15041 ?        00:00:00 rpc.idmapd
[email protected]:~#

nfs客户机已可写权限了

原文地址:https://blog.51cto.com/13752418/2443823

时间: 2024-08-30 10:55:34

Kerberos+LDAP+NFSv4 实现单点登录(中)的相关文章

Kerberos+LDAP+NFSv4 实现单点登录(续2)--一键安装

( 附:LDAP简单认证登录 login4ldap-ver0.0.6.zip 源代码 下载地址 http://u.163.com/NeMVmlIT 提取码: ObEubL7Y ) 上篇Kerberos+LDAP+NFSv4 实现单点登录(续1)链接地址http://lulinlin1.lofter.com/post/1cf3848f_11f58066?act=qbbloglofter_20150506_01 本篇是前两篇的总结,编写成一键安装脚本onekeysso.sh,并需名为dns.ldif

Kerberos+LDAP+NFSv4 实现单点登录(续4)--SASL/GSSAPI

前篇<Kerberos+LDAP+NFSv4 实现单点登录(续1)--dns+dhcp>的krb5 + ldap + bind9 + bind9-dyndb-ldap 全面升级到debian 10,出现bind9-dyndb-ldap的GSSAPI+krb5_keytab认证机制无法连接ldap数据库.查看日志:SASL/GSSAPI authentication startedError: Local errorAdditional info: SASL(-1): generic failu

Kerberos+LDAP+NFSv4 实现单点登录

Kerberos : 身份认证LDAP : 目录信息服务NFSv4 : 网络共享 实验环境 : debian 9 三台主机:nfs服务器 : 192.168.1.103nfs客户机 : 192.168.1.102 即SSSD客户端+NFS客户端kdc服务器 : 192.168.1.101 即Kerberos+LDAP 以下 [email protected]:~# 表示以root根用户运行命令 一.安装NTP时间同步要使用Kerberos提供身份认证,各主机需时间同步 在一台主机上安装时间同步服

Kerberos+LDAP+NFSv4 实现单点登录(下)

六.nfs客户机的安装nfs客户机也即SSSD客户机,需安装sssd和nfs-common 1.安装sssd会自动安装libsasl2-modules-gssapi-mit(非依赖)libsasl2-modules-gssapi-mit和libsasl2-modules-gssapi-heimdal两者冲突,安装libsasl2-modules-gssapi-heimdal也可以 [email protected]:~# apt-get install sssd sssd-krb5 sssd-l

Kerberos+LDAP+NFSv4 实现单点登录(上)

Kerberos : 身份认证LDAP : 目录信息服务NFSv4 : 网络共享 实验环境 : debian 9 三台主机:nfs服务器 : 192.168.1.103nfs客户机 : 192.168.1.102 即SSSD客户端+NFS客户端kdc服务器 : 192.168.1.101 即Kerberos+LDAP 以下 [email protected]:~# 表示以root根用户运行命令 一.安装NTP时间同步要使用Kerberos提供身份认证,各主机需时间同步 在一台主机上安装时间同步服

在单点登录中传递参数问题

这两天一直忙一个事情,在单点登录运用的过程中因为要传6个参数,get请求每次只能获取第一个参数,post只能正常访问路径,而参数却全部为null. 经历了postman的各种测试,晕头转向,在产品部老哥的一句话让我醍醐灌顶瞬间清醒,为什么不尝试把我们习惯的http请求中多参数传递的拼接符号 "&"尝试转义! 瞬间成功! 这件事让我琢磨了两天,因为一句话而茅塞顿开. 失败的请求方式: http://localhost:8090/gzdbthreeweb/control?pages

基于CAS实现单点登录(SSO):CAS+LDAP实现单点登录认证

[一].概述 CAS是N个系统的中心认证入口,而贯穿多个系统的用户信息是共用的,应该被单独维护,而这些信息可能属于不用的系统,不用的组织,不用的国家,从而形成了树形结构,而使用关系型数据库维护树形结构信息是它的弱点,这就是本文CAS和LDAP整合的初衷. 本来主要详细是介绍CAS和LDAP整合实现单点登录的步骤. [二].详细步骤 1.LDAP安装配置 详见: 介绍openLDAP在windows上的安装配置 安装配置,添加部分测试数据如下: 2.CAS的基础安装配置: 见SSO之CAS单点登录

单点登录技术:微软Passport单点登录协议和自由联盟规范

随着互联网络应用的普及,越来越多的人开始使用互联网上提供的服务.然而目前提供服务的网站大多采用用户名.口令的方式来识别用户身份,这使得用户需要经常性的输入自己的用户名.口令.显然这种认证方式存在着弊端:随着用户网络身份的增多,用户相应的需要记忆多组用户名.口令,这给用户造成记忆上的负担:另外频繁的输入用户名.口令,会相应的增大用户的口令密码被破解的机率.为了改变这一现状,单点登录技术应运而生. 单点登录技术的核心思想是通过一定的方式使得各提供服务的网站之间建立某种联系,用户只需要在其中一个认证网

ofbiz SSO 单点登录

 1.ofbiz单点登录介绍 ofbiz点单登录是集成了CAS SSO,LDAP使用的,具体的CAS与LDAP怎么应用,在这里不做介绍. 2.ofbiz点单登录文档 ofbiz 12版本中,有英文的简单的ofbiz单点登录的问题. 路径在:apache-ofbiz-12.04.01\framework\documents\SingleSignOn.xml 3.ofbiz单点登录目录 ofbiz  单点登录集成的目录在:apache-ofbiz-12.04.01\specialpurpose\