How to Install FreeIPA Server on CentOS 7

FreeIPA is a free, open-source, integrated Identity and Authentication solution for Linux-based operating systems. With FreeIPA, you can manage users, groups, hosts and services from the centralized server, like LDAP and Microsoft Active Directory. FreeIPA uses a combination of Fedora, MIT Kerberos, NTP, DNS, 389 Directory Server, SSSD and other free/open-source components. FreeIPA provides a web-based user interface and command line tools to perform administrative tasks.

In this tutorial, we’ll explain how to install and configure FreeIPA server on CentOS 7.

Prerequisites

  • A server running CentOS 7 with a minimum 2 GB of RAM.
  • A static IP address 192.168.0.101 is configured on your server.
  • A root password configured on your server.

Getting Started

First, you will need to disable Selinux on your CentOS 7 server. You can do this by editing /etc/selinux/config file:

# nano /etc/selinux/config

Change the file as shown below:

SELINUX=disabled
SELINUXTYPE=targeted

Save and close the file. Then, restart your server to apply the changes:

Next, you will need to set up a fully qualified domain name (FQDN) in /etc/hosts file. You can set it by editing /etc/hosts file:

# nano /etc/hosts

Add the following line:

168.0.101 freeipa.example.lan freeipa

Save and close the file. Next, change the hostname of the server with the following command:

# hostnamectl set-hostname freeipa.example.lan

Now, log out and log in again on your server to activate the new hostname.

Install and Configure FreeIPA

You can install all the required packages for FreeIPA by running the following command:

# yum install ipa-server bind-dyndb-ldap ipa-server-dns -y

Once all the packages are installed, you will need to configure FreeIPA server and DNS. You can configure them by running the following command:

# ipa-server-install --setup-dns

During the configuration process, you will need to provide the server hostname, domain name and REALM name as shown below:

The log file for this installation can be found in /var/log/ipaserver-install.log

==============================================================================

This program will set up the IPA Server.

This includes:

* Configure a stand-alone CA (dogtag) for certificate management
* Configure the Network Time Daemon (ntpd)
* Create and configure an instance of Directory Server
* Create and configure a Kerberos Key Distribution Center (KDC)
* Configure Apache (httpd)
* Configure DNS (bind)
* Configure the KDC to enable PKINIT

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

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


Server host name [freeipa.example.lan]: example.lan

Warning: skipping DNS resolution of host freeipa.example.lan
The domain name has been determined based on the host name.

Please confirm the domain name [example.lan]: lan

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


Please provide a realm name [EXAMPLE.LAN]: LAN
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.

Next, you will need to provide the directory manager and the FreeIPA admin passwords as shown below:

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):

Checking DNS domain example.lan., please wait ...
Do you want to configure DNS forwarders? [yes]: yes

Next, type yes for the DNS forwarder configuration and hit ENTER to continue:

Following DNS servers are configured in /etc/resolv.conf: 8.8.8.8, 8.8.4.4
Do you want to configure these servers as DNS forwarders? [yes]: yes
All DNS servers from /etc/resolv.conf were added. You can enter additional addresses now:
Enter an IP address for a DNS forwarder, or press Enter to skip:
Checking DNS forwarders, please wait ...

Do you want to search for missing reverse zones? [yes]: yes

Next, type yes and hit ENTER to search and create the missing reverse zone:

Do you want to create reverse zone for IP 192.168.0.101 [yes]: yes
Please specify the reverse zone name [0.168.192.in-addr.arpa.]:
Using reverse zone(s) 0.168.192.in-addr.arpa.

The IPA Master Server will be configured with:
Hostname: example.lan
IP address(es): 192.168.0.101
Domain name: lan
Realm name: LAN

BIND DNS server will be configured to serve IPA domain with:
Forwarders: 8.8.8, 8.8.4.4
Forward policy: only
Reverse zone(s): 168.192.in-addr.arpa.
Continue to configure the system with these values? [no]: yes

Next, type yes to continue to configure the system with the above value. You should see the following output:

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
		  * 53: bind
		UDP Ports:
		  * 88, 464: kerberos
		  * 53: bind
		  * 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.

Be sure to back up the CA certificates stored in /root/cacert.p12
These files are required to create replicas. The password for these
files is the Directory Manager password

Configure Firewall for FreeIPA

Next, you will need to allow all the required services like, http, https, ldap, ldaps, Kerberos, and kpasswd from firewalld. You can allow them with the following commands:

# firewall-cmd --permanent --add-service=http
# firewall-cmd --permanent --add-service=https
# firewall-cmd --permanent --add-service=ldap
# firewall-cmd --permanent --add-service=ldaps
# firewall-cmd --permanent --add-service=kerberos
# firewall-cmd --permanent --add-service=kpasswd
# firewall-cmd --permanent --add-service=dns

Next, reload the firewalld to apply the configuration with the following command:

# firewall-cmd --reload

Verify FreeIPA Server

Next, you will need to verify the FreeIPA installation whether it is working properly.

To do so run the kinit command to get token via Kerberos:

# kinit admin

Provide your admin password that you have supplied during the installation. If everything is fine the command run without any error.

Password for [email protected]:

Next, search the admin user in FreeIPA database with the following command:

# ipa user-find admin

You should get the following output:

--------------
1 user matched
--------------
User login: admin
Last name: Administrator
Home directory: /home/admin
Login shell: /bin/bash
Principal alias: [email protected]
UID: 1974200000
GID: 1974200000
Account disabled: False
----------------------------
Number of entries returned 1
----------------------------

Access FreeIPA Web Interface

FreeIPA server is now installed and configured. It’s time to access FreeIPA web interface:

Open your web browser and type the URL https://freeipa.example.lan. You will be redirected to the following page:

Provide your admin username and password, and click on the Login You should see the FreeIPA web interface in the following screen:

Add New FreeIPA User

You can also create a new user with FreeIPA. Before creating a new user, you will need to enable “create home directory”. You can do it by editing the LDAP client configuration with the following command:

# authconfig --enablemkhomedir --update

Next, create a new user named user1 with the following command:

# ipa user-add user1 --first=user1 --last=user1 [email protected] --shell=/bin/bash --password

Provide your desired password and hit Enter to create a new user as shown below:

Password:
Enter Password again to verify:
------------------
Added user "user1"
------------------
User login: user1
First name: user1
Last name: user1
Full name: user1 user1
Display name: user1 user1
Initials: uu
Home directory: /home/user1
GECOS: user1 user1
Login shell: /bin/bash
Principal name: [email protected]
Principal alias: [email protected]
User password expiration: 20191104170625Z
Email address: [email protected]
UID: 1974200001
GID: 1974200001
Password: True
Member of groups: ipausers
Kerberos keys available: True

You can now use this user to login your FreeIPA web interface and also login to your system.

Congratulations! you have successfully installed and configured FreeIPA server on CentOS 7. You can now easily create new users, groups and manage them through web browser easily.

To write a comment on this article, fill out the form below. Fields marked with an asterisk (*) are required.