您现在的位置是:首页 > 文章详情

从零构建ipa-server.实现ldap+kerberos网络用户验证

日期:2018-07-26点击:445

redhat7 linux domain identity,authentication,and policy

linux 的域标识,认证,和策略

IPA-server服务,通过网络用户和组连接系统。

1,用户信息和认证服务介绍

1.1随着现在网络的发展,在企业中主机也越来越多,主机用户管理变成一件很艰难的任务,
一种解决方式,账号信息不存放在本地系统中,而是账号信息存储在一个中心位置,实现用户的集中管理。
单点登录(single sign on )简称SSO,是目前比较流行的企业业务整合的解决方案之一,
SSO的定义是定义在多个应用系统中,用户只需要登录一次就可以访问所有信任的应用系统。

1.2构建一个集中认证管理系统需要提供:账户信息和认证信息

1.2.1账户信息:包含如,用户名,UID,GID等

 存储账号信息流行的解决方案:LADP,NIS,AD或IPA-server

1.2.2认证信息:密码,指纹等。

ldap服务 kerberos 是一种网络认证协议,仅提供SSO认证服务,通常和LDAP一起使用。

典型的实现方案:AD(微软活动目录)和IPA-server

2,从零搭建IPA-server

2.1准备工作:

一台物理主机,两台vm虚拟机,系统为redhat7.0以上(安装了图形界面的)。
物理主机的地址为:ip:192.168.0.111/24 gw:192.168.0.1 dns192.168.0.1 地址可以根据自己的情况而定
第一台虚拟机:网卡类型为自动桥接:ip:192.168.0.118/24 gw:192.168.0.1 dns 可以暂时不用配置。这台虚拟机我们将要它配置成ipa-server
第二台虚拟机:网卡类型为自动桥接:ip:192.168.0.119/24 gw;192.168.0.1 dns:192.168.0.118


2.2 IPA-server服务安装前条件:

1,必须要有完整的主机名
2,一个静态的ip地址
3,能够对主机名做解析(正向和反向解析)
4,hosts文件也要对主机名做解析。不能解析到127.1
5,开通防火墙规则和服务
6, 做时间ntp同步

2.3步骤:现在操作192.168.0.118这台虚拟机,下面就简称为:server了

1,设置主机名为server.zhuxu.co
[root@server ~]# hostnamectl set-hostname server.zhuxu.co
[root@server ~]# hostname server.zhuxu.co
2,一个静态的ip地址上面准备工作已经设置好了
3,能够对主机名做解析(正向和反向解析)这步不用做,安装ipa-server,会自动配置dns服务
4,vim /etc/hosts 文件,添加 192.168.0.118 server.zhuxu.co server 这一行。
5,为了简化步骤,直接关闭防火墙和selinux.(我会再另外发一个版本,加上防火墙的配置)
[root@server ~]# iptables -F清除iptables规则
[root@server ~]# systemctl stop iptables 停止iptables服务
[root@server ~]# systemctl disable iptables 禁止iptables 开机启动
[root@server ~]# systemctl stop firewalld 停止firewalld 服务
[root@server ~]# systemctl disable firewalld 禁止firewalld 开机启动
[root@server ~]# setenforce 0 临时关闭selinux
编辑/etc/selinux/conf 文件 SELINUX=permissive

6,vim /etc/chrony.conf 注释前三个时间服务,编辑最后一个为:server ntp1.aliyun.com iburst
[root@server ~]#systemctl restart chronyd.service 重启时间服务

7,配置好yum源,我这选择挂载光盘来做yum仓库。
[root@server ~]# vim /etc/yum.repos.d/server.repo
在文件中输入以下内容

[base] name=redhat7 baseurl=file:///mnt enabled=1 gpgcheck=0 

挂载光盘到/mnt下(请确保光盘是连接状况)
[root@server ~]# mount /dev/cdrom /mnt

服务器端安装条件准备好了:

2.4,安装ipa-server

ipa-server 依赖于dns服务才能工作,我们要装的包有:ipa-server bind bind-dyndb-ldap ipa-server-dns
bind 是提供dns服务,bind-dyndb-ldap是提供dns和ldap连接组件等,
ipa-server-dns提供了ipa-server与dns连接组件等(根据安装系统时候选的包不同,这个包有可能装过了)

[root@server ~]# yum install -y ipa-server bind bind-dyndb-ldap ipa-server-dns

2.5配置ipa-server

[root@server ~]# ipa-server-install --setup-dns ---安装ipa-server自动配置dns Server host name [server.zhuxu.co]: ---回车键(默认) Please confirm the domain name [zhuxu.co]: ---回车键(默认) Please provide a realm name [ZHUXU.CO]: ---回车键(默认) Directory Manager password: ---设置目录管理的密码 最少是8位 IPA admin password: ---设置ipa 管理员admin的密码 最少8位 一定要记住,后面要用到 Do you want to configure DNS forwarders? [yes]: no ---你想配置dns为转发器吗? 选择no Do you want to search for missing reverse zones? [yes]: yes --你想配置dns的反向域吗?选择yes Continue to configure the system with these values? [no]: yes --继续配置系统其他的值? 选择yes
[root@server ~]# systemctl enable sssd --开机自启动sssd服务(sssd:system security service deamon 系统安全服务) [root@server ~]# systemctl start sssd --开启sssd服务(可能默认已经开启了) [root@server ~]# authconfig --enablemkhomedir --update 创建的用户,默认创建用户家目录,更新认证信息

2.6验证ipa-server和dns.

2.6.1验证ipa-server

[root@server ~]# kinit admin ---必须要登陆admin 才能管理域 Password for admin@ZHUXU.CO: [root@server ~]# ipa user-find --all 查看所有域用户的信息 1 user matched dn: uid=admin,cn=users,cn=accounts,dc=zhuxu,dc=co User login: admin .... Number of entries returned 1

2.6.2验证nds,正反向解析

[root@server ~]# dig -t a server.zhuxu.co 查看server.zhuxu.co 的A 记录 [root@server ~]# dig -t ptr 118.0.168.192.in-addr.apra 查看server.zhuxu.co 的PTR记录

2.7服务器配置结束。重启系统

[root@server ~]# reboot

3,通过图像界面添加用户和主机(通过命令也会介绍请看下一章nfs使用域用户)

可以通过server.zhuxu.co 终端中的火狐输入https://server.zhuxu.co/ipa/ui 来管理。
从零构建ipa-server.实现ldap+kerberos网络用户验证

从零构建ipa-server.实现ldap+kerberos网络用户验证

从零构建ipa-server.实现ldap+kerberos网络用户验证

从零构建ipa-server.实现ldap+kerberos网络用户验证

从零构建ipa-server.实现ldap+kerberos网络用户验证

从零构建ipa-server.实现ldap+kerberos网络用户验证
从零构建ipa-server.实现ldap+kerberos网络用户验证

客户端配置

1准备工作

1,配置主机名

[root@client ~]# hostnamectl set-hostname client.zhuxu.co [root@client ~]# hostname client.zhuxu.co

2,设置一个静态ip地址 dns一定要指向server.zhuxu.co 的ip
3,关闭防火墙同server端一样
4,修改hosts文件,添加192.168.0.119 client.zhuxu.co client
5,做时间同步
vim /etc/chrony.conf 注释前三个时间服务,编辑最后一个为:server ntp1.aliyun.com iburst
[root@server ~]#systemctl restart chronyd.service 重启时间服务
6,配置好yum源,我这选择挂载光盘来做yum仓库。
[root@server ~]# vim /etc/yum.repos.d/server.repo
在文件中输入以下内容

[base] name=redhat7 baseurl=file:///mnt enabled=1 gpgcheck=0 

挂载光盘到/mnt下(请确保光盘是连接状况)

[root@server ~]# mount /dev/cdrom /mnt

2配置客户端

2.1yum install -y authconfig authconfig-gtk ipa-client

2.2用图形化配置kerberos认证信息

[root@client ~]#authconfig-gtk
从零构建ipa-server.实现ldap+kerberos网络用户验证

从零构建ipa-server.实现ldap+kerberos网络用户验证

2.3配置ipa-client

[root@client ~]# ipa-client-install --domain=zhuxu.co --no-ntp`--realm=ZHUXU.CO --mkhomedir
加入域,不启用ntp,创建用户时自动创建家目录
Continue to configure the system with these values? [no]: yes ---继续配置系统其他的值? 选择yes
User authorized to enroll computers: admin ---域管理员
Password for admin@ZHUXU.CO: ---密码

3验证用户是否能登录

[root@client ~]# ssh tom@client.zhuxu.co ---在客户端实验登录
Password: ---输入密码
Password expired. Change your password now. --提醒你密码过期
Current Password: --输入现用密码
New password: ---新密码
Retype new password:
Creating home directory for tom.
[tom@client ~]$ whoami --登陆成功
tom
[tom@client ~]$ pwd --在家目录下,说明家目录也是创建成功了。
/home/tom

所有配置结束,在网上搜索不到ipa-server 配置方法。这可能是在百度中找到的最全的配置方法了,还是从零构建的。2018年7月27日凌晨1:34分

原文链接:https://blog.51cto.com/zhuxu91313/2150779
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章