mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-13 00:42:03 -05:00
Add ACL to allow CA agent to modify profiles
Part of: https://fedorahosted.org/freeipa/ticket/57 Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
1 parent
273a297e97
commit
35af0d6d66
2 files changed
+40
No files matched your search
@@ -469,6 +469,7 @@ class CAInstance(DogtagInstance):
|
||||
self.step("requesting RA certificate from CA", self.__request_ra_certificate)
|
||||
self.step("issuing RA agent certificate", self.__issue_ra_cert)
|
||||
self.step("adding RA agent as a trusted user", self.__configure_ra)
|
||||
self.step("authorizing RA to modify profiles", self.__configure_profiles_acl)
|
||||
self.step("configure certmonger for renewals", self.configure_certmonger_renewal)
|
||||
self.step("configure certificate renewals", self.configure_renewal)
|
||||
if not self.clone:
|
||||
@@ -940,6 +941,10 @@ class CAInstance(DogtagInstance):
|
||||
|
||||
conn.unbind()
|
||||
|
||||
def __configure_profiles_acl(self):
|
||||
"""Allow the Certificate Manager Agents group to modify profiles."""
|
||||
configure_profiles_acl()
|
||||
|
||||
def __run_certutil(self, args, database=None, pwd_file=None, stdin=None):
|
||||
if not database:
|
||||
database = self.ra_agent_db
|
||||
@@ -1825,6 +1830,30 @@ def update_people_entry(dercert):
|
||||
|
||||
return True
|
||||
|
||||
def configure_profiles_acl():
|
||||
server_id = installutils.realm_to_serverid(api.env.realm)
|
||||
dogtag_uri = 'ldapi://%%2fvar%%2frun%%2fslapd-%s.socket' % server_id
|
||||
updated = False
|
||||
|
||||
dn = DN(('cn', 'aclResources'), ('o', 'ipaca'))
|
||||
rule = (
|
||||
'certServer.profile.configuration:read,modify:allow (read,modify) '
|
||||
'group="Certificate Manager Agents":'
|
||||
'Certificate Manager agents may modify (create/update/delete) and read profiles'
|
||||
)
|
||||
modlist = [(ldap.MOD_ADD, 'resourceACLS', [rule])]
|
||||
|
||||
conn = ldap2.ldap2(shared_instance=False, ldap_uri=dogtag_uri)
|
||||
if not conn.isconnected():
|
||||
conn.connect(autobind=True)
|
||||
rules = conn.get_entry(dn).get('resourceACLS', [])
|
||||
if rule not in rules:
|
||||
conn.conn.modify_s(str(dn), modlist)
|
||||
updated = True
|
||||
|
||||
conn.disconnect()
|
||||
return updated
|
||||
|
||||
if __name__ == "__main__":
|
||||
standard_logging_setup("install.log")
|
||||
ds = dsinstance.DsInstance()
|
||||
|
||||
@@ -289,6 +289,16 @@ def setup_firefox_extension(fstore):
|
||||
http.setup_firefox_extension(realm, domain)
|
||||
|
||||
|
||||
def ca_configure_profiles_acl(ca):
|
||||
root_logger.info('[Authorizing RA Agent to modify profiles]')
|
||||
|
||||
if not ca.is_configured():
|
||||
root_logger.info('CA is not configured')
|
||||
return False
|
||||
|
||||
return cainstance.configure_profiles_acl()
|
||||
|
||||
|
||||
def upgrade_ipa_profile(ca, domain, fqdn):
|
||||
"""
|
||||
Update the IPA Profile provided by dogtag
|
||||
@@ -1370,6 +1380,7 @@ def upgrade_configuration():
|
||||
upgrade_ipa_profile(ca, api.env.domain, fqdn),
|
||||
certificate_renewal_update(ca),
|
||||
ca_enable_pkix(ca),
|
||||
ca_configure_profiles_acl(ca),
|
||||
])
|
||||
|
||||
if ca_restart:
|
||||
|
||||
Reference in new issue
Block a user