Translate

Archives

Configuring a FreeIPA Server For Use In RHCE7 Practice Lab

As part of the RHCE7 exam, you are expected to be able to quickly and accurately configure client-side user authentication using LDAP and Kerberos. While not an exam topic, it is useful to be able to configure and deploy LDAP and Kerberos servers so you can confirm that your client-side configurations are correct.

You can setup separate LDAP and Kerberos servers of course, but most users nowadays use an integrated solution known an identity management service.

From an article by Brian Atkisson on the Red Hat website:

Red Hat Identity Manager (IdM), is designed to provide an integrated identity management service for a wide range of clients, including Linux, Mac, and even Windows. At its core, IdM combines LDAP, Kerberos, DNS, and PKI with a rich management framework. Frequently, IdM is described as “Active Directory for Linux”. Although, to be fair, Active Directory is really just a management framework around LDAP, Kerberos, DNS and PKI — all of which were well established in the unix community long before Active Directory ever existed. In any case, the primary use for IdM is to provide these identity services to linux clients using these well established and open protocols.

IdM is built upon Red Hat Directory Server which supports up to 20 LDAP masters. Kerberos and ISC Bind sit on top of Directory Server, using LDAP for their back-end data stores. Red Hat Certificate System is also included in IdM, providing full PKI services.

The upstream project is called FreeIPA. FreeIPA stands for Free Identity Policy Audit. From their website:

FreeIPA is an integrated security information management solution combining Linux (Fedora), 389 Directory Server, MIT Kerberos, NTP, DNS, Dogtag (Certificate System). It consists of a web interface and command-line administration tools.

FreeIPA is an integrated Identity and Authentication solution for Linux/UNIX networked environments. A FreeIPA server provides centralized authentication, authorization and account information by storing data about user, groups, hosts and other objects necessary to manage the security aspects of a network of computers.

FreeIPA is built on top of well known Open Source components and standard protocols with a very strong focus on ease of management and automation of installation and configuration tasks.

Multiple FreeIPA servers can easily be configured in a FreeIPA Domain in order to provide redundancy and scalability. The 389 Directory Server is the main data store and provides a full multi-master LDAPv3 directory infrastructure. Single-Sign-on authentication is provided via the MIT Kerberos KDC. Authentication capabilities are augmented by an integrated Certificate Authority based on the Dogtag project. Optionally Domain Names can be managed using the integrated ISC Bind server.

Security aspects related to access control, delegation of administration tasks and other network administration tasks can be fully centralized and managed via the Web UI or the ipa Command Line tool.

This post will show you how to install and configure a FreeIPA server in CentOS 7.

The domain name we are going to use is simply rhce.local: We assume that there is not an existing master DNS server and we will create one. We will set the Kerberos Realm to RHCE.LOCAL. The full lab environment is assumed to consist of a FreeIPA server, ipaserver.rhce.local and two test servers, server1.rhce.local and server2.rhce.local. SElinux is assumed to be in enforcing mode.

First set up a standard CentOS 7 GUI server VM.

Configure the server hostname and /etc/hosts entry:

# hostnamectl set-hostname ipaserver.rhce.local
# echo "10.10.10.146 ipaserver.rhce.local ipaserver" >> /etc/hosts

Add the following additional lines to /etc/hosts:

10.10.10.147  server1.rhce.local  server1
10.10.10.148  server2.rhce.local  server2

The relevant FreeIPA packages (RPMs) are named ipa-* in CentOS 7.

# yum list | grep -E "ipa-|-ipa" | grep -v noarch
ipa-admintools.x86_64                    3.3.3-28.0.1.el7.centos.3  @updates    
ipa-client.x86_64                        3.3.3-28.0.1.el7.centos.3  @updates    
ipa-python.x86_64                        3.3.3-28.0.1.el7.centos.3  @updates    
ipa-server.x86_64                        3.3.3-28.0.1.el7.centos.3  @updates    
sssd-ipa.x86_64                          1.11.2-68.el7_0.6          @updates    
ipa-server-trust-ad.x86_64               3.3.3-28.0.1.el7.centos.3  updates     
# 

The following command will install all the required packages:

# yum install ipa-server bind-dyndb-ldap

Next configure the FreeIPA server:

# 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.

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)

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

Existing BIND configuration detected, overwrite? [no]: yes

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 [ipaserver.rhce.local]:

Warning: skipping DNS resolution of host ipaserver.rhce.local
The domain name has been determined based on the host name.

Please confirm the domain name [rhce.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 [RHCE.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): ************

Do you want to configure DNS forwarders? [yes]:
Enter the IP address of DNS forwarder to use, or press Enter to finish.
Enter IP address for a DNS forwarder: 8.8.8.8
DNS forwarder 8.8.8.8 added
Enter IP address for a DNS forwarder:
Do you want to configure the reverse zone? [yes]:
Please specify the reverse zone name [10.10.10.in-addr.arpa.]:
Using reverse zone 10.10.10.in-addr.arpa.

The IPA Master Server will be configured with:
Hostname:      ipaserver.rhce.local
IP address:    10.10.10.146
Domain name:   rhce.local
Realm name:    RHCE.LOCAL

BIND DNS server will be configured to serve IPA domain with:
Forwarders:    10.10.10.2
Reverse zone:  10.10.10.in-addr.arpa.

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.

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 1 minute
  [1/38]: creating directory server user
  [2/38]: creating directory server instance
  [3/38]: adding default schema
  [4/38]: enabling memberof plugin
  [5/38]: enabling winsync plugin
  [6/38]: configuring replication version plugin
  [7/38]: enabling IPA enrollment plugin
  [8/38]: enabling ldapi
  [9/38]: configuring uniqueness plugin
  [10/38]: configuring uuid plugin
  [11/38]: configuring modrdn plugin
  [12/38]: configuring DNS plugin
  [13/38]: enabling entryUSN plugin
  [14/38]: configuring lockout plugin
  [15/38]: creating indices
  [16/38]: enabling referential integrity plugin
  [17/38]: configuring certmap.conf
  [18/38]: configure autobind for root
  [19/38]: configure new location for managed entries
  [20/38]: configure dirsrv ccache
  [21/38]: enable SASL mapping fallback
  [22/38]: restarting directory server
  [23/38]: adding default layout
  [24/38]: adding delegation layout
  [25/38]: creating container for managed entries
  [26/38]: configuring user private groups
  [27/38]: configuring netgroups from hostgroups
  [28/38]: creating default Sudo bind user
  [29/38]: creating default Auto Member layout
  [30/38]: adding range check plugin
  [31/38]: creating default HBAC rule allow_all
  [32/38]: initializing group membership
  [33/38]: adding master entry
  [34/38]: configuring Posix uid/gid generation
  [35/38]: adding replication acis
  [36/38]: enabling compatibility plugin
  [37/38]: tuning directory server
  [38/38]: configuring directory to start on boot
Done configuring directory server (dirsrv).
Configuring certificate server (pki-tomcatd): Estimated time 3 minutes 30 seconds
  [1/22]: creating certificate server user
  [2/22]: configuring certificate server instance
  [3/22]: stopping certificate server instance to update CS.cfg
  [4/22]: disabling nonces
  [5/22]: set up CRL publishing
  [6/22]: starting certificate server instance
  [7/22]: creating RA agent certificate database
  [8/22]: importing CA chain to RA certificate database
  [9/22]: fixing RA database permissions
  [10/22]: setting up signing cert profile
  [11/22]: set certificate subject base
  [12/22]: enabling Subject Key Identifier
  [13/22]: enabling CRL and OCSP extensions for certificates
  [14/22]: setting audit signing renewal to 2 years
  [15/22]: configuring certificate server to start on boot
  [16/22]: restarting certificate server
  [17/22]: requesting RA certificate from CA
  [18/22]: issuing RA agent certificate
  [19/22]: adding RA agent as a trusted user
  [20/22]: configure certificate renewals
  [21/22]: configure Server-Cert certificate renewal
  [22/22]: Configure HTTP to proxy connections
Done configuring certificate server (pki-tomcatd).
Configuring Kerberos KDC (krb5kdc): Estimated time 30 seconds
  [1/10]: adding sasl mappings to the directory
  [2/10]: adding kerberos container to the directory
  [3/10]: configuring KDC
  [4/10]: initialize kerberos container
  [5/10]: adding default ACIs
  [6/10]: creating a keytab for the directory
  [7/10]: creating a keytab for the machine
  [8/10]: adding the password extension to the directory
  [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_memcached
  [1/2]: starting ipa_memcached
  [2/2]: configuring ipa_memcached to start on boot
Done configuring ipa_memcached.
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): Estimated time 1 minute
  [1/14]: setting mod_nss port to 443
  [2/14]: setting mod_nss password file
  [3/14]: enabling mod_nss renegotiate
  [4/14]: adding URL rewriting rules
  [5/14]: configuring httpd
  [6/14]: setting up ssl
  [7/14]: setting up browser autoconfig
  [8/14]: publish CA cert
  [9/14]: creating a keytab for httpd
  [10/14]: clean up any existing httpd ccache
  [11/14]: configuring SELinux for httpd
  [12/14]: configure httpd ccache
  [13/14]: restarting httpd
  [14/14]: configuring httpd to start on boot
Done configuring the web interface (httpd).
Applying LDAP updates
Restarting the directory server
Restarting the KDC
Restarting the certificate server
Configuring DNS (named)
  [1/11]: adding DNS container
  [2/11]: setting up our zone
  [3/11]: setting up reverse zone
  [4/11]: setting up our own record
  [5/11]: setting up records for other masters
  [6/11]: setting up CA record
  [7/11]: setting up kerberos principal
  [8/11]: setting up named.conf
  [9/11]: restarting named
  [10/11]: configuring named to start on boot
  [11/11]: changing resolv.conf to point to ourselves
Done configuring DNS (named).

Global DNS configuration in LDAP server is empty
You can use 'dnsconfig-mod' command to set global DNS options that
would override settings in local named.conf files

Restarting the web server
==============================================================================
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 certificate stored in /root/cacert.p12
This file is required to create replicas. The password for this
file is the Directory Manager password

While ipa-server-install can be run without any options, so that it prompts for the required information, it has numerous arguments which allow the configuration process to be easily scripted or to supply additional information which is not requested during an interactive installation.

Configure the firewall to allow the necessary traffic:

# firewall-cmd --permanent --add-service={http,https,ldap,ldaps,kerberos,dns,kpasswd,ntp}
# firewall-cmd --permanent --add-port 749/tcp
# firewall-cmd --reload

Next check the status of the newly configured server:

# ipactl status
Directory Service: RUNNING
krb5kdc Service: RUNNING
kadmin Service: RUNNING
named Service: RUNNING
ipa_memcached Service: RUNNING
httpd Service: RUNNING
pki-tomcatd Service: RUNNING
ipa-otpd Service: RUNNING
ipa: INFO: The ipactl command was successful

Configure and add two users:

# ipa config-mod --defaultshell=/bin/bash
  Maximum username length: 32
  Home directory base: /home
  Default shell: /bin/bash
  Default users group: ipausers
  Default e-mail domain: rhce.local
  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=RHCE.LOCAL
  Password Expiration Notification (days): 4
  Password plugin features: AllowNThash
  SELinux user map order: guest_u:s0$xguest_u:s0$user_u:s0$staff_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 user-add rhceuser1 --first=user1 --last=rhce --password
# ipa user-add rhceuser2 --first=user2 --last=rhce --password

Check the status of the newly created users:

# IPA user-find
---------------
3 users matched
---------------
  User login: admin
  Last name: Administrator
  Home directory: /home/admin
  Login shell: /bin/bash
  UID: 181200000
  GID: 181200000
  Account disabled: False
  Password: True
  Kerberos keys available: True

  User login: ipauser1
  First name: user1
  Last name: rhce
  Home directory: /home/ipauser1
  Login shell: /bin/bash
  Email address: ipauser1@rhce.local
  UID: 181200001
  GID: 181200001
  Account disabled: False
  Password: True
  Kerberos keys available: True

  User login: ipauser2
  First name: user2
  Last name: rhce
  Home directory: /home/ipauser2
  Login shell: /bin/bash
  Email address: ipauser2@rhce.local
  UID: 181200003
  GID: 181200003
  Account disabled: False
  Password: True
  Kerberos keys available: True
----------------------------
Number of entries returned 3
----------------------------

Add two hosts to the server:

# ipa host-add --ip-address 10.10.10.147 server1.rhce.local
----------------------------
Added host "server1.rhce.local"
----------------------------
  Host name: server1.rhce.local
  Principal name: host/server1.rhce.local@RHCE.LOCAL
  Password: False
  Keytab: False
  Managed by: server1.rhce.local

# ipa host-add --ip-address 10.10.10.148 server2.rhce.local
----------------------------
Added host "server2.rhce.local"
----------------------------
  Host name: server2.rhce.local
  Principal name: host/server2.rhce.local@RHCE.LOCAL
  Password: False
  Keytab: False
  Managed by: server2.rhce.local

Add NFS and LDAP services for server1 and server2:

# ipa service-add nfs/server1.rhce.local
# ipa service-add nfs/server2.rhce.local
# ipa service-add ldap/server1.rhce.local
# ipa service-add ldap/server2.rhce.local

Next, get a Kerberos ticket for the Kerberos administrator, i.e.admin:

# kinit admin
Password for admin@RHCE.LOCAL
...

# klist
Ticket cache: KEYRING:persistent:0:0
Default principal: admin@RHCE.LOCAL

Valid starting Expires Service principal
12/07/2018 13:26:48 12/08/2018 13:26:46 admin/RHCE.LOCAL@RHCE.LOCAL
...
#

List the Kerberos keys. You should see the following:

# klist -ke
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- --------------------------------------------------------------------------
   2 host/ipaserver.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   2 host/ipaserver.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   2 host/ipaserver.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   2 host/ipaserver.rhce.local@RHCE.LOCAL (arcfour-hmac) 
   1 nfs/server1.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   1 nfs/server1.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   1 nfs/server1.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   1 nfs/server1.rhce.local@RHCE.LOCAL (arcfour-hmac) 
   1 nfs/server2.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   1 nfs/server2.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   1 nfs/server2.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   1 nfs/server2.rhce.local@RHCE.LOCAL (arcfour-hmac) 
   1 ldap/server1.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   1 ldap/server1.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   1 ldap/server1.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   1 ldap/server1.rhce.local@RHCE.LOCAL (arcfour-hmac) 
   1 ldap/server2.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   1 ldap/server2.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   1 ldap/server2.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   1 ldap/server2.rhce.local@RHCE.LOCAL (arcfour-hmac) 
   1 host/server1.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   1 host/server1.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   1 host/server1.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   1 host/server1.rhce.local@RHCE.LOCAL (arcfour-hmac) 
   1 host/server2.rhce.local@RHCE.LOCAL (aes256-cts-hmac-sha1-96) 
   1 host/server2.rhce.local@RHCE.LOCAL (aes128-cts-hmac-sha1-96) 
   1 host/server2.rhce.local@RHCE.LOCAL (des3-cbc-sha1) 
   1 host/server2.rhce.local@RHCE.LOCAL (arcfour-hmac) 

Install a FTP server to allow easy retrieval of keytab files:

# yum install vsftpd -y
# systemctl enable vsftpd
# systemctl start vsftpd
# firewall-cmd –permanent –add-service=ftp
# firewall-cmd –reload

Copy the keys to /var/ftp/pub:

# ipa-getkeytab -s ipaserver.rhce.local -p nfs/server1.rhce.local -k /var/ftp/pub/server1.keytab
# ipa-getkeytab -s ipaserver.rhce.local -p host/server1.rhce.local -k /var/ftp/pub/server1.keytab
# ipa-getkeytab -s ipaserver.rhce.local -p ldap/server1.rhce.local -k /var/ftp/pub/server1.keytab
# ipa-getkeytab -s ipaserver.rhce.local -p nfs/server2.rhce.local -k /var/ftp/pub/server2.keytab
# ipa-getkeytab -s ipaserver.rhce.local -p ldap/server2.rhce.local -k /var/ftp/pub/server2.keytab
# ipa-getkeytab -s ipaserver.rhce.local -p host/server2.rhce.local -k /var/ftp/pub/server2.keytab

Make sure that keytab files are accessible to FTP clients

# chmod 644 /var/ftp/pub/*.keytab

Your configured FreeIPA server is now ready for use.

A copy of a VMware Workstation VM, configured per this post, can be downloaded from here. All passwords are “rhce#123”.

Enjoy!

Comments are closed.