Bug 1250093 - ipa certprofile-import accepts invalid config
ipa certprofile-import accepts invalid config
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ipa (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: IPA Maintainers
Namita Soman
:
Depends On: 1253045
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-04 09:46 EDT by Scott Poore
Modified: 2015-11-19 07:04 EST (History)
4 users (show)

See Also:
Fixed In Version: ipa-4.2.0-5.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 07:04:54 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Scott Poore 2015-08-04 09:46:06 EDT
Description of problem:

ipa certprofile-import is accepting configs with invalid settings.

[root@master ~]# cp /usr/share/ipa/profiles/caIPAserviceCert.cfg /tmp/bad_profile.cfg
[root@master ~]# sed -i 's/profileId=.*$/profileId=bad_profile/' /tmp/bad_profile.cfg
[root@master ~]# sed -i 's/desc=.*$/desc=My Bad Profile/' /tmp/bad_profile.cfg 
[root@master ~]# sed -i 's/^name=.*$/name=bad_profile/' /tmp/bad_profile.cfg 
[root@master ~]# ipa certprofile-import bad_profile --file=/tmp/bad_profile.cfg --store=False --desc="Bad Profile"
------------------------------
Imported profile "bad_profile"
------------------------------
  Profile ID: bad_profile
  Profile description: Bad Profile
  Store issued certificates: FALSE


This should fail or throw warnings at least since the ipa profile one copied above has variables and not filled in values.

Version-Release number of selected component (if applicable):
ipa-server-4.2.0-3.el7.x86_64
pki-ca-10.2.5-4.el7.noarch

How reproducible:
always

Steps to Reproduce:
1.  Install IPA 4.2 or above.
2.  Prepare invalid config:

cp /usr/share/ipa/profiles/caIPAserviceCert.cfg /tmp/bad_profile.cfg
sed -i 's/profileId=.*$/profileId=bad_profile/' /tmp/bad_profile.cfg
sed -i 's/desc=.*$/desc=My Bad Profile/' /tmp/bad_profile.cfg
sed -i 's/^name=.*$/name=bad_profile/' /tmp/bad_profile.cfg

3.  import bad config:

ipa certprofile-import bad_profile --file=/tmp/bad_profile.cfg --store=False --desc="Bad Profile"

Actual results:

imports

Expected results:

should fail with warning about config file 

Additional info:
Comment 2 Fraser Tweedale 2015-08-05 00:36:01 EDT
This issue is fixed in Dogtag 10.2.6.

Upstream ticket: https://fedorahosted.org/pki/ticket/1462
Comment 3 Jan Cholasta 2015-08-05 01:24:25 EDT
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/5140
Comment 6 Scott Poore 2015-08-20 12:35:21 EDT
I'm not seeing pki 10.2.6 installed on RHEL7.2 box with ipa 4.2.0-5:

[root@master log]# rpm -q ipa-server pki-ca
ipa-server-4.2.0-5.el7.x86_64
pki-ca-10.2.5-5.el7.noarch

And I'm still seeing the bad profile imported:

[root@master ~]# cp /usr/share/ipa/profiles/caIPAserviceCert.cfg /tmp/bad_profile.cfg
[root@master ~]# sed -i 's/profileId=.*$/profileId=bad_profile/' /tmp/bad_profile.cfg
[root@master ~]# sed -i 's/desc=.*$/desc=My Bad Profile/' /tmp/bad_profile.cfg 
[root@master ~]# sed -i 's/^name=.*$/name=bad_profile/' /tmp/bad_profile.cfg 
[root@master ~]# ipa certprofile-import bad_profile --file=/tmp/bad_profile.cfg --store=False --desc="Bad Profile"
------------------------------
Imported profile "bad_profile"
------------------------------
  Profile ID: bad_profile
  Profile description: Bad Profile
  Store issued certificates: FALSE

Is this correct?
Comment 7 Jan Cholasta 2015-08-21 02:14:55 EDT
pki-core-10.2.5-5.el7 is the correct pki-core version, but it does not contain the fix. My bad, let me sort it out.
Comment 8 Fraser Tweedale 2015-08-21 03:16:35 EDT
Also note that there are some "bad" profiles whose badness cannot be detected on import, e.g. if there are interpolations that reference nonexistant data.
There are many possible errors that will not be detected at import time,
but will cause certificate issuance to fail.  The default profile template may
be one such case of this.

Only blatant syntax errors and certain bogus configuration will be detected
at import time.
Comment 9 Scott Poore 2015-08-27 21:23:55 EDT
Verified.

Version ::

ipa-server-4.2.0-8.el7.x86_64

Results ::

[root@master ~]# ipa certprofile-show caIPAserviceCert --out=/tmp/default_profile.cfg
---------------------------------------------------------------
Profile configuration stored in file '/tmp/default_profile.cfg'
---------------------------------------------------------------
  Profile ID: caIPAserviceCert
  Profile description: Standard profile for network services
  Store issued certificates: TRUE

[root@master ~]# cp /tmp/default_profile.cfg /tmp/profile_unknown_classid.cfg

[root@master ~]# cp /tmp/default_profile.cfg /tmp/profile_invalid_list_value.cfg

[root@master ~]# vi /tmp/profile_unknown_classid.cfg

[root@master ~]# vim /tmp/profile_invalid_list_value.cfg


[root@master ~]# diff /tmp/default_profile.cfg /tmp/profile_unknown_classid.cfg
6c6
< input.i1.class_id=certReqInputImpl
---
> input.i1.class_id=certReqInputImplInvalid
108d107
< profileId=caIPAserviceCert


[root@master ~]# diff /tmp/default_profile.cfg /tmp/profile_invalid_list_value.cfg
107,108c107
< policyset.serverCertSet.list=1,2,3,4,5,6,7,8,9,10,11
< profileId=caIPAserviceCert
---
> policyset.serverCertSet.list=1,2,3,4,5,6,7,8,9,10,11,99


[root@master ~]# ipa certprofile-import --store=False --desc=desc profile_unknown_classid --file=/tmp/profile_unknown_classid.cfg 
ipa: ERROR: Non-2xx response from CA REST API: 400 Bad Request. Invalid profile data

[root@master ~]# ipa certprofile-import profile_invalid_list_value --store=False --desc=desc --file=/tmp/profile_invalid_list_value.cfg
ipa: ERROR: Non-2xx response from CA REST API: 400 Bad Request. Invalid profile data
Comment 10 errata-xmlrpc 2015-11-19 07:04:54 EST
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://rhn.redhat.com/errata/RHBA-2015-2362.html

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