在Ubuntu 20.04| 18.04 | 16.04上安装和配置FreeIPA服务器

时间:2020-02-23 14:39:09  来源:igfitidea点击:

欢迎我们关于如何在Ubuntu 20.04 | 18.04 | 16.04 Linux系统上安装FreeIPA Server的教程。
FreeIPA是一个免费的和开源的源代码管理系统,用于集中管理网络中的用户和计算机。
在本文中,我们将介绍Ubuntu 20.04 | 18.04 | 16.04 Linux上的FreeIPA服务器的安装和配置。

在Ubuntu 20.04 | 18.04 | 16.04 Linux服务器上安装FareIPA Server的准备工作很少。

设置先决条件

在安装FreeIPA Server之前,请确保满足以下最低要求;

一个完全限定的域名 - e.g ipa.theitroad.com.主机名必须是可解析的。
如果我们没有DNS服务器,则可以在RAM10GB磁盘SPACE2 VCPU的主机文件中定义主机名.4GB

在Ubuntu 20.04| 18.04 | 16.04上安装FreeIPA服务器

嗯,在我们在Ubuntu 20.04| 18.04 | 16.04上开始安装FareIPA服务器之前,让我们做一点点内部准备。

第1步:设置适当的主机名和FQDN

为服务器设置正确的主机名

$hostname -f
ipa

这看起来不太好。
让我们完全合格。

sudo hostnamectl set-hostname ipa.example.com

确认新主机名。

$hostname -f
ipa.example.com

在/etc/hosts文件中添加FQDN,以使其从任何位置解析:

$sudo vim /etc/hosts
192.168.58.121 ipa.example.com ipa

第2步:更新Ubuntu服务器

确保系统已更新。

sudo apt -y update
sudo apt -y upgrade

升级服务器后,始终建议进行重新启动。

sudo reboot

第3步:安装RNG-Tools

FARFIPA Server在运行时执行大量加密操作,因此VM必须有足够的熵,以确保FreeIPA加密操作不会失速。
实现高熵,安装和配置RNG-Tools。

sudo apt -y install rng-tools

完成安装后,编辑文件,/etc/default/rng-tools,并通过添加行,hrngdevice =/dev/dev/urandom设置为/dev/urandom的随机数据的输入源。

$sudo vim /etc/default/rng-tools
                 …..
# This is a POSIX shell fragment
# Set to the input source for random data, leave undefined
# for the initscript to attempt auto-detection.  Set to /dev/null
# for the viapadlock and tpm drivers.
#HRNGDEVICE=/dev/hwrng
#HRNGDEVICE=/dev/null
HRNGDEVICE=/dev/urandom
…..

启用并启动RNG-Tools:

sudo systemctl enable rng-tools
sudo systemctl start rng-tools

既然我们的服务器是符合要求的准备工作,让我们在Ubuntu 20.04/18.04/Ubuntu 16.04 Linux上获得Repipa Server的实际安装。

第4步:在Ubuntu 20.04/18.04/Ubuntu 16.04上安装FreeIPA Server

运行以下命令以在Ubuntu服务器上安装FreeIPA软件包。

sudo apt -y install freeipa-server

在安装中期,系统将提示我们输入Kerberos Realm,Kerberos服务器的主机名和Kerberos领域的管理服务器的主机名。

示例:kerberos realm:theitroad.comkerberos server hostname:ipa.theitroad.comadministrative server hostname:ipa.theitroad.com

如果我们遇到与Kerberos和Tomcat相关的错误,我们可以安全地忽略它们。

安装完成后,运行FreeIPA安装命令。

sudo ipa-server-install

这将提示我们了解许多配置选项并安装FreeIPA。
第一个提示将是关于FreeIPA的集成DNS,并且由于我们在此设置中不需要此服务,因此我们无法配置它。

To accept the default options shown in square brackets, just press Enter key.…
Do you want to configure integrated DNS (BIND)? [no]: Enter
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 [ipa.theitroad.com]: Enter
The domain name has been determined based on the host name.
Please confirm the domain name [theitroad.com]: Enter
The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.
Please provide a realm name [theitroad.COM]: Enter
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: <secure password>
Password (confirm): <secure password>
The IPA server requires an administrative user, named 'admin'.
This user is a regular system account used for IPA server administration.
IPA admin password: <secure password>
Password (confirm): <secure password>
The IPA Master Server will be configured with:
Hostname:    ipa.theitroad.com
IP address(es): 192.168.58.121
Domain name: theitroad.com
Realm name:  theitroad.COM
The CA will be configured with:
Subject DN:   CN=Certificate Authority,O=theitroad.COM
Subject base: O=theitroad.COM
Chaining:  self-signed

Continue to configure the system with these values? [no]: yes
...output cut…
Client configuration complete.
The ipa-client-install command was successful
==============================================================================
Setup complete
Next steps:
1.You must make sure these network ports are open: TCP Ports: * 80, 443: HTTP/HTTPS * 389, 636: LDAP/LDAPS * 88, 464: kerberos UDP Ports: * 88, 464: kerberos * 123: ntp 2 You can now obtain a kerberos ticket using the command: 'kinit admin' This ticket will allow you to use the IPA tools (e.g., ipa user-add) and the web user interface.

既然FARFIPA Server Setup完成,请打开通过防火墙打开各种FreeIPA服务器服务所需的端口。

如果"UFW"未运行,则可以启用它并允许到上述端口的所有传入连接。

第5步:配置防火墙

如果我们安装了UFW,请启用UFW。

sudo ufw enable

打开所有必需的TCP端口

for i in 80 443 389 636 88 464; do sudo ufw allow proto tcp from any to any port $i; done

对UDP端口执行相同的操作。

for i in 88 464 123; do sudo ufw allow proto udp from any to any port $i; done

在进行更改后重新加载UFW。

sudo ufw reload

既然端口已通过防火墙打开,让我们通过初始化管理员用户的Kerberos令牌来验证我们的FreeIPA服务器。

对于正常的管理活动,已创建一个管理帐户管理员。
出现提示输入密码时,请使用admin用户的配置步骤中指定的。

# kinit admin
Password for Hyman@theitroad:

检查Kerberos门票:

Hyman@theitroad:~# klist 
Ticket cache: KEYRING:persistent:0:0
Default principal: Hyman@theitroad
Valid starting     Expires            Service principal
06/29/18 22:52:40  06/30/18 22:52:36  krbtgt/Hyman@theitroad

如果这是成功的,请尝试查找用户管理员是否存在于FreeIPA服务器上。

# ipa user-find admin
-------------
1 user matched
-------------
  User login: admin
  Last name: Administrator
  Home directory: /home/admin
  Login shell: /bin/bash
  Principal alias: Hyman@theitroad
  UID: 1506000000
  GID: 1506000000
  Account disabled: False
  ---------------------------
  Number of entries returned 1
  ---------------------------

好吧,似乎一切都很好。
我们现在可以从Web仪表板以及从命令行执行任何IPA任务。
要登录Web仪表板,请使用地址https://ipa.example.com

Web登录用户名是admin,密码是在管理用户的配置步骤中提供的密码。