CentOS7 FreeIPA AD Integration
CentOS7 FreeIPA AD Integration
First of all go to the Active Directory Domain Controller and open PowerShell
to write the DNS records as following:
PS C:\Users\Administrator> dnscmd 127.0.0.1 /RecordAdd domain.lan ipa.ec A
10.50.3.126
Add A Record for ipa.ec.domain.lan at domain.lan
Command completed successfully.
After adding new A and NS records we must restart DNS service for each AD to
quickly apply changes:
Note: Disable SELinux and firewalld for both(FreeIPA server and client)
Machines.
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)
==============================================================================
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.
After installation of the FreeIPA server to the 10.50.3.126 server change the
/etc/resolv.conf file as following:
[root@ipa ~]# cat /etc/resolv.conf
search domain.lan ec.domain.lan
nameserver 10.50.3.2
nameserver 10.50.3.3
This includes:
* Configure Samba
* Add trust related objects to IPA LDAP server
WARNING: The smb.conf already exists. Running ipa-adtrust-install will break your existing samba configuration.
Configuring CIFS
[1/22]: stopping smbd
[2/22]: creating samba domain object
[3/22]: creating samba config registry
[4/22]: writing samba config file
[5/22]: adding cifs Kerberos principal
[6/22]: adding cifs and host Kerberos principals to the adtrust agents group
[7/22]: check for cifs services defined on other replicas
[8/22]: adding cifs principal to S4U2Proxy targets
[9/22]: adding admin(group) SIDs
[10/22]: adding RID bases
[11/22]: updating Kerberos config
'dns_lookup_kdc' already set to 'true', nothing to do.
[12/22]: activating CLDAP plugin
[13/22]: activating sidgen task
[14/22]: configuring smbd to start on boot
[15/22]: adding special DNS service records
[16/22]: restarting Directory Server to take MS PAC and LDAP plugins changes into account
[17/22]: adding fallback group
[18/22]: adding Default Trust View
[19/22]: setting SELinux booleans
[20/22]: starting CIFS services
[21/22]: adding SIDs to existing users and groups
This step may take considerable amount of time, please wait..
[22/22]: restarting smbd
Done configuring CIFS.
=============================================================================
Setup complete
=============================================================================
Establish and verify cross-realm trust - Add trust with AD domain(We do this
in FreeIPA server):
[root@ipa ~]# ipa trust-add --type=ad domain.lan
Active Directory domain administrator: atladm
Active Directory domain administrator's password: write_pass_here
------------------------------------------------
Added Active Directory trust for realm "domain.lan"
------------------------------------------------
Realm name: domain.lan
Domain NetBIOS name: ATL
Domain Security Identifier: S-1-5-21-2852957904-459492390-1610673386
Trust direction: Trusting forest
Trust type: Active Directory domain
Trust status: Established and verified
Login to FreeIPA (10.50.3.126) server with X11 forward again and open Firefox
browser. In url tab write about:config and press I'll be careful, I promise!
button:
Then go to the Network Services -> DNS -> DNS Zones and click to the domain
name to check records:
Again go to the Network Services -> DNS -> DNS Zones and the press to Add
button and then select Reverse zone IP network, write there 10/8 and press to
Add button.
List of records:
DNS servers for our CentOS7 client machine must be as following in the
/etc/resolv.conf file:
[root@centos7client ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search ipa.ec.domain.lan
nameserver 10.50.3.126
nameserver 10.50.3.2
nameserver 10.50.3.3
Try to login to the FreeIPA server with admin username and look at the ticket
from FreeIPA:
[root@centos7client ~]# kinit admin
Password for admin@EC.DOMAIN.LAN: write_admin_pass
[root@centos7client ~]# klist
Ticket cache: KEYRING:persistent:0:0
Default principal: admin@EC.DOMAIN.LAN
Valid starting Expires Service principal
12/27/2016 16:34:22 12/28/2016 16:34:16 krbtgt/EC.DOMAIN.LAN@EC.DOMAIN.LAN
Go to the FreeIPA server Network Services -> DNS -> DNS Zones click to
ec.domain.lan. domain and the look at the new records:
-sh-4.2$ pwd
/home/domain.lan/jamal
-sh-4.2$ who
jamal@domain.lan pts/1 2016-12-27 16:53 (10.50.63.241)
Create new Group with FreeIPA-Members name in domain controller and add
Administrators to this group:
Create new internal group with name "ad_sshaccess_users" (We will map this
group to the external group "ad_users_external_freeipa"):
[root@ipa ~]# ipa group-add --desc='AD SSH access users' ad_sshaccess_users
--------------------------------
Added group "ad_sshaccess_users"
--------------------------------
Group name: ad_sshaccess_users
Description: AD SSH access users
GID: 1811000005
Map external group to our internal group which will go to check FreeIPA-
Members group in AD DOMAIN.LAN:
[root@ipa ~]# ipa group-add-member ad_sshaccess_users --groups
ad_users_external_freeipa
Group name: ad_sshaccess_users
Description: AD SSH access users
GID: 1811000005
Member groups: ad_users_external_freeipa
-------------------------
Number of members added 1
-------------------------
Then go to the FreeIPA web admin panel and open Policy -> Host Based Access
Control. Disable allow_all rule and add new rule with name allowed_groups:
Then open group allowed_groups and add ad_sshaccess_users to this group with
Add button: