Installing FreeIPA

Installation steps

Container problems

  • Expand the UID map for the IPA install to evade LXC limitations.

    • The running container does not give you enough UIDs and Freeipa picks huge UIDs, hovering near MAXINT [1].

content for both /etc/subuid and /etc/subgid
1root:5000000:2500000
  • Sadly, this prompts a reboot. It’s not required, but it avoids any need to tread lightly.

Machine preparation

  • Ensure the static IP is in /etc/hosts with the internal FQDN of your box.

  • Ensure the internal FQDN is the default hostname in /etc/hostname

  • Open the required ports. Choose one of the below approaches.

Add to /etc/sysconfig/iptables for IP tables config
 1# SSH
 2-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW,ESTABLISHED -j ACCEPT
 3# Web
 4-A INPUT -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
 5-A INPUT -p tcp -m tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
 6# LDAP
 7-A INPUT -p tcp -m tcp --dport 389 -m state --state NEW,ESTABLISHED -j ACCEPT
 8-A INPUT -p tcp -m tcp --dport 636 -m state --state NEW,ESTABLISHED -j ACCEPT
 9# Kerberos
10-A INPUT -p tcp -m tcp --dport 88 -m state --state NEW,ESTABLISHED -j ACCEPT
11-A INPUT -p tcp -m tcp --dport 464 -m state --state NEW,ESTABLISHED -j ACCEPT
12-A INPUT -p udp -m udp --dport 88 -m state --state NEW,ESTABLISHED -j ACCEPT
13-A INPUT -p udp -m udp --dport 464 -m state --state NEW,ESTABLISHED -j ACCEPT
14# NTP
15-A INPUT -p udp -m udp --dport 123 -m state --state NEW,ESTABLISHED -j ACCEPT
run these commands for Firewalld config
1firewall-cmd --add-service={ssh,http,https} --permanent
2firewall-cmd --add-service={ntp,dns,freeipa-ldap,freeipa-ldaps} --permanent
3firewall-cmd --reload
  • Prep the box and run the installer.

 1yum install epel-release
 2yum -y update
 3# Really; SSH is missing by default from the Proxmox Centos template
 4yum install openssh-server
 5systemctl enable sshd; systemctl start sshd
 6# Vim is in the list because this advice is for sysadmins
 7yum -y install bind-utils vim ipa-server ipa-server-dns bindipa-server bind-dyndb-ldap
 8# ID manipulation in case this is a container
 9ipa-server-install --idstart=1000000 --idmax=2000000 --setup-dns
10kinit admin # Answer the password prompt for the admin user
11klist # See if admin is logged in.
  • For RHEL8/Cent8…

1# Enable the Identity Manager repository
2dnf module enable idm:DL1
3dnf distro-sync
4dnf install -y tcpdump nmap vim strace bind-utils ipa-server-dns ipa-server bind-dyndb-ldap
 1# Unattended install example with a password in /root/.p
 2export tdom=local.domain.com
 3export thost=ipa0
 4export tdns=172.31.0.2 # AWS example
 5iplist=`ip a | grep "inet " | grep -v ' 127.0.0' | awk '{print $2}' | perl -pe 's/\/.*//' | xargs -i echo -n '  --ip-address='{}`
 6ipa-server-install -U -q -N --log-file=/root/ipa-install.log \
 7    --netbios-name=${tdom} --setup-adtrust \
 8    --domain=${tdom} --realm=${tdom} \
 9    --hostname=${thost}.${tdom} ${iplist} \
10    --setup-dns --setup-kra --forwarder=${tdns} --no-reverse \
11    -p `cat ~/.p` -a `cat ~/.p`
  • Answer the prompts as they come. Say yes to the DNS forwarder question, leaving the default and adding any additional ones you want.

Operations

If you forgot mkhomedirs…

1authconfig --enablemkhomedir --update

Users

Note

I lost my CAC integration instructions, but will add them when I find them.

  • Make a user

Let us give Private Schmuckatelli his own federated account.

1ipa user-add pschmuck --first=Private --last=Schmuckatelli --email=pschmuck@mydomain.com --shell=/bin/bash --password
  • List users

1ipa user-find
  • Modify users

1# Set every user shell but admin to bash
2for f in `ipa user-find | grep "User login:" | perl -pe 's/^.*://' | egrep -v '^admin$'`
3do
4    ipa user-mod ${f} --shell=/bin/bash
5done
  • …or use the web GUI.

Client nodes the easy way

Let us assume local.mydomain.com

Note

Systemd is a piece of garbage, so LXC and Docker containers need special handling.

/etc/systemd/system/systemd-hostnamed.service.d/override.conf on LXC or Docker
1[Service]
2PrivateNetwork=no
Redhat-like
1sudo yum -y install epel-release
2sudo yum -y install ipa-client
3export myipa=ipa0
4export mydomain=local.mydomain.com
5sudo ipa-client-install --mkhomedir \
6    --domain=${mydomain} \
7    --server=${myipa}.${mydomain} \
8    --hostname=`uname -n | awk -F\. '{print $1}'`.${mydomain}
Debian-like
1sudo apt-get update && sudo apt-get -y install freeipa-client
2export myipa=ipa0
3export mydomain=local.mydomain.com
4sudo ipa-client-install --mkhomedir \
5    --domain=${mydomain} \
6    --server=${myipa}.${mydomain} \
7    --hostname=`uname -n | awk -F\. '{print $1}'`.${mydomain}

Centos client nodes - original

  • Install IPA client

1yum -y install ipa-client # Skip the Kerberos realm auth
2ipa-client-install --hostname=`hostname -f` --mkhomedir \
3    --server=myserver.mydomain.com --domain mydomain.com \
4    --realm MYDOMAIN.COM
  • State PAM config for home directories if using Ubuntu

/usr/share/pam-configs/mkhomedir or /etc/pam.d/mkhomedir
1Name: activate mkhomedir
2Default: yes
3Priority: 900
4Session-Type: Additional
5Session:
6required pam_mkhomedir.so umask=0022 skel=/etc/skel
  • Make PAM obey

1pam-auth-update
  • Do the same kinit and klist as above to make sure Kerberos is working.

  • Check /etc/nsswitch.conf to ensure “sss” is ahead of “files” where your tastes deem appropriate.

  • After any changes, mass execute sss_cache -E everywhere.

Windows client nodes

  • …because Windows happens. Sometimes in public.

  • Let’s call our IPA server myipa and our realm and our domain mydomain.com.

  • Ensure we added a Windows node called mywin to myipa.mydomain.com through the GUI or otherwise with the password mypassword.

Note

Using an alternative to GINA called Pgina will skip the Microsoft obfuscation of the LDAP dialog. Docs to follow.

1REM Kerberos config
2ksetup /setdomain MYDOMAIN.COM
3setup /addkdc MYDOMAIN.COM myipa.mydomain.com
4setup /addkpasswd MYDOMAIN.COM myipa.mydomain.com
5REM this is the password we set in FreeIPA for this node
6setup /setcomputerpassword mypassword
7REM no user filters
8setup /mapuser * *
  • Ensure policy allows Kerberos auth with the right encryption and only the right encryption.

    • Too many choices can breed timeouts and cause delays or failed logins.

    • Open gpedit.msc and browse down the layers as follows:

      • Computer Configuration
        • Windows Settings
          • Security Settings
            • Local Policies
              • Security Options

      • Find “Network Security: Configure encryption types allowed for Kerberos”

      • Deselect everything except RC4_HMAC_MD5

    • Reboot (because Windows)

Applications requiring LDAP

Datum

Content

Server

ipa0.local.mydomain.com

User Search_Base

cn=accounts,dc=local,dc=mydomain,dc=com

User Filter

(objectclass=person)

User Identifier

uid

Group Search_Base

cn=groups,cn=accounts,dc=local,dc=mydomain,dc=com

Group Filter

(objectclass=ipaUserGroup)

Service Account

uid=ldapuser,cn=users,cn=accounts,dc=local,dc=mydomain,dc=com

Service Password

<shared password> (in place of anonymous auth)

Endnotes