Bug 730526

Summary: ipa-server-install leaves a number of files unreadable by apache if run with umask 0027
Product: [Retired] freeIPA Reporter: Asbjørn Bjørnstad <asbjxrn>
Component: ipa-serverAssignee: Martin Kosek <mkosek>
Status: CLOSED ERRATA QA Contact: Chandrasekar Kannan <ckannan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: benl, dpal, jgalipea, mkosek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: freeipa-2.1.3-5.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-28 09:25:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Asbjørn Bjørnstad 2011-08-14 06:11:12 UTC
Description of problem:

ipa-server-install (and ipa-client-install) does not change the permissions of most files after creating them. If root has a umask preventing files from being world readable, this creates issues as the apache web server will be unable to read the ipa config files. 

Version-Release number of selected component (if applicable):

2.0.0.rc3


Steps to Reproduce:
1. set umask to 027
2. run ipa-server-install
  
Actual results:

No ipa commands will work as /etc/ipa/default.conf is mode rw-r-----
A number of files in /usr/share/ipa is also world unreadable causing the web ui not to work.

Expected results:

Files need to be world readable or at least readable for apache.

Additional info:

Comment 1 Martin Kosek 2011-08-15 06:39:12 UTC
This is fixed upstream, you can check a related upstream ticket here:

https://fedorahosted.org/freeipa/ticket/1282

This fix will be a part of FreeIPA 2.1 release which should occur this week. With the upstream version the problem 


Now, the installation works correctly even with changed umask:


# ipa-server-install -p secret123 -a secret123

The log file for this installation can be found in /var/log/ipaserver-install.log
==============================================================================
This program will set up the FreeIPA Server.

This includes:
  * 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)

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

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 [vm-051.idm.lab.bos.redhat.com]: 

The domain name has been calculated based on the host name.

Please confirm the domain name [idm.lab.bos.redhat.com]: 

The IPA Master Server will be configured with
Hostname:    vm-051.idm.lab.bos.redhat.com
IP address:  10.16.78.51
Domain name: idm.lab.bos.redhat.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 [IDM.LAB.BOS.REDHAT.COM]: 

The following operations may take some minutes to complete.
Please wait until the prompt is returned.

Configuring ntpd
  [1/4]: stopping ntpd
  [2/4]: writing configuration
  [3/4]: configuring ntpd to start on boot
  [4/4]: starting ntpd
done configuring ntpd.
Configuring directory server for the CA: Estimated time 30 seconds
  [1/3]: creating directory server user
  [2/3]: creating directory server instance
  [3/3]: restarting directory server
done configuring pkids.
Configuring certificate server: Estimated time 3 minutes 30 seconds
  [1/16]: creating certificate server user
  [2/16]: creating pki-ca instance
  [3/16]: configuring certificate server instance
  [4/16]: disabling nonces
  [5/16]: creating CA agent PKCS#12 file in /root
  [6/16]: creating RA agent certificate database
  [7/16]: importing CA chain to RA certificate database
  [8/16]: fixing RA database permissions
  [9/16]: setting up signing cert profile
  [10/16]: set up CRL publishing
  [11/16]: set certificate subject base
  [12/16]: configuring certificate server to start on boot
  [13/16]: restarting certificate server
  [14/16]: requesting RA certificate from CA
  [15/16]: issuing RA agent certificate
  [16/16]: adding RA agent as a trusted user
done configuring pki-cad.
Configuring directory server: Estimated time 1 minute
  [1/32]: creating directory server user
  [2/32]: creating directory server instance
  [3/32]: adding default schema
  [4/32]: enabling memberof plugin
  [5/32]: enabling referential integrity plugin
  [6/32]: enabling winsync plugin
  [7/32]: configuring replication version plugin
  [8/32]: enabling IPA enrollment plugin
  [9/32]: enabling ldapi
  [10/32]: configuring uniqueness plugin
  [11/32]: configuring uuid plugin
  [12/32]: configuring modrdn plugin
  [13/32]: enabling entryUSN plugin
  [14/32]: configuring lockout plugin
  [15/32]: creating indices
  [16/32]: configuring ssl for ds instance
  [17/32]: configuring certmap.conf
  [18/32]: configure autobind for root
  [19/32]: restarting directory server
  [20/32]: adding default layout
  [21/32]: adding delegation layout
  [22/32]: adding replication acis
  [23/32]: configuring user private groups
  [24/32]: configuring netgroups from hostgroups
  [25/32]: creating default Sudo bind user
  [26/32]: creating default HBAC rule allow_all
  [27/32]: initializing group membership
  [28/32]: adding master entry
  [29/32]: configuring Posix uid/gid generation
  [30/32]: enabling compatibility plugin
  [31/32]: tuning directory server
  [32/32]: configuring directory to start on boot
done configuring dirsrv.
Configuring Kerberos KDC: Estimated time 30 seconds
  [1/14]: setting KDC account password
  [2/14]: adding sasl mappings to the directory
  [3/14]: adding kerberos entries to the DS
  [4/14]: adding default ACIs
  [5/14]: configuring KDC
  [6/14]: adding default keytypes
  [7/14]: adding default password policy
  [8/14]: creating a keytab for the directory
  [9/14]: creating a keytab for the machine
  [10/14]: exporting the kadmin keytab
  [11/14]: adding the password extension to the directory
  [12/14]: adding the kerberos master key to the directory
  [13/14]: starting the KDC
  [14/14]: configuring KDC to start on boot
done configuring krb5kdc.
Configuring ipa_kpasswd
  [1/2]: starting ipa_kpasswd 
  [2/2]: configuring ipa_kpasswd to start on boot
done configuring ipa_kpasswd.
Configuring the web interface: Estimated time 1 minute
  [1/12]: disabling mod_ssl in httpd
  [2/12]: setting mod_nss port to 443
  [3/12]: setting mod_nss password file
  [4/12]: adding URL rewriting rules
  [5/12]: configuring httpd
  [6/12]: setting up ssl
  [7/12]: setting up browser autoconfig
  [8/12]: publish CA cert
  [9/12]: creating a keytab for httpd
  [10/12]: configuring SELinux for httpd
  [11/12]: restarting httpd
  [12/12]: configuring httpd to start on boot
done configuring httpd.
Applying LDAP updates
Restarting the directory server
Restarting the KDC
Restarting the web server
Sample zone file for bind has been created in /tmp/sample.zone.LAYU8y.db
==============================================================================
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
		UDP Ports:
		  * 88, 464: kerberos
		  * 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

# ls -la /etc/ipa/default.conf 
-rw-r--r--. 1 root root 321 Aug 15 02:17 /etc/ipa/default.conf

# kinit admin
Password for admin.BOS.REDHAT.COM: 

# ipa user-find
--------------
1 user matched
--------------
  User login: admin
  Last name: Administrator
  Home directory: /home/admin
  Login shell: /bin/bash
  UID: 214000000
  GID: 214000000
  Account disabled: False
----------------------------
Number of entries returned 1
----------------------------

Comment 2 Martin Kosek 2011-08-16 09:11:17 UTC
I went with the files created by ipa-server-install again and we indeed create files with wrong umask (for example in /usr/share/ipa/html). This will need to be reviewed and fixed.

Upstream ticket:
https://fedorahosted.org/freeipa/ticket/1644