#7503 multiple occurrences of profileId in certprofile causes incorrect behaviour
Closed: fixed Opened by ftweedal.

Issue

In certprofile-import if the config file contains two profileId directives with different
values, the profile can be imported under an incorrect ID.

e.g. if profile config contains:

profileId=test1
profileId=test2

And you import the profile into FreeIPA as test1, i.e. ipa certprofile-import test1 ...,
then the profile will be imported into Dogtag as test2. The actual certprofile-import operation fails:

# ipa certprofile-import test1 --file test1.cfg --store 1 --desc test1
ipa: ERROR: Request failed with status 500: Non-2xx response from CA REST API: 500. 

And no IPA entry for the profile has been created (either as test1 or test2):

# ipa certprofile-show test1
ipa: ERROR: test1: Certificate Profile not found
# ipa certprofile-show test2
ipa: ERROR: test2: Certificate Profile not found

But the profile HAS been imported into Dogtag, as test2

# ldapsearch -D cn=directory\ manager -w secret123 -b 'ou=certificateProfiles,ou=ca,o=ipaca' 1.1 |grep test
# test2, certificateProfiles, ca, ipaca
dn: cn=test2,ou=certificateProfiles,ou=ca,o=ipaca

A subsequent attempt to issue a cert using profile test1 fails:

# ipa cert-request --principal alice --profile test1 alice.csr                                                   
ipa: ERROR: Request failed with status 400: Non-2xx response from CA REST API: 400. Profile test1 Not Found

This operation against Dogtag should probably not even have been attempted, since no
IPA object for the profile was created.

Similarly, attempting to issue using test2 also fails, because that profile has not been
enabled yet:

# ipa cert-request --principal alice --profile test2 alice.csr                                                   
ipa: ERROR: Request failed with status 400: Non-2xx response from CA REST API: 400. Profile test2 not enabled

And again, it should probably not have even been attempted.

Expected behavior

The presense of two profileId directives in the profile configuration should be detected by FreeIPA, and the configuration rejected.


PR: https://github.com/freeipa/freeipa/pull/1830

Metadata Update from @ftweedal:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/1830

master:

  • a7b18372ed0f6be95e382194ad599b8a35113351 certprofile: reject config with multiple profileIds
  • 0f8593354d8008a501a6e7fa5f142d970face65a certprofile: add tests for config profileId scenarios

Metadata Update from @rcritten:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

ipa-4-6:

  • 1a6acd5119e023ed086816dca9218aa1f8e3f4c3 certprofile: reject config with multiple profileIds
  • 5fb3475a789fc68cd361e4f042bd583645adec6e certprofile: add tests for config profileId scenarios

Metadata Update from @pvoborni:
- Issue set to the milestone: FreeIPA 4.6.4

Metadata