Bug 461523

Summary: CA creation fails
Product: [Retired] freeIPA Reporter: Rob Crittenden <rcritten>
Component: ipa-serverAssignee: Rob Crittenden <rcritten>
Status: CLOSED UPSTREAM QA Contact: Chandrasekar Kannan <ckannan>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.2CC: benl, dpal, jeff.raber, jgalipea, rmeggins, rvokal, ssorce
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-03-28 09:29:02 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:
Attachments:
Description Flags
handle none

Description Rob Crittenden 2008-09-08 20:24:48 UTC
Description of problem:

Creation of the CA is failing in certutil because it is unable to open the temporary certificate request file for writing.

Note that the CA that is generated is lacking the CA basic constraint too. certutil needs the -2 argument as well to make a "proper" CA.

root        : DEBUG      [10/17]: configuring ssl for ds instance
  [10/17]: configuring ssl for ds instance
root        : DEBUG    Loading Index file from '/var/lib/ipa/sysrestore/sysrestore.index'
root        : INFO     
root        : INFO     
root        : INFO     
root        : INFO     

Generating key.  This may take a few moments...


root        : INFO     
root        : INFO     certutil -o: unable to open "tempcertreq" for writing (-5966, 13)

Unexpected error - see ipaserver-install.log for details:
 Command '/usr/bin/certutil -d /etc/dirsrv/slapd-TESTDOMAIN-COM/ -S -n CA certificate -s cn=IPA Test Certificate Authority -x -t CT,,C -m 1001 -v 120 -z /etc/dirsrv/slapd-TESTDOMAIN-COM//noise.txt -f /etc/dirsrv/slapd-TESTDOMAIN-COM//pwdfile.txt' returned non-zero exit status 255
root        : DEBUG    Command '/usr/bin/certutil -d /etc/dirsrv/slapd-TESTDOMAIN-COM/ -S -n CA certificate -s cn=IPA Test Certificate Authority -x -t CT,,C -m 1001 -v 120 -z /etc/dirsrv/slapd-TESTDOMAIN-COM//noise.txt -f /etc/dirsrv/slapd-TESTDOMAIN-COM//pwdfile.txt' returned non-zero exit status 255
  File "/usr/sbin/ipa-server-install", line 604, in <module>
    sys.exit(main())

  File "/usr/sbin/ipa-server-install", line 505, in main
    ds.create_instance(ds_user, realm_name, host_name, domain_name, dm_password)

  File "/usr/lib/python2.5/site-packages/ipaserver/dsinstance.py", line 183, in create_instance
    self.start_creation("Configuring directory server:")

  File "/usr/lib/python2.5/site-packages/ipaserver/service.py", line 139, in start_creation
    method()

  File "/usr/lib/python2.5/site-packages/ipaserver/dsinstance.py", line 338, in __enable_ssl
    ca.create_self_signed()

  File "/usr/lib/python2.5/site-packages/ipaserver/certs.py", line 373, in create_self_signed
    self.create_ca_cert()

  File "/usr/lib/python2.5/site-packages/ipaserver/certs.py", line 168, in create_ca_cert
    "-f", self.passwd_fname])

  File "/usr/lib/python2.5/site-packages/ipaserver/certs.py", line 126, in run_certutil
    return ipautil.run(new_args, stdin)

  File "/usr/lib/python2.5/site-packages/ipa/ipautil.py", line 87, in run
    raise CalledProcessError(p.returncode, ' '.join(args))

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

From GIT

Comment 1 Rich Megginson 2008-09-08 20:28:57 UTC
Adding -2 to the certutil -S will not fix the original problem, which is that I was running ipa-server-install as root from an NFS mount - for some reason certutil attempts to write to $PWD, which fails with EACCES (13).

In order to automate CA cert creation with the -2 argument, you have to provide 3 additional args on stdin:
#> certutil -S -n "CA certificate" -s "cn=CAcert" -x -t "CT,," -m 1000 -v 120 -d $secdir \
   -z $secdir/noise.txt -f $secdir/pwdfile.txt -2
Is this a CA certificate [y/N]? y
Enter the path length constraint, enter to skip [<0 for unlimited path]:
Is this a critical extension [y/N]? y

so
( echo y; echo; echo y ) | certutil -S ..... -2

Comment 2 Bug Zapper 2009-06-10 02:39:50 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Rob Crittenden 2010-02-03 22:47:09 UTC
Created attachment 388667 [details]
handle

The root cause of this problem is that certutil wants to write a file to the cwd when generating a key so we need to be some place writable.

So don't assume that cwd exists or is writable. I had worked on this previously so that we change to a known writable directory when issuing server certs. Enhance that so we change to the NSS db dir when issuing the self-signed CA. 

Also handle the case where cwd is an invalid directory. I tested this with:

term 1: mkdir foo
        cd foo

term 2: rmdir foo

term 1: ipa-server-install ...

Probably not a major issue but not hard to more carefully handle it either. The installation will still fail but at least we have a good message when it does.

I tested the non-writable directory by creating a small filesystem:

# dd if=/dev/zero of=/root/partition bs=65535 count=10
# mke2fs /root/partition (say yes that it is isn't a block system)
# mount -o ro,loop /root/partition /mnt
# cd /mnt
# ipa-server-install

Comment 4 Bug Zapper 2010-04-27 12:14:08 UTC
This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 11 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 5 Bug Zapper 2010-06-28 10:44:18 UTC
Fedora 11 changed to end-of-life (EOL) status on 2010-06-25. Fedora 11 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Rob Crittenden 2010-07-06 17:24:34 UTC
In an unrelated change IPA now tests to be sure that the cwd is sane. This should address this problem.

Comment 7 Jeff Raber 2010-07-14 15:53:18 UTC
Package Maintainer: I see that you reopened this bug.  Unfortunately the 'version' is set to 11 and F11 is EOL.  Please change the 'version' to >11.

Comment 8 Rob Crittenden 2010-07-14 17:43:37 UTC
changing product to freeipa