Bug 1452617

Summary: Unable to create IPA Sub CA
Product: Red Hat Enterprise Linux 7 Reporter: Abhijeet Kasurde <akasurde>
Component: pki-coreAssignee: Fraser Tweedale <ftweedal>
Status: CLOSED ERRATA QA Contact: Abhijeet Kasurde <akasurde>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: akasurde, ftweedal, ksiddiqu, mharmsen, pvoborni, rcritten, tscherf
Target Milestone: rcKeywords: Regression, TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pki-core-10.4.1-7.el7 Doc Type: No Doc Update
Doc Text:
(Fixed a regression only introduced in 10.4 and found by QE)
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 22:52:53 UTC Type: Bug
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
console.log none

Description Abhijeet Kasurde 2017-05-19 10:48:56 UTC
Description of problem:
When administrator tries to create subca using `ipa ca-add` it fails with following error :

[root@ipaserver01 ~]# ipa -v ca-add test_1
ipa: INFO: trying https://ipaserver01.testrelm.test/ipa/json
Subject DN: CN=as
ipa: INFO: Forwarding 'ca_add/1' to json server 'https://ipaserver01.testrelm.test/ipa/json'
ipa: ERROR: No valid Negotiate header in server response
[root@ipaserver01 ~]# ipa -vvvv ca-add test_1
ipa: INFO: trying https://ipaserver01.testrelm.test/ipa/json
Subject DN: cn=as
ipa: INFO: Forwarding 'ca_add/1' to json server 'https://ipaserver01.testrelm.test/ipa/json'
ipa: INFO: Request: {
    "id": 0,
    "method": "ca_add/1",
    "params": [
        [
            "test_1"
        ],
        {
            "ipacasubjectdn": "cn=as",
            "version": "2.224"
        }
    ]
}
send: u'POST /ipa/json HTTP/1.1\r\nHost: ipaserver01.testrelm.test\r\nAccept-Encoding: gzip\r\nAccept-Language: en-us\r\nReferer: https://ipaserver01.testrelm.test/ipa/xml\r\nAuthorization: negotiate YIICagYJKoZIhvcSAQICAQBuggJZMIICVaADAgEFoQMCAQ6iBwMFACAAAACjggFrYYIBZzCCAWOgAwIBBaEPGw1URVNUUkVMTS5URVNUojEwL6ADAgEDoSgwJhsESFRUUBseYmtyLWh2MDMtZ3Vlc3QyNy50ZXN0cmVsbS50ZXN0o4IBFjCCARKgAwIBEqEDAgECooIBBASCAQBoJcM0yhbcpf+o6EmhHCFfAdWkBfqGsYPvUE3+jneXRY63dX7bB+/aNY54aPFByuUn7SkdBu27Gsge97e5E9M0D6GI0UM43hXrgk2R+1NcDfZ3slhTMP1FUd/s8P498goEbeVFH57tfrNsV7qhs7lQXTQj4p8MoTEXVUcedWpteYb34hRF06vvlGmFi4iyzOk5uBfs0NTfn4BHrx2l51P2nf4AifslGjcXbNLOXZrH8g0ERMnbAb9QLML3nH22tVBPHmVsPpzNonANouFea5c7F90jqW5mTWsnEOHbjEcK4RGJfGycwz2+OwasSUTzzX5BMPo/p/4chnSoeMBcLoRPpIHQMIHNoAMCARKigcUEgcIKhP1AebEYSltMX06H6YPpoqMEl92AQaFT+RzAFEoQTxiQFBGlPFZy00pX8gx8M+FbEB40TDrjs7gkxK2xoi/zA3uquHb0HYG+GCtLZU6hXVL2yyyPXXojcUx86iCNHKl8/olrFgQujz6JJwFQu8VhnU7rky4Q1mY0EWRuxCNU6iqb9fGQZMqRB4d7njcYnPAAzsYMXLPDPvl0wISHTVQ88GYqT58XxcZqycYNJAvLar7mXYPen7LIzEkOyRkhP0s8MA==\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: application/json\r\nContent-Length: 200\r\n\r\n{\n    "id": 0, \n    "method": "ca_add/1", \n    "params": [\n        [\n            "test_1"\n        ], \n        {\n            "ipacasubjectdn": "cn=as", \n            "version": "2.224"\n        }\n    ]\n}'
reply: 'HTTP/1.1 401 Unauthorized\r\n'
header: Date: Fri, 19 May 2017 10:27:34 GMT
header: Server: Apache/2.4.6 (Red Hat Enterprise Linux) mod_auth_gssapi/1.5.1 mod_nss/1.0.14 NSS/3.28.4 mod_wsgi/3.4 Python/2.7.5
header: WWW-Authenticate: Negotiate
header: Set-Cookie: ipa_session=expiry=1495191454389356;Max-Age=1800;path=/ipa;httponly;secure;
header: X-Frame-Options: DENY
header: Content-Security-Policy: frame-ancestors 'none'
header: Last-Modified: Thu, 18 May 2017 14:35:14 GMT
header: Accept-Ranges: bytes
header: Content-Length: 1474
header: Cache-Control: no-cache
header: Content-Type: text/html; charset=UTF-8
ipa: ERROR: No valid Negotiate header in server response
[root@ipaserver01 ~]# echo $?
1
[root@ipaserver01 ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Version-Release number of selected component (if applicable):
[root@ipaserver01 ~]# rpm -qa ipa-server
ipa-server-4.5.0-13.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Install IPA server
2. Create Sub CA using ipa

Actual results:
Error as mentioned above

Expected results:
Sub CA created successfully.

Comment 3 Petr Vobornik 2017-05-19 11:04:23 UTC
ipa: ERROR: No valid Negotiate header in server response

is not an error related to Sub CA but more for session handling and authentication. So in theory on this machine every ipa CLI command should give you this error.

Does:
  systemctl restart gssproxy.service
  systemctl restart httpd.service

help?

If so. Is it really just after clean ipa install? Isn't there update step or something?

Ideally a beaker job if it is available.

Comment 4 Abhijeet Kasurde 2017-05-19 12:30:13 UTC
(In reply to Petr Vobornik from comment #3)
> ipa: ERROR: No valid Negotiate header in server response
> 
> is not an error related to Sub CA but more for session handling and
> authentication. So in theory on this machine every ipa CLI command should
> give you this error.
> 
> Does:
>   systemctl restart gssproxy.service
>   systemctl restart httpd.service
> 
> help?
> 
After restarting error disappeared, but now there is new error 

[root@ipaserver01 ~]# echo Secret123 | kinit admin
Password for admin:
[root@ipaserver01 ~]# ipa ca-add
Name: SampleCA
Subject DN: CN=SampleCA,DN=testrelm.test
ipa: ERROR: Request failed with status 400: Non-2xx response from CA REST API: 400. java.lang.IllegalArgumentException: Invalid Subject DN: CN=SampleCA,DN=testrelm.test
[root@ipaserver01 ~]# ipactl status
Directory Service: RUNNING
krb5kdc Service: RUNNING
kadmin Service: RUNNING
named Service: RUNNING
httpd Service: RUNNING
ipa-custodia Service: RUNNING
ntpd Service: RUNNING
pki-tomcatd Service: RUNNING
ipa-otpd Service: RUNNING
ipa-dnskeysyncd Service: RUNNING
ipa: INFO: The ipactl command was successful

> If so. Is it really just after clean ipa install? Isn't there update step or
> something?
> 
IPA server installation is clean installation. There is no update or upgrade.

> Ideally a beaker job if it is available.
Here is link of CI job - 
https://platform-stg-jenkins.rhev-ci-vms.eng.rdu2.redhat.com/job/ipa-rhel-7.4-candidate-runtest-subca-pytest/21/testReport/

Comment 5 Fraser Tweedale 2017-05-22 03:33:51 UTC
The Subject DN "CN=SampleCA,DN=testrelm.test" is invalid
(there is no "DN" attribute).  So there is not really a bug;
but we should detect and handle this error gracefully.

Comment 6 Abhijeet Kasurde 2017-05-22 05:44:45 UTC
(In reply to Fraser Tweedale from comment #5)
> The Subject DN "CN=SampleCA,DN=testrelm.test" is invalid
> (there is no "DN" attribute).  So there is not really a bug;
> but we should detect and handle this error gracefully.
Yes, I agree Subject DN is not valid. But, command still fails with correct Subject DN.

# ipa ca-add
Name: SampleCA1
Subject DN: CN=SampleCA1,O=testrelm.test
ipa: ERROR: Request failed with status 500: Non-2xx response from CA REST API: 500. Error creating CA: Error creating lightweight CA certificate: java.lang.NullPointerException

Comment 7 Fraser Tweedale 2017-05-22 07:16:49 UTC
Huh.  Can you provide a traceback, Abhijeet?

Comment 9 Fraser Tweedale 2017-05-26 07:46:42 UTC
Confirmed.  It is regression in Dogtag.  Patch imminent.

Comment 10 Fraser Tweedale 2017-05-26 07:59:31 UTC
Upstream patch committed (2866f6195eb49012cf7c42089a9fbf1be819129a).

Comment 13 Abhijeet Kasurde 2017-06-02 06:47:13 UTC
Verified using IPA and PKI Server version::
ipa-server-4.5.0-14.el7.x86_64
pki-server-10.4.1-7.el7.noarch

Marking BZ as verified. See attachments for console.log.

Comment 14 Abhijeet Kasurde 2017-06-02 06:47:58 UTC
Created attachment 1284331 [details]
console.log

Comment 15 errata-xmlrpc 2017-08-01 22:52:53 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.

https://access.redhat.com/errata/RHBA-2017:2110