首页 > 其他分享 >02.FreeIPA、FreeRadius双因子认证

02.FreeIPA、FreeRadius双因子认证

时间:2023-07-30 14:45:51浏览次数:43  
标签:02 name enabled server etc raddb ldap FreeIPA FreeRadius

一、安装先决条件

  1. Rocky 8 (2G内存以上,30G硬盘,镜像源修改为阿里云)

二、安装FreeIPA

修改SeLinux、关闭防火墙、更新系统:

timedatectl set-timezone Asia/Shanghai
setenforce 0
systemctl stop firewalld.service
dnf  update

安装前准备:

设置主机名:
hostnamectl set-hostname freeipa.test.local
修改host,并保留以下内容:
vim /etc/hosts
192.168.248.128 freeipa.test.local

Rocky8需要使用输入以下命令,方可安装ipa;而Rocky9是不需要的。

默认情况,FreeIPA软件包在Rocky标准库中不可用,需要启用idm:DL1存储库,然后同步存储库
dnf module enable idm:DL1
dnf distro-sync

安装FreeIPA Server

安装相关组件
dnf install ipa-server ipa-server-dns -y

部署FreeIPA

ipa-server-install

The log file for this installation can be found in /var/log/ipaserver-install.log
==============================================================================
This program will set up the IPA Server.
Version 4.10.1

This includes:
  * Configure a stand-alone CA (dogtag) for certificate management
  * Configure the NTP client (chronyd)
  * Create and configure an instance of Directory Server
  * Create and configure a Kerberos Key Distribution Center (KDC)
  * Configure Apache (httpd)
  * Configure SID generation
  * Configure the KDC to enable PKINIT

To accept the default shown in brackets, press the Enter key.

Do you want to configure integrated DNS (BIND)? [no]: no

Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
<hostname>.<domainname>
Example: master.example.com


Server host name [freeipa.test.local]:

The domain name has been determined based on the host name.

Please confirm the domain name [test.local]:

The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.

Please provide a realm name [TEST.LOCAL]:
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and has full access
to the Directory for system management tasks and will be added to the
instance of directory server created for IPA.
The password must be at least 8 characters long.

Directory Manager password:
Password (confirm):

The IPA server requires an administrative user, named 'admin'.
This user is a regular system account used for IPA server administration.

IPA admin password:
Password (confirm):

Trust is configured but no NetBIOS domain name found, setting it now.
Enter the NetBIOS name for the IPA domain.
Only up to 15 uppercase ASCII letters, digits and dashes are allowed.
Example: EXAMPLE.


NetBIOS domain name [TEST]:

Do you want to configure chrony with NTP server or pool address? [no]: no

The IPA Master Server will be configured with:
Hostname:       freeipa.test.local
IP address(es): 192.168.248.128
Domain name:    test.local
Realm name:     TEST.LOCAL

The CA will be configured with:
Subject DN:   CN=Certificate Authority,O=TEST.LOCAL
Subject base: O=TEST.LOCAL
Chaining:     self-signed

Continue to configure the system with these values? [no]: yes

如下部署完成:

修改Windows的hosts文件,并添加如下内容:

C:\Windows\System32\drivers\etc\hosts
192.168.248.128  freeipa.test.local

通过之前设置的用户密码进行登录;

添加用户:

关联Token:



通过OTP软件进行扫描,我这里使用的是微软推出的Authenticaor,这个软件能够通过微软账号进行同步:

选择账户认证类型:

使用刚才创建的test01账号登录freeipa,在第一次登录的时候只使用密码登陆即可,并在后面修改用户密码:

需要注意的是,这里的密码是通过“密码+OTP”的组合。比如,你的密码是“123456”,而OTP是“203221”,那么这里的密码就是“123456203221”。

重置你们的密码:

即可显示如下信息:

需要注意的是,freeipa上面的OTP都是一次性的,已经使用过的OTP是没有办法继续使用的。

三、安装配置FreeRaiuds

安装freeradius:

dnf install freeradius freeradius-utils freeradius-ldap freeradius-krb5

配置freeradius的/etc/raddb/clients.conf文件:

### 配置Radius认证的客户端网段
vim /etc/raddb/clients.conf
client localhost {
	ipaddr = 192.168.248.0/24
	proto = *
	secret = testing123
	require_message_authenticator = no
	nas_type = other
	limit {
		max_connections = 16
		life = 0
		idel_timeout = 30
	}
}
### ipv6配置类似配置即可

配置freeradius的/etc/raddb/sites-enabled/default中的ldap配置,确保认证用户从ldap数据库中获取数据:

vim /etc/raddb/sites-enabled/default
### 在authorize模块启用LDAP
authorize {
	ldap
	if ((ok || updated) && User-Password) {
		update {
			control:Auth-Type := ldap
		}
	}
}

### 在authenticate模块启用LDAP
authenticate {
	Auth-Type LDAP {
		ldap
	}
}

配置freeradius的/etc/raddb/sites-enabled/inner-tunnel中的ldap配置,确保认证用户从ldap数据库中获取数据:

vim /etc/raddb/sites-enabled/inner-tunnel
### 在authorize模块启用LDAP
authorize {
	ldap
	if ((ok || updated) && User-Password) {
		update {
			control:Auth-Type := ldap
		}
	}
}

### 在authenticate模块启用LDAP
authenticate {
	Auth-Type LDAP {
		ldap
	}
}

将LDAP添加到mods-enabled中

ln -s /etc/raddb/mods-available/ldap /etc/raddb/mods-enabled/

我们通过ldapsearch搜索一下,查看dn的具体信息,在这里需要输入之前设置的ldap密码:

ldapsearch -x -v -W -D 'cn=Directory Manager' uid=test01 | grep test01


修改mods-enabled中LDAP属性"

vim /etc/raddb/mods-available/ldap

ldap {
	server = 'freeipa.test.local'
	base_dn = 'cn=compat,dc=test,dc=local'
}

然后就可以启动radiusd的调式模式,验证相关功能是否正常;

radiusd -X


在出现上述显示之后,我们再打开一个终端进行测试,我们从本地发起测试,所以对应要用到上面设置的 secret,用test01登录,这里 1qaz2wsx217117 是 test01密码和OTP的组合。

我们已经看到Received Access-Accept就可以了。
设置Radius开机自动启动

systemctl enable radiusd
systemctl start radiusd

五、问题点:

1、问题1


Configuring certificate server (pki-tomcatd). Estimated time: 3 minutes
  [1/29]: configuring certificate server instance
Failed to configure CA instance
See the installation logs and the following files/directories for more information:
  /var/log/pki/pki-tomcat
  [error] RuntimeError: CA configuration failed.
CA configuration failed.
The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information

解决方式:
RockyLinux 安装过程中会出现如上报错,则说明本地已存在其他证书系统,需要删除相关证书文件。

2、问题2

Unable to check file "/etc/raddb/certs/server.pem": No such file or directory
/etc/raddb/mods-enabled/eap[183]: Failed parsing configuration item "private_key_file"
rlm_eap_tls: Failed initializing SSL context
rlm_eap (EAP): Failed to initialise rlm_eap_tls
/etc/raddb/mods-enabled/eap[14]: Instantiation failed for module "eap"

解决方式:
需要生成相关证书,大家也可以自行编译相关的证书,证书配置文件也在这个目录下面。

cd /etc/raddb/certs
./bootstrap

标签:02,name,enabled,server,etc,raddb,ldap,FreeIPA,FreeRadius
From: https://www.cnblogs.com/ColoFly/p/17591405.html

相关文章

  • 2023-7-28、29 文件监控和ssrf
    27晚上+28、29写了个文件监控的脚本,目前除了基本的监控只有自动删除新增文件和自动恢复被删文件的功能这点ssrf是28号的,先发了,要不不知道要拖到啥时候,等明天把脚本和剩下的发了ssrf 进去之后是这样的 让我们访问flag.php 只能来自127.0.0.1伪协议  直接读试试......
  • FL Studio 21官方中文版功能介绍及2023最新下载详细图文安装激活教程配置要求
    FLStudio21版本更新现已发布,在这次更新中优化了很多功能,但这些现在都不重要,FLStudio21版本的这次更新中令人瞩目的更新莫过于对简体中文版的支持了。以前FLStudio只有英文版,想要用上中文版只有用汉化包,而且有些音译过来的并不准确,或多或少存在些问题。而此次更新的FLStudio21......
  • ORA-00205:识别控制文件时出错,有关详细信息,请查看警报日志
    错误信息【汉】ORA-00205:识别控制文件时出错,有关详细信息,请查看警报日志【英】ORA-00205:errorinidentifyingcontrolfile,checkalertlogformoreinfo例在正常启动实例时报错,并且实例仅启动到NOMOUNT状态。版本Oracle【11.2.0.3.0】、【11.2.0.4.0】原因数据库启动在从nomo......
  • centos环境minio安装踩坑指南2023年7月30日
    MinIO的安装踩坑指南环境centos71.安装MinIO官方文档Binary下载,按照官网的路径配置比较快下载miniowgethttps://dl.min.io/server/minio/release/linux-amd64/minio修改minio的权限chmod+xminio移动下载的文件到此文件夹下sudomvminio/usr/local/bin/2.......
  • 2023暑假集训记1
    训练7.1~7.3(组合数学)上课上午来了两名学弟一起听\(\texttt{yny}\)学长讲组合数学。学长先讲了最基础的组合数定义,接着讲了亿些公式,和些恒等变换。注:之后的两天(7.2和7.3)我进行了消化,并且全部理解。讲了基本的公式恒等式后,学长通过讲例题使我们将知识进行运用。运用题对我来......
  • NOI2023游寄
    Before提前若干天到成都,感觉环境很好啊。提前参观成七,果然是别人的学校,有\(NOI\)那味了打了套全真模拟,但是没出结果,不重要,反正啥也不会。、在宾馆/成七打了一堆板子,适应了键盘,其实用起来还不错?最后一天晚上出去吃,和\(Kaguya\)和牛老师吃了一顿麻辣烫,体验良好,出了很多汗......
  • 成语积累 20230730
    刚毅木讷:刚:坚强;毅:果决;木:质朴;讷:说话迟钝,此处指言语谨慎。是孔子称颂人的四种品质。例句:被徐志摩赞为“刚毅木讷,强力努行”的他,曾是哈佛大学第一位来自中国的哲学博士。木雁之间:木雁:比喻有才和无才。指有才和无才之间。比喻才能或学问处于中间水平,能保全自己,远避祸患。(君子藏器于......
  • 模具设计软件 Vero VISI 2023 22新版详细下载 软件推荐
    VeroVISI是一款CAD制作软件,是一款十分专业和优秀好用的流程图绘制软件。可以帮助用户进行模具设计,可以轻松直观地创建流程图、网络图、组织结构图、工程设计以及其他图形,并且拥有极高的自由度和设计辅助功能,提供基于行业特定自动化的完整模具工具设计,方便好用。kkx给大家分享的Ver......
  • 2023.7.24-2023.7.30暑假第三周博客
    2023.7.25今日学习了NameNode元数据Hadoop是如何记录和整理文件和block块的关系呢?NameNode基于一批edits和一个fsimage文件的配合完成整个文件系统的管理和维护edits是一个流水账文件,记录了hdfs中的每一次操作,以及本次操作影响的文件及其对应的block会存在多个edits文件确保......
  • NOI2023 游记
    Day???来nfls集训并见证了一半的HN省队都在南京的奇景。认真打了一个月模拟赛,感觉还不错,终于有一套比较稳定的策略了虽然不时过不了大众题,在第14场的时候因为见过原题首次冲进前十,太感动了!因为补觉错过了UNR,保住了一点信心。最后一周的时候感觉有点累,润回长沙开摆了,算......