Wednesday, 9 March 2016

IPA_SERVER_AND_CLIENT_SETUP_HDP2.2

IPA: Identity Policy and Accounting

IPA Server:
#####################################

Turn off firewall
------------------------------
service iptables save
service iptables stop
chkconfig iptables off

Host Configuration:
---------------------------
/etc/hosts
Add the host entry and domain name
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.31.43.121    ec2-54-86-17-4.compute-1.amazonaws.com          IPA

/etc/sysconfig/network
Add the hostname entry to it
HOSTNAME=ec2-54-86-17-4.compute-1.amazonaws.com


Apply OS updates
------------------------------
yum -y update

Installation:
---------------------------
yum -y install ipa-server

DNS setup
-------------------------
Install the below packages
yum -y install bind
yum -y install bind-dyndb-ldap

starting dns setup
ipa-server-install --setup-dns

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
<hostname>.<domainname>
Example: master.example.com.


Server host name [ec2-54-86-17-4.compute-1.amazonaws.com]: ec2-54-86-17-4.compute-1.amazonaws.com

Warning: skipping DNS resolution of host ec2-54-86-17-4.compute-1.amazonaws.com
The domain name has been determined based on the host name.

Please confirm the domain name [compute-1.amazonaws.com]: amazonaws.com

The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.

Please provide a realm name [AMAZONAWS.COM]: AMAZONAWS.COM
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:      manager123
Password (confirm):              manager123

The IPA server requires an administrative user, named 'admin'.
This user is a regular system account used for IPA server administration.

IPA admin password: admin123
Password (confirm): admin123

Do you want to configure DNS forwarders? [yes]: 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]: yes
Please specify the reverse zone name [43.31.172.in-addr.arpa.]: 43.31.172.in-addr.arpa.
Using reverse zone 43.31.172.in-addr.arpa.

The IPA Master Server will be configured with:
Hostname:      ec2-54-86-17-4.compute-1.amazonaws.com
IP address:    172.31.43.121
Domain name:   amazonaws.com
Realm name:    AMAZONAWS.COM

BIND DNS server will be configured to serve IPA domain with:
Forwarders:    8.8.8.8
Reverse zone:  43.31.172.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 for the CA (pkids): Estimated time 30 seconds
  [1/3]: creating directory server user
  [2/3]: creating directory server instance
  [3/3]: restarting directory server
Done configuring directory server for the CA (pkids).
Configuring certificate server (pki-cad): Estimated time 3 minutes 30 seconds
  [1/21]: creating certificate server user
  [2/21]: creating pki-ca instance
  [3/21]: configuring certificate server instance
  [4/21]: disabling nonces
  [5/21]: creating CA agent PKCS#12 file in /root
  [6/21]: creating RA agent certificate database
  [7/21]: importing CA chain to RA certificate database
  [8/21]: fixing RA database permissions
  [9/21]: setting up signing cert profile
  [10/21]: set up CRL publishing
  [11/21]: set certificate subject base
  [12/21]: enabling Subject Key Identifier
  [13/21]: setting audit signing renewal to 2 years
  [14/21]: configuring certificate server to start on boot
  [15/21]: restarting certificate server
  [16/21]: requesting RA certificate from CA
  [17/21]: issuing RA agent certificate
  [18/21]: adding RA agent as a trusted user
  [19/21]: configure certificate renewals
  [20/21]: configure Server-Cert certificate renewal
  [21/21]: Configure HTTP to proxy connections
Done configuring certificate server (pki-cad).
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]: disabling betxn plugins
  [10/38]: configuring uniqueness plugin
  [11/38]: configuring uuid plugin
  [12/38]: configuring modrdn plugin
  [13/38]: enabling entryUSN plugin
  [14/38]: configuring lockout plugin
  [15/38]: creating indices
  [16/38]: enabling referential integrity plugin
  [17/38]: configuring ssl for ds instance
  [18/38]: configuring certmap.conf
  [19/38]: configure autobind for root
  [20/38]: configure new location for managed entries
  [21/38]: restarting directory server
  [22/38]: adding default layout
  [23/38]: adding delegation layout
  [24/38]: adding replication acis
  [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]: Upload CA cert to the directory
  [33/38]: initializing group membership
  [34/38]: adding master entry
  [35/38]: configuring Posix uid/gid generation
  [36/38]: enabling compatibility plugin
  [37/38]: tuning directory server
  [38/38]: configuring directory to start on boot
Done configuring directory server (dirsrv).
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 the web interface (httpd): Estimated time 1 minute
  [1/13]: setting mod_nss port to 443
  [2/13]: setting mod_nss password file
  [3/13]: enabling mod_nss renegotiate
  [4/13]: adding URL rewriting rules
  [5/13]: configuring httpd
  [6/13]: setting up ssl
  [7/13]: setting up browser autoconfig
  [8/13]: publish CA cert
  [9/13]: creating a keytab for httpd
  [10/13]: clean up any existing httpd ccache
  [11/13]: configuring SELinux for httpd
  [12/13]: restarting httpd
  [13/13]: configuring httpd to start on boot
Done configuring the web interface (httpd).
Applying LDAP updates
Restarting the directory server
Restarting the KDC
Configuring DNS (named)
  [1/9]: adding DNS container
  [2/9]: setting up our zone
  [3/9]: setting up reverse zone
  [4/9]: setting up our own record
  [5/9]: setting up kerberos principal
  [6/9]: setting up named.conf
  [7/9]: restarting named
  [8/9]: configuring named to start on boot
  [9/9]: 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:
for port in { 80 443 389 636 88 464 53 123} ;do; netstat -aunt |grep $PORT ;done

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

-----x---X------------------

chkconfig ipa on



Others
------------------------
/etc/ssh/sshd_config
enable the below parameters
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes

Import business users into LDAP
---------------------------------------------
obtain a kerberos ticket for admin user using the admin123 passwords setup earlier

kinit admin

Setup LDAP users, groups, passwords
`````
ipa group-add marketing --desc marketing
ipa group-add legal --desc legal
ipa group-add hr --desc hr
ipa group-add sales --desc sales
ipa group-add finance --desc finance


#Setup LDAP users
ipa user-add  ali --first=ALI --last=BAJWA
ipa user-add  paul --first=PAUL --last=HEARMON
ipa user-add legal1 --first=legal1 --last=legal1
ipa user-add legal2 --first=legal2 --last=legal2
ipa user-add legal3 --first=legal3 --last=legal3
ipa user-add hr1 --first=hr1 --last=hr1
ipa user-add hr2 --first=hr2 --last=hr2
ipa user-add hr3 --first=hr3 --last=hr3
ipa user-add xapolicymgr --first=XAPolicy --last=Manager
ipa user-add rangeradmin --first=Ranger --last=Admin

#Add users to groups
ipa group-add-member sales --users=ali,paul
ipa group-add-member finance --users=ali,paul
ipa group-add-member legal --users=legal1,legal2,legal3
ipa group-add-member hr --users=hr1,hr2,hr3
ipa group-add-member admins --users=xapolicymgr,rangeradmin

#Set passwords for accounts: hortonworks
echo hortonworks >> tmp.txt
echo hortonworks >> tmp.txt

ipa passwd ali < tmp.txt
ipa passwd paul < tmp.txt
ipa passwd legal1 < tmp.txt
ipa passwd legal2 < tmp.txt
ipa passwd legal3 < tmp.txt
ipa passwd hr1 < tmp.txt
ipa passwd hr2 < tmp.txt
ipa passwd hr3 < tmp.txt
ipa passwd xapolicymgr < tmp.txt
ipa passwd rangeradmin < tmp.txt
rm -f tmp.txt
```
- Use JXplorer to browse the LDAP structure we just setup
com->amazonaws->accounts->users
com->amazonaws->accounts->groups

- Click on Paul user and notice attributes. Some important ones:
uiud, uidNumber, posixaccount, person, krbPrincipalName

- Click on hr group and notice attributes. Some important ones:
cn, gidNumber, posixgroup

Sync time with ntp server to ensure time is upto date
----------------------------------------------------------

service ntpd stop
ntpdate pool.ntp.org
service ntpd start
```
- Set password policy (optional)
```
ipa pwpolicy-mod --maxlife=0 --minlife=0 global_policy

###########################
IPA Client
######################

Note: ipa-client installation should be done on all the nodes of cluster.

ipa server Host entry  Update:
------------------------
vi /etc/hosts
172.31.25.255    ec2-54-173-54-193.compute-1.amazonaws.com       IPA_DN
172.31.26.0    ec2-54-172-53-173.compute-1.amazonaws.com       IPA_NN
172.31.43.121    ec2-54-86-17-4.compute-1.amazonaws.com          IPA


service iptables stop
service ip6tables stop
chkconfig ip6tables off
chkconfig iptables off



Installation
--------------------------------
yum -y install ipa-client openldap-clients

Sync time with ntp server to ensure time is upto date
----------------------------------------------------------
service ntpd stop
ntpdate pool.ntp.org
service ntpd start

Setting ipa client with valid parameters
-------------------------------
ipa-client-install

ipa-client-install
DNS discovery failed to determine your DNS domain
Provide the domain name of your IPA server (ex: example.com): amazonaws.com
Provide your IPA server name (ex: ipa.example.com): ec2-54-86-17-4.compute-1.amazonaws.com
The failure to use DNS to find your IPA server indicates that your resolv.conf file is not properly configured.
Autodiscovery of servers for failover cannot work with this configuration.
If you proceed with the installation, services will be configured to always access the discovered server for all operations and will not fail over to other servers in case of failure.
Proceed with fixed values and no DNS discovery? [no]: yes
Hostname: ec2-54-172-53-173.compute-1.amazonaws.com
Realm: AMAZONAWS.COM
DNS Domain: amazonaws.com
IPA Server: ec2-54-86-17-4.compute-1.amazonaws.com
BaseDN: dc=amazonaws,dc=com

Continue to configure the system with these values? [no]: yes
User authorized to enroll computers: admin
Synchronizing time with KDC...
Unable to sync time with IPA NTP server, assuming the time is in sync. Please check that 123 UDP port is opened.
Password for admin@AMAZONAWS.COM:
Successfully retrieved CA cert
    Subject:     CN=Certificate Authority,O=AMAZONAWS.COM
    Issuer:      CN=Certificate Authority,O=AMAZONAWS.COM
    Valid From:  Thu Feb 19 13:10:06 2015 UTC
    Valid Until: Mon Feb 19 13:10:06 2035 UTC

Enrolled in IPA realm AMAZONAWS.COM
Created /etc/ipa/default.conf
New SSSD config will be created
Configured sudoers in /etc/nsswitch.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm AMAZONAWS.COM
trying https://ec2-54-86-17-4.compute-1.amazonaws.com/ipa/xml
Forwarding 'env' to server u'https://ec2-54-86-17-4.compute-1.amazonaws.com/ipa/xml'
Hostname (ec2-54-86-17-4.compute-1.amazonaws.com)
updated DNS records.
Adding SSH public key from /etc/ssh/ssh_host_dsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
Forwarding 'host_mod' to server u'https://ec2-54-86-17-4.compute-1.amazonaws.com/ipa/xml'
updated DNS SSHFP records.
SSSD enabled
Configuring amazonaws.com as NIS domain
Configured /etc/openldap/ldap.conf
NTP enabled
Configured /etc/ssh/ssh_config
Configured /etc/ssh/sshd_config
Client configuration complete.
-------------------------
Verify the IPA server users
-------------------------


id ali
id paul


No comments:

Post a Comment