What is FreeIPA ?
FreeIPA this is identity management tool which is open source, it is the upstream project for Red Hat identity manager. With FreeIPA , we can easily manage centralized authentication along with account management, policy (host-based access control) and audit, additionaly FreeIPA also provides the services like DNS and PKI.
FreeIPA is based on :
- 389 Directory Server(LDAP)
- MIT Kerberos
- SSSD
- Dogtag (Certificate System)
- NTP & DNS
In this simple article I will sho how to install and configure FreeIPA tool on CentOS 7 Server.
Lab environment
- VagrantBox: generic/centos7
- IP Address: 192.168.123.123
- Hostname: ipa.montu.local
- Memory : 2G
- Disk: 30 GB
Lets’s start 😊
Set Hostname and apply updates
[root@centos7 vagrant]# hostnamectl set-hostname ipa.montu.local
[root@centos7 vagrant]# exec bash
exec bash
[root@ipa vagrant]#
Update server using yum update
command and then reboot
[root@ipa vagrant]# yum update -y && reboot
Update the hosts file (/etc/hosts)
Run this command for update /etc/hosts file (of course replace the ip and hostname for your setup.)
[root@ipa vagrant]# echo "192.168.123.123 ipa.montu.local" >> /etc/hosts
Install FreeIPA packages using yum
Packages and also dependencies for FreeIPA are available in the default package repositories. Because in this case we are planning to install integrated DNS of FreeIPA, so we will also install ipa-server-dns
[root@ipa vagrant]# yum install ipa-server ipa-server-dns -y
Start FreeIPA setup
When the packages are installed successfully then we can use the below command to start the FreeIPA installation setup.
[root@ipa vagrant]# ipa-server-install
⚠️ Sometimes you get an error during installation like below:
[root@ipa vagrant]# ipa-server-install
ipapython.admintool: ERROR IPv6 stack is enabled in the kernel but there is no interface that has ::1 address assigned. Add ::1 address resolution to 'lo' interface. You might need to enable IPv6 on the interface 'lo' in sysctl.conf.
ipapython.admintool: ERROR The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information
Quick fix for this is :
[root@ipa vagrant]# sudo sysctl net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.all.disable_ipv6 = 0
[root@ipa vagrant]# sudo sysctl net.ipv6.conf.lo.disable_ipv6=0
net.ipv6.conf.lo.disable_ipv6 = 0
After starting the installer It will prompt couple of things like to configure like:
- Integrated DNS
- Host Name
- Domain Name
- Relam Name
[root@ipa vagrant]# ipa-server-installThe 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 the KDC to enable PKINITTo accept the default shown in brackets, press the Enter key.WARNING: conflicting time&date synchronization service 'chronyd' will be disabled
in favor of ntpdDo you want to configure integrated DNS (BIND)? [no]: yesEnter 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.montu.local]: ipa.montu.localWarning: skipping DNS resolution of host ipa.montu.local
The domain name has been determined based on the host name.Please confirm the domain name [montu.local]: montu.localThe kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.Please provide a realm name [MONTU.LOCAL]: MONTU.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: TYPE-PASSWORD
Password (confirm): TYPE-PASSWORDThe IPA server requires an administrative user, named 'admin'.
This user is a regular system account used for IPA server administration.IPA admin password: TYPE-PASSWORD
Password (confirm): TYPE-PASSWORDChecking DNS domain montu.local., please wait ...
Do you want to configure DNS forwarders? [yes]: yes
Following DNS servers are configured in /etc/resolv.conf: 10.0.2.3
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]: noThe IPA Master Server will be configured with:
Hostname: ipa.montu.local
IP address(es): 192.168.123.123
Domain name: montu.local
Realm name: MONTU.LOCALBIND DNS server will be configured to serve IPA domain with:
Forwarders: 10.0.2.3
Forward policy: only
Reverse zone(s): No reverse zoneContinue to configure the system with these values? [no]: yes
Installation and configuration FreeIP will start right now and may be take few minutes
Output
The following operations may take some minutes to complete.
Please wait until the prompt is returned.Configuring NTP daemon (ntpd)
[1/4]: stopping ntpd
[2/4]: writing configuration
[3/4]: configuring ntpd to start on boot
[4/4]: starting ntpd
Done configuring NTP daemon (ntpd).
Configuring directory server (dirsrv). Estimated time: 30 seconds
[1/45]: creating directory server instance
[2/45]: enabling ldapi
[3/45]: configure autobind for root
[4/45]: stopping directory server
[5/45]: updating configuration in dse.ldif
[6/45]: starting directory server
[7/45]: adding default schema
[8/45]: enabling memberof plugin
[9/45]: enabling winsync plugin
[10/45]: configure password logging
[11/45]: configuring replication version plugin
[12/45]: enabling IPA enrollment plugin
[13/45]: configuring uniqueness plugin
[14/45]: configuring uuid plugin
[15/45]: configuring modrdn plugin
[16/45]: configuring DNS plugin
[17/45]: enabling entryUSN plugin
[18/45]: configuring lockout plugin
[19/45]: configuring topology plugin
[20/45]: creating indices
[21/45]: enabling referential integrity plugin
[22/45]: configuring certmap.conf
[23/45]: configure new location for managed entries
[24/45]: configure dirsrv ccache
[25/45]: enabling SASL mapping fallback
[26/45]: restarting directory server
[27/45]: adding sasl mappings to the directory
[28/45]: adding default layout
[29/45]: adding delegation layout
[30/45]: creating container for managed entries
[31/45]: configuring user private groups
[32/45]: configuring netgroups from hostgroups
[33/45]: creating default Sudo bind user
[34/45]: creating default Auto Member layout
[35/45]: adding range check plugin
[36/45]: creating default HBAC rule allow_all
[37/45]: adding entries for topology management
[38/45]: initializing group membership
[39/45]: adding master entry
[40/45]: initializing domain level
[41/45]: configuring Posix uid/gid generation
[42/45]: adding replication acis
[43/45]: activating sidgen plugin
[44/45]: activating extdom plugin
[45/45]: configuring directory to start on boot
Done configuring directory server (dirsrv).
Configuring Kerberos KDC (krb5kdc)
[1/10]: adding kerberos container to the directory
[2/10]: configuring KDC
[3/10]: initialize kerberos container
[4/10]: adding default ACIs
[5/10]: creating a keytab for the directory
[6/10]: creating a keytab for the machine
[7/10]: adding the password extension to the directory
[8/10]: creating anonymous principal
[9/10]: starting the KDC
[10/10]: configuring KDC to start on boot
Done configuring Kerberos KDC (krb5kdc).
Configuring kadmin
[1/2]: starting kadmin
[2/2]: configuring kadmin to start on boot
Done configuring kadmin.
Configuring ipa-custodia
[1/5]: Making sure custodia container exists
[2/5]: Generating ipa-custodia config file
[3/5]: Generating ipa-custodia keys
[4/5]: starting ipa-custodia
[5/5]: configuring ipa-custodia to start on boot
Done configuring ipa-custodia.
Configuring certificate server (pki-tomcatd). Estimated time: 3 minutes
[1/29]: configuring certificate server instance
[2/29]: reindex attributes
[3/29]: exporting Dogtag certificate store pin
[4/29]: stopping certificate server instance to update CS.cfg
[5/29]: backing up CS.cfg
[6/29]: disabling nonces
[7/29]: set up CRL publishing
[8/29]: enable PKIX certificate path discovery and validation
[9/29]: starting certificate server instance
[10/29]: configure certmonger for renewals
[11/29]: requesting RA certificate from CA
[12/29]: setting audit signing renewal to 2 years
[13/29]: restarting certificate server
[14/29]: publishing the CA certificate
[15/29]: adding RA agent as a trusted user
[16/29]: authorizing RA to modify profiles
[17/29]: authorizing RA to manage lightweight CAs
[18/29]: Ensure lightweight CAs container exists
[19/29]: configure certificate renewals
[20/29]: configure Server-Cert certificate renewal
[21/29]: Configure HTTP to proxy connections
[22/29]: restarting certificate server
[23/29]: updating IPA configuration
[24/29]: enabling CA instance
[25/29]: migrating certificate profiles to LDAP
[26/29]: importing IPA certificate profiles
[27/29]: adding default CA ACL
[28/29]: adding 'ipa' CA entry
[29/29]: configuring certmonger renewal for lightweight CAs
Done configuring certificate server (pki-tomcatd).
Configuring directory server (dirsrv)
[1/3]: configuring TLS for DS instance
[2/3]: adding CA certificate entry
[3/3]: restarting directory server
Done configuring directory server (dirsrv).
Configuring ipa-otpd
[1/2]: starting ipa-otpd
[2/2]: configuring ipa-otpd to start on boot
Done configuring ipa-otpd.
Configuring the web interface (httpd)
[1/22]: stopping httpd
[2/22]: setting mod_nss port to 443
[3/22]: setting mod_nss cipher suite
[4/22]: setting mod_nss protocol list to TLSv1.2
[5/22]: setting mod_nss password file
[6/22]: enabling mod_nss renegotiate
[7/22]: disabling mod_nss OCSP
[8/22]: adding URL rewriting rules
[9/22]: configuring httpd
[10/22]: setting up httpd keytab
[11/22]: configuring Gssproxy
[12/22]: setting up ssl
[13/22]: configure certmonger for renewals
[14/22]: importing CA certificates from LDAP
[15/22]: publish CA cert
[16/22]: clean up any existing httpd ccaches
[17/22]: configuring SELinux for httpd
[18/22]: create KDC proxy config
[19/22]: enable KDC proxy
[20/22]: starting httpd
[21/22]: configuring httpd to start on boot
[22/22]: enabling oddjobd
Done configuring the web interface (httpd).
Configuring Kerberos KDC (krb5kdc)
[1/1]: installing X509 Certificate for PKINIT
Done configuring Kerberos KDC (krb5kdc).
Applying LDAP updates
Upgrading IPA:. Estimated time: 1 minute 30 seconds
[1/10]: stopping directory server
[2/10]: saving configuration
[3/10]: disabling listeners
[4/10]: enabling DS global lock
[5/10]: disabling Schema Compat
[6/10]: starting directory server
[7/10]: upgrading server
[8/10]: stopping directory server
[9/10]: restoring configuration
[10/10]: starting directory server
Done.
Restarting the KDC
Configuring DNS (named)
[1/11]: generating rndc key file
[2/11]: adding DNS container
[3/11]: setting up our zone
[4/11]: setting up our own record
[5/11]: setting up records for other masters
[6/11]: adding NS record to the zones
[7/11]: setting up kerberos principal
[8/11]: setting up named.conf
[9/11]: setting up server configuration
[10/11]: configuring named to start on boot
[11/11]: changing resolv.conf to point to ourselves
Done configuring DNS (named).
Restarting the web server to pick up resolv.conf changes
Configuring DNS key synchronization service (ipa-dnskeysyncd)
[1/7]: checking status
[2/7]: setting up bind-dyndb-ldap working directory
[3/7]: setting up kerberos principal
[4/7]: setting up SoftHSM
[5/7]: adding DNSSEC containers
[6/7]: creating replica keys
[7/7]: configuring ipa-dnskeysyncd to start on boot
Done configuring DNS key synchronization service (ipa-dnskeysyncd).
Restarting ipa-dnskeysyncd
Restarting named
Updating DNS system records
Configuring client side components
Using existing certificate '/etc/ipa/ca.crt'.
Client hostname: ipa.montu.local
Realm: MONTU.LOCAL
DNS Domain: montu.local
IPA Server: ipa.montu.local
BaseDN: dc=montu,dc=localSkipping synchronizing time with NTP server.
New SSSD config will be created
Configured sudoers in /etc/nsswitch.conf
Configured /etc/sssd/sssd.conf
trying https://ipa.montu.local/ipa/json
[try 1]: Forwarding 'schema' to json server 'https://ipa.montu.local/ipa/json'
trying https://ipa.montu.local/ipa/session/json
[try 1]: Forwarding 'ping' to json server 'https://ipa.montu.local/ipa/session/json'
[try 1]: Forwarding 'ca_is_enabled' to json server 'https://ipa.montu.local/ipa/session/json'
Systemwide CA database updated.
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
[try 1]: Forwarding 'host_mod' to json server 'https://ipa.montu.local/ipa/session/json'
SSSD enabled
Configured /etc/openldap/ldap.conf
Configured /etc/ssh/ssh_config
Configured /etc/ssh/sshd_config
Configuring montu.local as NIS domain.
Client configuration complete.
The ipa-client-install command was successful==============================================================================
Setup completeNext 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: ntp2. 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
Next we must run command which allow create user home directory with automatically way after authentication
[root@ipa vagrant]# authconfig --enablemkhomedir --update
Open port on firewall for FreeIPA
If we have running firewall on OS we should open few ports which is necessary for properly operation of FreeIPA.
[root@ipa vagrant]# firewall-cmd --state
running
[root@ipa vagrant]# firewall-cmd --add-service=freeipa-ldap
success
[root@ipa vagrant]# firewall-cmd --add-service=freeipa-ldap --permanent
success
[root@ipa vagrant]# firewall-cmd --reload
success
Now we can check if FW rules are added
[root@ipa vagrant]# firewall-cmd --list-services
dhcpv6-client freeipa-ldap ssh
FreeIPA Verification
After opening the necessary ports, the last step is to verify that all FreeIPA services are working properly
[root@ipa vagrant]# ipactl status
Directory Service: RUNNING
krb5kdc Service: RUNNING
kadmin Service: RUNNING
named Service: RUNNING
httpd Service: RUNNING
ipa-custodia Service: RUNNING
ntpd Service: RUNNING
pki-tomcatd Service: RUNNING
ipa-otpd Service: RUNNING
ipa-dnskeysyncd Service: RUNNING
ipa: INFO: The ipactl command was successful
[root@ipa vagrant]#
Next which we should verify is check that admin user will get token via Kerberos using the kinit
command. For this use the same password for admin which we provides during installation.
[root@ipa vagrant]# kinit admin
Password for admin@MONTU.LOCAL: TYPE-PASSWORD
[root@ipa vagrant]# klist
Ticket cache: KEYRING:persistent:0:0
Default principal: admin@MONTU.LOCALValid starting Expires Service principal
09/06/2020 16:03:05 09/07/2020 16:02:59 krbtgt/MONTU.LOCAL@MONTU.LOCAL
[root@ipa vagrant]#
FreeIPA Admin portal
The portal is accessed via a URL https://ipa.montu.local/ipa/ui/
For login use the same password for admin which we provides during installation. If we can login into that confirms that we have successfully setup FreeIPA and we can start using it on our environment.