# Setup FreeIPA

# Initial FreeIPA Setup and Install

# <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 30pt; font-weight: 600; color: #9eb6ff;">FreeIPA</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Basics</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">FreeIPA (a.k.a. Identity Management by RedHat) is a free, open source alternative to Active Directory type services for Linux / Unix.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">The Installation of the server side works best on RedHat, Fedora, and / or CentOS systems (all RedHat based systems).</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">A client must be installed in order to join a Machine to the domain and use the IPA system for authenticaion.</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Requirements</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Server</span>

- Needs to have a fixed (sttic) IP Address.
- Needs to have a FQDN (Fully Qualified Domain Name) 
    - The Domain Name must be owned by you, or a local only type domain (best to end with .local).
- You must update the server's hostname and /etc/hosts file entries. 
    - The FQDN must be first after the IP in /etc/hosts, and then the shortname afterthat. 
        - Example: FQDN = ipa.mydomain.local Shortname = ipa

### <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 19pt; font-weight: 600; color: #c6d6ff;">The Download Process</span>

1. You must download the freeipa server software if it's not already in the distro you chose.
2. You then run the installation of the software and configure the server.

### <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 19pt; font-weight: 600; color: #c6d6ff;">DNS</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">It is extremely important to have a system setup for DNS, and to ensure that your LAN can find machines by hostname, not just by IP address.</span>

- For this I use Pi-Hole. I make manual entries for the machines I'm adding to the domain.
- I check this by using <span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">nslookup</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">If you don't have a shared server for shared home directories, you should enable the ability to make home directories for each domain user sho may log into a system.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">You do this with the </span><span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">--enablemkhomedir</span><span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;"> option on the server.</span>

### <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 19pt; font-weight: 600; color: #c6d6ff;">My Commands and Steps</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Install Fedora 32 Workstation</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Make sure it's updated completely - use </span><span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo dnf update -y</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Make sure you have an IP on the LAN (using Virtual Box or VirtManager you need to ensure you've setup and enabled a bridged network connection.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Edit the hostname and /etc/hosts files:</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo nano /etc/hostname</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">make sure to enter an FQDN (can't be localhost </span><span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; font-weight: 600; color: #9eb6ff;">at all)</span><span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Now update the /etc/hosts file using</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo nano /etc/hosts</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">and make sure it looks something like</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #e3e2d6; background-color: #333333;">192.168.7.226 ipa.mydomain.local ipa</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #e3e2d6; background-color: #333333;">127.0.0.1 localhost</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">The next bits are easier to run as root, so just do</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo su</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">and enter your sudo password when prompted.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">You also need to setup your firewall to have some open ports. Luckily on Fedora this is easily accomplished with two commands.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">firewall-cmd --add-service=freeipa-ldap --add-service=freeipa-ldaps</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">firewall-cmd --add-service=freeipa-ldap --add-service=freeipa-ldaps --permanent</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Now, we'll pull down the freeipa seerver software.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">yum install freeipa-server freeipa-server-dns nfs-utils</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next, we reboot so nfs-utils will kick in.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">reboot</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Once back up, go back into root:</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo su</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Enter your sudo password when prompted.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Once you have your pre-requisites installed and setup we'll run the ipa-server-install command and go through the steps to get our server setup.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">ipa-server-install --mkhomedir</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">There will be some question during the process we need to answer...</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">After a successful install, you'll want to run the command</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">kinit admin</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">As this generates the necessary admin keys to get the Web UI ready for login, as well as for running admin commands from the cli if desired.</span>

---

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Client Install</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">For the client install we'll use Ubuntu 20.04. Ubuntu is one of the most popular, if not the most popular desktop distributionsn for Linux, our there, thus I'm using it for this demo.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">First, we'll install ubuntu 20.04.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next, update the OS and make sure all updates are installed with</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo apt update &amp;&amp; sudo apt upgrade -y</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next, make sure you've setup the IP address as part of your LAN (particularly if you're using Virtualbox or VirtManager - you need to have a bridge network setup so the machine can see / reach other machines).</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Setup IP and FQDN</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">ip addr show</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Will show you a list of ip addresses assigned to various network interfaces on the install.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">You want the one that matches your LAN IP pattern.  
In my case, i'll be using the one with "192.168.7.x"</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next, just as with the server, we need to ensure that the IP is set as a static IP, and we need to make sure we give the machine a FQDN (Fully Qualified Domain Name - e.g. "ipa-client1.mydomain.local").</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo nano /etc/hosts</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">In this file ensure you have the following setup:</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #e3e2d6; background-color: #333333;">127.0.0.1 localhost</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #e3e2d6; background-color: #333333;">127.0.1.1 ipa-client1.mydomain.local ipa-client1</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #e3e2d6; background-color: #333333;">192.168.7.x ipa-client1.mydomain.local ipa-client1</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #e3e2d6; background-color: #333333;">192.168.7.150 ipasrv2.mydomain.local ipasrv2</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next, make sure the "/etc/hostname" file also has the correct hosname.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo nano /etc/hostname</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">it should have something like:</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">ipa-client1.mydomain.local</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">If not, make sure to change it to the proper hostname, then save.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Finally, make sure to add a DNS reference in your local DNS (router, or whatever, but in my case a Pi-Hole) to the client machine FQDN and IP.</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Download the Software</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Now, we need to download the freeipa client.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo apt install freeipa-client</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">While this isn't that actual client install and configuration, it will actually prompt you for a couple of bits of information, so you need to know what that is and be ready.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">First screen in the terminal will be for "Configuring Kerberos Authentication", and will ask for the Kerberos version X realm.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">this is basically the domain, and may be filled in by default, so if it is, just tab to 'ok', and move on. If not, type in the domain in all caps:</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">MYDOMAIN.LOCAL</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">then tab to 'Ok' and move forward.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next, it will ask for the Kerberos server for your realm. This is just the FQDN of your server that we setup previously.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">ipasrv2.mydomain.local</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Next is the Administrative server for your Kerberos realm. It's the same server.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">ipasrv2.mydomain.local</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Once you've entered those items, the download / install will continue.</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Check your network settings one more time</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Now, before we move forward with the final configuration and install of the freeipa client, it's a good idea to make sure that our server and client resolve to the right name and IP.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">nslookup ipa-client1.mydomain.local</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">You should get the proper IP back.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">nslookup ipasrv2.mydomain.local</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Again, you should get the proper IP back.</span>

## <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 24pt; font-weight: 600; color: #b2c8ff;">Run the final Install and Configuration</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">This is again, easier to run as root, so you can do:</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">sudo su -</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">in a terminal, and enter your sudo user password when prompted.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Now, we'll run our final install command for our Free IPA client machine.</span>

<span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">ipa-client-install --mkhomedir</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">PLEASE NOTE: The </span><span data-darkreader-inline-bgcolor="" data-darkreader-inline-color="" style="font-family: 'Source Code Pro'; font-size: 14pt; color: #00aa00; background-color: #333333;">--mkhomedir</span><span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;"> part is VERY IMPORTANT.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">If you do this, without that bit, and you have not setup network storage for user home directories somewhere else (and I'm not covering that here), then the client install may succeed, but upon trying to login using an LDAP user afterward, you'll get frustrated when you aren't taken to the desktop.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">This happens becuase the system doesn't know where your home directory is, and won't create one for you without that flag.</span>

### <span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 19pt; font-weight: 600; color: #c6d6ff;">Interactive Install Prompts</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">As with our server install, the client install has interactive prompts, and you will likely have to fill out a few bits of information as it goes through.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">When you are done you should see a message that says:</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">`The ipa-client-install command was successful`</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Time for one last reboot.</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">\# Logging in with LDAP / FreeIPA user</span>

<span data-darkreader-inline-color="" style="font-family: 'Cantarell'; font-size: 15pt; color: #ffffff;">Before you try to login wtih LDAP, you of cource need to create a user. For this we go back to the server web ui, and get started.</span>