From bd0d85804320e840db9b5cf19a5e69b3a0804e20 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Tue, 15 May 2012 20:03:16 +0300 Subject: Add trust-related ACIs A high-level description of the design and ACIs for trusts is available at https://www.redhat.com/archives/freeipa-devel/2011-December/msg00224.html and https://www.redhat.com/archives/freeipa-devel/2011-December/msg00248.html Ticket #1731 --- ipaserver/install/adtrustinstance.py | 90 +++++++++--------------------------- 1 file changed, 22 insertions(+), 68 deletions(-) (limited to 'ipaserver/install/adtrustinstance.py') diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py index d9609f4c..fffa062c 100644 --- a/ipaserver/install/adtrustinstance.py +++ b/ipaserver/install/adtrustinstance.py @@ -103,6 +103,8 @@ class ADTRUSTInstance(service.Service): self.trust_dn = None self.smb_dom_dn = None self.sub_dict = None + self.cifs_principal = None + self.cifs_agent = None service.Service.__init__(self, "smb", dm_password=dm_password) @@ -111,55 +113,6 @@ class ADTRUSTInstance(service.Service): else: self.fstore = sysrestore.FileStore('/var/lib/ipa/sysrestore') - def __create_samba_user(self): - print "The user for Samba is %s" % self.smb_dn - try: - self.admin_conn.getEntry(self.smb_dn, ldap.SCOPE_BASE) - root_logger.info("Samba user entry exists, resetting password") - - self.admin_conn.modify_s(self.smb_dn, \ - [(ldap.MOD_REPLACE, "userPassword", self.smb_dn_pwd)]) - return - - except errors.NotFound: - pass - - # The user doesn't exist, add it - entry = ipaldap.Entry(self.smb_dn) - entry.setValues("objectclass", ["account", "simplesecurityobject"]) - entry.setValues("uid", "samba") - entry.setValues("userPassword", self.smb_dn_pwd) - self.admin_conn.addEntry(entry) - - # And finally grant it permission to read NT passwords, we do not want - # to support LM passwords so there is no need to allow access to them. - # Also the premission to create trusted domain objects below the - # domain object is granted. - mod = [(ldap.MOD_ADD, 'aci', - str('(targetattr = "ipaNTHash")' \ - '(version 3.0; acl "Samba user can read NT passwords";' \ - 'allow (read) userdn="ldap:///%s";)' % self.smb_dn)), - (ldap.MOD_ADD, 'aci', - str('(target = "ldap:///cn=ad,cn=trusts,%s")' \ - '(targetattr = "ipaNTTrustType || ipaNTTrustAttributes || ' \ - 'ipaNTTrustDirection || ' \ - 'ipaNTTrustPartner || ipaNTFlatName || ' \ - 'ipaNTTrustAuthOutgoing || ' \ - 'ipaNTTrustAuthIncoming || ' \ - 'ipaNTSecurityIdentifier || ' \ - 'ipaNTTrustForestTrustInfo || ' \ - 'ipaNTTrustPosixOffset || ' \ - 'ipaNTSupportedEncryptionTypes")' \ - '(version 3.0;acl "Allow samba user to create and delete ' \ - 'trust accounts";' \ - 'allow (write,add,delete) userdn = "ldap:///%s";)' % \ - (self.suffix, self.smb_dn)))] - - try: - self.admin_conn.modify_s(self.suffix, mod) - except ldap.TYPE_OR_VALUE_EXISTS: - root_logger.debug("samba user aci already exists in suffix %s on %s" % (self.suffix, self.admin_conn.host)) - def __gen_sid_string(self): sub_ids = struct.unpack("