Bug 1482802

Summary: Unable to set ca renewal master on replica
Product: Red Hat Enterprise Linux 7 Reporter: Abhijeet Kasurde <akasurde>
Component: ipaAssignee: IPA Maintainers <ipa-maint>
Status: CLOSED ERRATA QA Contact: Michal Reznik <mreznik>
Severity: high Docs Contact:
Priority: high    
Version: 7.4CC: frenaud, ksiddiqu, mreznik, pasik, pvoborni, rcritten, slaznick, tscherf
Target Milestone: rcKeywords: Regression, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-4.5.0-21.el7.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1489299 1489300 (view as bug list) Environment:
Last Closed: 2018-04-10 16:43:55 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:
Bug Depends On:    
Bug Blocks: 1489299, 1489300    
Attachments:
Description Flags
verification_steps none

Description Abhijeet Kasurde 2017-08-18 06:40:16 UTC
Description of problem:
User is unable to set CA renewal master using `ipa config-mod --ca-renewal-master-server` 

# ipa config-mod --ca-renewal-master-server `hostname`
ipa: ERROR: invalid 'ca_renewal_master_server': must be enabled only on a single master

Whereas, following command works fine 

# ipa config-show | grep renewal
  IPA CA renewal master: master1.testrelm.test
# ipa-csreplica-manage set-renewal-master
Directory Manager password:

replica1.testrelm.test is now the renewal master
# ipa config-show | grep renewal
  IPA CA renewal master: replica1.testrelm.test

Version-Release number of selected component (if applicable):
ipa-server-4.5.0-21.el7_4.1.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Install IPA Master and Replica
2. Install CA on Replica
3. ipa config-mod --ca-renewal-master-server `hostname` on replica

Actual results:
config-mod Command fails to set ca renewal master server, but csreplica-manage command successfully sets ca renewal master.

Expected results:
Both command should set ca renewal master server.

Additional info:
Documentation here - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Linux_Domain_Identity_Authentication_and_Policy_Guide/moving-crl-gen-old.html 
should discuss `config-mod` command as well.

Comment 2 Florence Blanc-Renaud 2017-08-21 08:40:56 UTC
In ipaserver/servroles.py, l 421:

class SingleValuedServerAttribute(ServerAttribute):
    """
    Base class for server attributes that are forced to be single valued

    this means that `get` method will return a one-element list, and `set`
    method will accept only one-element list
    """

    def set(self, api_instance, masters):
        if len(masters) > 1:
            raise errors.ValidationError(
                name=self.attr_name,
                error=_("must be enabled only on a single master"))


The issue is that the set() method is called with masters = a unicode, and len(masters) returns the length of the string, not the number of elements in a list.

Comment 3 Florence Blanc-Renaud 2017-08-21 08:46:48 UTC
Probably a regression introduced with commit bddb90f38a3505a2768862d2f814c5e749a7dcde
Allow for multivalued server attributes

Comment 6 Petr Vobornik 2017-08-24 09:50:24 UTC
Upstream ticket:
https://pagure.io/freeipa/issue/7120

Comment 12 Michal Reznik 2017-12-08 09:16:22 UTC
Verified on ipa-server-4.5.4-6.el7.x86_64

Comment 13 Michal Reznik 2017-12-08 09:16:54 UTC
Created attachment 1364705 [details]
verification_steps

Comment 16 errata-xmlrpc 2018-04-10 16:43:55 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-2018:0918