How to Install and Configure FreeIPA on Rocky Linux/Centos 8

In this guide, you will learn how to install and configure FreeIPA server on Rocky Linux/Centos 8. This guide also works on RHEL 8 and other derivatives like Oracle Linux and Alma Linux.

FreeIPA is a centralized authentication, authorization, and account information system. FreeIPA stands for Free Identity, Policy, Audit and it is an open-source identity management solution based on an LDAP directory and Kerberos with optional components such as DNS server, certification authority, and more. It can manage a domain with users, computers, policies, and trust relationships. It is similar to Microsoft Active Directory.

FreeIPA can also set up a forest-to-forest trust with existing Active Directory forests and even live in a DNS zone below a zone managed by Active Directory, as long as they do not overlap. It consists of a web interface and command-line administration tools.

Also Check:

Prerequisites

To follow along well, ensure you have:

  • A RHEL 8 based server like Rocky Linux
  • The server should have at least 1GB of RAM, 2GB for optimum performance
  • The server should have at least 10GB of disk space
  • Root access or user with sudo access
  • Set up a fully qualified domain name as hostname. We will use subdomain ipa.citizix.com in our case

Update system, Set hostname and Timezone

Use this command to ensure that our system packages are up to date:

1
sudo dnf -y update

We need to set up the FQDN(Fully qualified domain name) we want to use to point to our server. We need to set the subdomain (ipa.citizix.com) DNS to resolve to our server. if you don’t have a DNS server, then we need to manually add entries in the host file of our server to resolve the system IP address for our fully qualifies hostname.

Set hostname:

1
sudo hostnamectl set-hostname ipa.citizix.com

Replace ipa.citizix.com with the one you want to set for your server’s hostname.

Confirm the hostname:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
$ hostnamectl

   Static hostname: ipa.citizix.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ee3563997878469ebfcc3f721aec3c66
           Boot ID: 029a7962df24475091296d32b222f166
    Virtualization: kvm
  Operating System: Rocky Linux 8.4 (Green Obsidian)
       CPE OS Name: cpe:/o:rocky:rocky:8.4:GA
            Kernel: Linux 4.18.0-305.3.1.el8_4.x86_64
      Architecture: x86-64

$ hostname

ipa.citizix.com

The domain used for the hostname must resolve the IP address to reach to server. Next, point your server IP address to hostname i.e fully qualified Domain name, in the Host file.

1
echo "10.2.40.149 ipa.citizix.com ipa" | sudo tee -a /etc/hosts

Replace 10.2.40.149 with your server IP address and ipa.citizix.com with your FQDN hostname.

Once done, confirm that the system can ping the host to resolve the same.

1
2
3
4
ping -c 2

<meta charset="utf-8" />
ipa.citizix.com

Output on my machine

1
2
3
4
5
6
7
8
9
# ping -c 2 ipa.citizix.com

PING ipa.citizix.com (10.2.40.149) 56(84) bytes of data.
64 bytes from ipa.citizix.com (10.2.40.149): icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from ipa.citizix.com (10.2.40.149): icmp_seq=2 ttl=64 time=0.029 ms

--- ipa.citizix.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1039ms
rtt min/avg/max/mdev = 0.029/0.031/0.033/0.002 ms

Finally, let us set up the timezone to match the region you are in. For me I am in the Africa/Nairobi timezone, I will use this command:

1
sudo timedatectl set-timezone Africa/Nairobi

Confirm that it was configured as expected:

1
2
3
4
5
6
7
8
$ timedatectl
               Local time: Tue 2021-11-09 07:58:09 EAT
           Universal time: Tue 2021-11-09 04:58:09 UTC
                 RTC time: Tue 2021-11-09 04:58:08
                Time zone: Africa/Nairobi (EAT, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Installing FreeIPA Server

No extra RPM repository is required, all the packages and dependencies are available in default OS default repositories.

In EL8 based systems,the packages necessary for installing FreeIPA server are shipped in a module stream called the** DL1 stream**. You’ll need to enable the stream before performing packages installation from the stream.

You can use the following command to list modules that contain IdM packages.

1
2
3
4
5
6
7
8
9
$ sudo yum module list idm

Rocky Linux 8 - AppStream
Name Stream     Profiles                        Summary
idm  DL1        adtrust, client, common [d], dn The Red Hat Enterprise Linux Identity Management syst
                s, server                       em module
idm  client [d] common [d]                      RHEL IdM long term support client module

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

You can check more about the Stream using the command:

1
sudo dnf module info idm:DL1

Now Enable the idm:DL1 stream:

1
sudo dnf module enable idm:DL1

Output on my system

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
$ sudo dnf module enable idm:DL1

Last metadata expiration check: 0:45:05 ago on Tue 09 Nov 2021 07:22:21 AM EAT.
Dependencies resolved.
=====================================================================================================
 Package                Architecture          Version                   Repository              Size
=====================================================================================================
Enabling module streams:
 389-ds                                       1.4
 httpd                                        2.4
 idm                                          DL1
 pki-core                                     10.6
 pki-deps                                     10.6

Transaction Summary
=====================================================================================================

Is this ok [y/N]: y
Complete!

Choose one of the following options, depending on your IdM requirements:

  • Installing IdM server without an integrated DNS:
1
sudo dnf module install idm:DL1/server
  • Installing FreeIPA server with an integrated DNS:
1
sudo dnf module install idm:DL1/dns
  • Installing FreeIPA server that has a trust agreement with Active Directory:
1
sudo dnf module install idm:DL1/adtrust
  • For multiple profiles, e.g dns and adtrust profiles:
1
sudo dnf module install idm:DL1/{dns,adtrust}
  • For FreeIPA client
1
sudo dnf module install idm:DL1/client

Running FreeIPA Server installer

With the FreeIPA packages installed, we can now run the ipa-server-install utility. The installer script will create a log file at /var/log/ipaserver-install.log:

1
sudo ipa-server-install

The script prompts for several required settings and offers recommended default values in brackets.

To accept a default value, press Enter. To provide a custom value, enter the required value. For Non-interactive installation for IdM without DNS use this:

1
2
3
4
5
6
sudo ipa-server-install \
  --realm IPA.CITIZIX.COM \
  -domain ipa.citizix.com \
  --ds-password <ds_password> \
  --admin-password <admin_password> \
  --unattended

The minimum required options for non-interactive installation are:

  • --realm to provide the Kerberos realm name
  • --ds-password to provide the password for the Directory Manager (DM), the Directory Server super user
  • --admin-password to provide the password for admin, the IdM administrator
  • --unattended to let the installation process select default options for the host name and domain name

For non-interactive installation for IdM with integrated DNS, use this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
sudo ipa-server-install \
    --domain ipa.citizix.com \
    --realm IPA.CITIZIX.COM \
    --reverse-zone=40.2.10.in-addr.arpa. \
    --no-forwarders \
    --no-ntp \
    --setup-dns \
    --ds-password <ds_password> \
    --admin-password <admin_password> \
    --unattended

This is the output of an interactive session on my server:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
$ sudo 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.9.2

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 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 [ipa.citizix.com]: ipa.citizix.com

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

Please confirm the domain name [citizix.com]: ipa.citizix.com

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

Please provide a realm name [IPA.CITIZIX.COM]: IPA.CITIZIX.COM
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):

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

The IPA Master Server will be configured with:
Hostname:       ipa.citizix.com
IP address(es): 10.2.40.149
Domain name:    ipa.citizix.com
Realm name:     IPA.CITIZIX.COM

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

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

The following operations may take some minutes to complete.
Please wait until the prompt is returned.

Disabled p11-kit-proxy
Synchronizing time
No SRV records of NTP servers found and no NTP server or pool address was provided.
Using default chrony configuration.
Attempting to sync time with chronyc.
Time synchronization was successful.
Configuring directory server (dirsrv). Estimated time: 30 seconds
  [1/41]: creating directory server instance
  [2/41]: tune ldbm plugin
  [3/41]: adding default schema
...

Upon successful installation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
Client configuration complete.
The ipa-client-install command was successful

Please add records in this file to your DNS system: /tmp/ipa.system.records.87gb3voq.db
==============================================================================
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.

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
The ipa-server-install command was successful

Configure Linux Firewalld

If you have firewalld installed and firewall enabled in your system, you have to open the FreeIPA ports for access.

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

To open the ports using firewalld, use these commands:

1
2
sudo firewall-cmd --add-service={http,https,dns,ntp,freeipa-ldap,freeipa-ldaps} --permanent
sudo firewall-cmd --reload

Access FreeIPA GUI Web Interface

Once the installation is completed by the script, open your system browser and point it to the FQDN hostname you set for the system in the beginning e.g https://ipa.citizix.com or even if you type https://your-server-ip this will automatically redirect it to the FQDN.

Ignore SSL warning by clicking Advanced > Proceed to ipa.citizix.com (unsafe); if you get it.

Upon successful login you’re presented with the Identity Dashboard interface

Using FreeIPA CLI Interface to do basic operations

The ipa command can be used to perform all FreeIPA server operations.

But first, get admin user Kerberos ticket:

1
2
$ sudo kinit admin
Password for admin@IPA.CITIZIX.COM:

Check ticket expiry information using klist.

1
2
3
4
5
6
$ sudo klist
Ticket cache: KCM:0
Default principal: admin@IPA.CITIZIX.COM

Valid starting       Expires              Service principal
11/09/2021 09:03:25  11/10/2021 09:03:19  krbtgt/IPA.CITIZIX.COM@IPA.CITIZIX.COM

Set user’s default shell to /bin/bash

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
$ sudo ipa config-mod --defaultshell=/bin/bash
  Maximum username length: 32
  Maximum hostname length: 64
  Home directory base: /home
  Default shell: /bin/bash
  Default users group: ipausers
  Default e-mail domain: ipa.citizix.com
  Search time limit: 2
  Search size limit: 100
  User search fields: uid,givenname,sn,telephonenumber,ou,title
  Group search fields: cn,description
  Enable migration mode: FALSE
  Certificate Subject base: O=IPA.CITIZIX.COM
  Password Expiration Notification (days): 4
  Password plugin features: AllowNThash, KDC:Disable Last Success
  SELinux user map order: guest_u:s0$xguest_u:s0$user_u:s0$staff_u:s0-s0:c0.c1023$sysadm_u:s0-s0:c0.c1023$unconfined_u:s0-s0:c0.c1023
  Default SELinux user: unconfined_u:s0-s0:c0.c1023
  Default PAC types: MS-PAC, nfs:NONE
  IPA masters: ipa.citizix.com
  IPA master capable of PKINIT: ipa.citizix.com
  IPA CA servers: ipa.citizix.com
  IPA CA renewal master: ipa.citizix.com

Add a user to FreeIPA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ sudo ipa user-add etowett --first=Eutychus --last=Towett \
> --email=etowett@citizix.com --password

Password:
Enter Password again to verify:
--------------------
Added user "etowett"
--------------------
  User login: etowett
  First name: Eutychus
  Last name: Towett
  Full name: Eutychus Towett
  Display name: Eutychus Towett
  Initials: ET
  Home directory: /home/etowett
  GECOS: Eutychus Towett
  Login shell: /bin/bash
  Principal name: etowett@IPA.CITIZIX.COM
  Principal alias: etowett@IPA.CITIZIX.COM
  User password expiration: 20211109060518Z
  Email address: etowett@citizix.com
  UID: 1063800001
  GID: 1063800001
  Password: True
  Member of groups: ipausers
  Kerberos keys available: True

List User Accounts in FreeIPA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
$ sudo ipa user-find
---------------
2 users matched
---------------
  User login: admin
  Last name: Administrator
  Home directory: /home/admin
  Login shell: /bin/bash
  Principal alias: admin@IPA.CITIZIX.COM, root@IPA.CITIZIX.COM
  UID: 1063800000
  GID: 1063800000
  Account disabled: False

  User login: etowett
  First name: Eutychus
  Last name: Towett
  Home directory: /home/etowett
  Login shell: /bin/bash
  Principal name: etowett@IPA.CITIZIX.COM
  Principal alias: etowett@IPA.CITIZIX.COM
  Email address: etowett@citizix.com
  UID: 1063800001
  GID: 1063800001
  Account disabled: False
----------------------------
Number of entries returned 2
----------------------------

Login as the created etowett user

On your first log in, you’ll be asked to change your password:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
$ ssh etowett@10.2.40.149

Password:

Password expired. Change your password now.
Current Password:
New password:
Retype new password:

$ id
uid=1063800001(etowett) gid=1063800001(etowett) groups=1063800001(etowett) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

Conclusion

In this guide, we managed to set up FreeIPA in our Rocky Linux system. You can play with the interface to understand placement of various FreeIPA management functions.

comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy