Bug 461523 - CA creation fails
CA creation fails
Status: CLOSED UPSTREAM
Product: freeIPA
Classification: Community
Component: ipa-server (Show other bugs)
1.2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Rob Crittenden
Chandrasekar Kannan
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-08 16:24 EDT by Rob Crittenden
Modified: 2015-01-04 18:33 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-03-28 05:29:02 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
handle (1.68 KB, patch)
2010-02-03 17:47 EST, Rob Crittenden
no flags Details | Diff

  None (edit)
Description Rob Crittenden 2008-09-08 16:24:48 EDT
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 16:28:57 EDT
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-09 22:39:50 EDT
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 17:47:09 EST
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 08:14:08 EDT
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 06:44:18 EDT
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 13:24:34 EDT
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 11:53:18 EDT
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 13:43:37 EDT
changing product to freeipa

Note You need to log in before you can comment on or make changes to this bug.