Bug 750828

Summary: named configuration error when installed with --external-ca option.
Product: Red Hat Enterprise Linux 6 Reporter: Gowrishankar Rajaiyan <grajaiya>
Component: ipaAssignee: Rob Crittenden <rcritten>
Status: CLOSED ERRATA QA Contact: IDM QE LIST <seceng-idm-qe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: dpal, grajaiya, jgalipea, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-2.2.0-1.el6 Doc Type: Bug Fix
Doc Text:
Cause: When IPA is installed with --external-ca option, the installation is divided to 2 stages. The second stage of installation read configuration options from a file stored by the first stage. The installer however did not store a value with DNS forwarder IP address properly and it was then misread by the second stage installation. Consequence: When IPA is installed with --external-ca and DNS support, forwarder IP address is corrupted. Name server configuration in second stage installation then fails. Fix: Forwarder option is now stored properly. Result: IPA can now be properly installed with external CA and DNS support.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 13:15:59 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:
Bug Depends On:    
Bug Blocks: 756082    

Description Gowrishankar Rajaiyan 2011-11-02 13:20:37 UTC
Description of problem:


Version-Release number of selected component (if applicable):
ipa-server-2.1.3-6.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. [root@mudflap ~]# ipa-server-install --setup-dns --external-ca

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 [mudflap.testrelm]: 

Warning: skipping DNS resolution of host mudflap.testrelm
The domain name has been calculated based on the host name.

Please confirm the domain name [testrelm]: 

The IPA Master Server will be configured with
Hostname:    mudflap.testrelm
IP address:  10.65.201.66
Domain name: testrelm

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

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

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

IPA admin password: 
Password (confirm): 

Do you want to configure DNS forwarders? [yes]: 
Enter the IP address of DNS forwarder to use, or press Enter to finish.
Enter IP address for a DNS forwarder: 10.65.201.66
DNS forwarder 10.65.201.66 added
Enter IP address for a DNS forwarder: 
Do you want to configure the reverse zone? [yes]: 
Please specify the reverse zone name [201.65.10.in-addr.arpa.]: 
Using reverse zone 201.65.10.in-addr.arpa.

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 minutes 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 33 minutes 30 seconds
  [1/4]: creating certificate server user
  [2/4]: creating pki-ca instance
  [3/4]: configuring certificate server instance
The next step is to get /root/ipa.csr signed by your CA and re-run ipa-server-install as:
ipa-server-install --external_cert_file=/path/to/signed_certificate --external_ca_file=/path/to/external_ca_certificate
[root@mudflap ~]# 


2. [root@mudflap ca]# ipa-server-install --external_cert_file=/root/ca/ipa.crt --external_ca_file=/root/ca/ipacacert.asc 

The log file for this installation can be found in /var/log/ipaserver-install.log
Directory Manager password: 

==============================================================================
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.

Warning: skipping DNS resolution of host mudflap.testrelm
The IPA Master Server will be configured with
Hostname:    mudflap.testrelm
IP address:  10.65.201.66
Domain name: testrelm

Using reverse zone 201.65.10.in-addr.arpa.
Configuring certificate server: Estimated time 33 minutes 30 seconds
  [1/16]: creating certificate server user
  [2/16]: configuring certificate server instance
  [3/16]: disabling nonces
  [4/16]: creating CA agent PKCS#12 file in /root
  [5/16]: creating RA agent certificate database
  [6/16]: importing CA chain to RA certificate database
  [7/16]: fixing RA database permissions
  [8/16]: setting up signing cert profile
  [9/16]: set up CRL publishing
  [10/16]: set certificate subject base
  [11/16]: configuring certificate server to start on boot
  [12/16]: restarting certificate server
  [13/16]: requesting RA certificate from CA
  [14/16]: issuing RA agent certificate
  [15/16]: adding RA agent as a trusted user
  [16/16]: Configure HTTP to proxy connections
done configuring pki-cad.
Configuring directory server: Estimated time 31 minutes
  [1/35]: creating directory server user
  [2/35]: creating directory server instance
  [3/35]: adding default schema
  [4/35]: enabling memberof plugin
  [5/35]: enabling referential integrity plugin
  [6/35]: enabling winsync plugin
  [7/35]: configuring replication version plugin
  [8/35]: enabling IPA enrollment plugin
  [9/35]: enabling ldapi
  [10/35]: configuring uniqueness plugin
  [11/35]: configuring uuid plugin
  [12/35]: configuring modrdn plugin
  [13/35]: enabling entryUSN plugin
  [14/35]: configuring lockout plugin
  [15/35]: creating indices
  [16/35]: configuring ssl for ds instance
  [17/35]: configuring certmap.conf
  [18/35]: configure autobind for root
  [19/35]: configure new location for managed entries
  [20/35]: restarting directory server
  [21/35]: adding default layout
  [22/35]: adding delegation layout
  [23/35]: adding replication acis
  [24/35]: creating container for managed entries
  [25/35]: configuring user private groups
  [26/35]: configuring netgroups from hostgroups
  [27/35]: creating default Sudo bind user
  [28/35]: creating default Auto Member layout
  [29/35]: creating default HBAC rule allow_all
  [30/35]: initializing group membership
  [31/35]: adding master entry
  [32/35]: configuring Posix uid/gid generation
  [33/35]: enabling compatibility plugin
Restarting IPA to initialize updates before performing deletes:
  [1/2]: stopping directory server
  [2/2]: starting directory server
done configuring dirsrv.
  [34/35]: tuning directory server
  [35/35]: configuring directory to start on boot
done configuring dirsrv.
Configuring Kerberos KDC: Estimated time 30 minutes 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 31 minutes
  [1/13]: disabling mod_ssl in httpd
  [2/13]: setting mod_nss port to 443
  [3/13]: setting mod_nss password file
  [4/13]: enabling mod_nss renegotiate
  [5/13]: adding URL rewriting rules
  [6/13]: configuring httpd
  [7/13]: setting up ssl
  [8/13]: setting up browser autoconfig
  [9/13]: publish CA cert
  [10/13]: creating a keytab for httpd
  [11/13]: configuring SELinux for httpd
  [12/13]: restarting httpd
  [13/13]: configuring httpd to start on boot
done configuring httpd.
Applying LDAP updates
Restarting IPA to initialize updates before performing deletes:
  [1/2]: stopping directory server
  [2/2]: starting directory server
done configuring dirsrv.
Restarting the directory server
Restarting the KDC
Restarting the web server
Configuring 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
named service failed to start     <<<<<<<<<<<<<
  [8/9]: configuring named to start on boot
  [9/9]: changing resolv.conf to point to ourselves
done configuring named.
==============================================================================
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.

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
[root@mudflap ca]# 

3. [root@mudflap ca]# ipactl status
  
Actual results: 
[root@mudflap ca]# ipactl status
Directory Service: RUNNING
KDC Service: RUNNING
KPASSWD Service: RUNNING
DNS Service: STOPPED     <<<<<<<
HTTP Service: RUNNING
CA Service: RUNNING
[root@mudflap ca]# 

Error in named configuration.

Expected results: no configuration errors and named starts successfully.


Additional info:
[root@mudflap ~]# cat /etc/named.conf 
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

options {
	listen-on port 53 { 127.0.0.1; };
	listen-on-v6 port 53 { ::1; };
	directory 	"/var/named";
	dump-file 	"/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
	allow-query     { localhost; };
	recursion yes;

	dnssec-enable yes;
	dnssec-validation yes;
	dnssec-lookaside auto;

	/* Path to ISC DLV key */
	bindkeys-file "/etc/named.iscdlv.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
	type hint;
	file "named.ca";
};

include "/etc/named.rfc1912.zones";

[root@mudflap ~]# cat /etc/named.conf 
options {
	// turns on IPv6 for port 53, IPv4 is on by default for all ifaces
	listen-on-v6 {any;};

	// Put files that named is allowed to write in the data/ directory:
	directory "/var/named"; // the default
	dump-file		"data/cache_dump.db";
	statistics-file		"data/named_stats.txt";
	memstatistics-file	"data/named_mem_stats.txt";

	forward first;
	forwarders {
		[;
		';
		1;
		0;
		.;
		6;
		5;
		.;
		2;
		0;
		1;
		.;
		6;
		6;
		';
		];
	};

	// Any host is permitted to issue recursive queries
	allow-recursion { any; };

	tkey-gssapi-credential "DNS/mudflap.testrelm";
	tkey-domain "TESTRELM";
};

/* If you want to enable debugging, eg. using the 'rndc trace' command,
 * By default, SELinux policy does not allow named to modify the /var/named directory,
 * so put the default debug log file in data/ :
 */
logging {
	channel default_debug {
		file "data/named.run";
		severity dynamic;
	};
};

zone "." IN {
	type hint;
	file "named.ca";
};

include "/etc/named.rfc1912.zones";

dynamic-db "ipa" {
	library "ldap.so";
	arg "uri ldapi://%2fvar%2frun%2fslapd-TESTRELM.socket";
	arg "base cn=dns, dc=testrelm";
	arg "fake_mname mudflap.testrelm.";
	arg "auth_method sasl";
	arg "sasl_mech GSSAPI";
	arg "sasl_user DNS/mudflap.testrelm";
	arg "zone_refresh 30";
};
[root@mudflap ~]#

Comment 2 Martin Kosek 2011-11-02 13:33:40 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/2054

Comment 3 Dmitri Pal 2011-11-02 21:28:24 UTC
Seems like a dup of #743680.
Related ticket is https://fedorahosted.org/freeipa/ticket/1931

Comment 4 Rob Crittenden 2011-11-03 12:52:39 UTC
No, in this case we're actually mis-writing the configuration file.

We store the configuration options between runs when installing an external CA because the IPA installer needs to be run twice.

Martin suggested using pickle to store the config data natively rather than using RawConfigParser.

Comment 7 Martin Kosek 2012-04-19 11:32:18 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: When IPA is installed with --external-ca option, the installation is divided to 2 stages. The second stage of installation read configuration options from a file stored by the first stage. The installer however did not store a value with DNS forwarder IP address properly and it was then misread by the second stage installation.
Consequence: When IPA is installed with --external-ca and DNS support, forwarder IP address is corrupted. Name server configuration in second stage installation then fails.
Fix: Forwarder option is now stored properly.
Result: IPA can now be properly installed with external CA and DNS support.

Comment 8 Gowrishankar Rajaiyan 2012-05-16 14:34:20 UTC
# ipa-server-install --external-ca --setup-dns 
...
The next step is to get /root/ipa.csr signed by your CA and re-run ipa-server-install as:
ipa-server-install --external_cert_file=/path/to/signed_certificate --external_ca_file=/path/to/external_ca_certificate


# ipa-server-install --external_cert_file=/root/ipa-ca/ipa.crt --external_ca_file=/root/ipa-ca/ipacacert.asc 
...
Restarting the web server
==============================================================================
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.

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


# ipactl status
Directory Service: RUNNING
KDC Service: RUNNING
KPASSWD Service: RUNNING
DNS Service: RUNNING
MEMCACHE Service: RUNNING
HTTP Service: RUNNING
CA Service: RUNNING


# cat /etc/named.conf 
options {
	// turns on IPv6 for port 53, IPv4 is on by default for all ifaces
	listen-on-v6 {any;};

	// Put files that named is allowed to write in the data/ directory:
	directory "/var/named"; // the default
	dump-file		"data/cache_dump.db";
	statistics-file		"data/named_stats.txt";
	memstatistics-file	"data/named_mem_stats.txt";

	forward first;
	forwarders {
		10.14.63.12;
	};

	// Any host is permitted to issue recursive queries
	allow-recursion { any; };

	tkey-gssapi-credential "DNS/goldbug.lab.eng.pnq.redhat.com";
	tkey-domain "LAB.ENG.PNQ.REDHAT.COM";
};

/* If you want to enable debugging, eg. using the 'rndc trace' command,
 * By default, SELinux policy does not allow named to modify the /var/named directory,
 * so put the default debug log file in data/ :
 */
logging {
	channel default_debug {
		file "data/named.run";
		severity dynamic;
	};
};

zone "." IN {
	type hint;
	file "named.ca";
};

include "/etc/named.rfc1912.zones";

dynamic-db "ipa" {
	library "ldap.so";
	arg "uri ldapi://%2fvar%2frun%2fslapd-LAB-ENG-PNQ-REDHAT-COM.socket";
	arg "base cn=dns, dc=lab,dc=eng,dc=pnq,dc=redhat,dc=com";
	arg "fake_mname goldbug.lab.eng.pnq.redhat.com.";
	arg "auth_method sasl";
	arg "sasl_mech GSSAPI";
	arg "sasl_user DNS/goldbug.lab.eng.pnq.redhat.com";
	arg "zone_refresh 30";
};


Verified: ipa-server-2.2.0-14.el6.x86_64

Comment 10 errata-xmlrpc 2012-06-20 13:15:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0819.html