Пример #1
0
    def setUp(self):
        super(SamDBTestCase, self).setUp()
        invocationid = str(uuid.uuid4())
        domaindn = "DC=COM,DC=EXAMPLE"
        self.domaindn = domaindn
        configdn = "CN=Configuration," + domaindn
        schemadn = "CN=Schema," + configdn
        domainguid = str(uuid.uuid4())
        policyguid = str(uuid.uuid4())
        domainsid = security.random_sid()
        hostguid = str(uuid.uuid4())
        path = os.path.join(self.tempdir, "samdb.ldb")
        session_info = system_session()

        hostname = "foo"
        domain = "EXAMPLE"
        dnsdomain = "example.com"
        serverrole = "domain controller"

        smbconf = os.path.join(self.tempdir, "smb.conf")
        make_smbconf(smbconf, self.setup_path, hostname, domain, dnsdomain,
                     serverrole, self.tempdir)

        self.lp = param.LoadParm()
        self.lp.load(smbconf)

        names = guess_names(lp=self.lp,
                            hostname=hostname,
                            domain=domain,
                            dnsdomain=dnsdomain,
                            serverrole=serverrole,
                            domaindn=self.domaindn,
                            configdn=configdn,
                            schemadn=schemadn)

        paths = provision_paths_from_lp(self.lp, names.dnsdomain)

        provision_backend = ProvisionBackend("ldb",
                                             backend_type,
                                             paths=paths,
                                             setup_path=self.setup_path,
                                             lp=self.lp,
                                             credentials=None,
                                             names=names,
                                             message=message,
                                             hostname=hostname,
                                             root=root,
                                             schema=schema,
                                             domainsid=domainsid)

        self.samdb = setup_samdb(path, self.setup_path, session_info,
                                 provision_backend, self.lp, names,
                                 lambda x: None, domainsid, domainguid,
                                 policyguid, False, "secret", "secret",
                                 "secret", invocationid, "secret",
                                 "domain controller")
Пример #2
0
    def setUp(self):
        super(SamDBTestCase, self).setUp()
        invocationid = str(uuid.uuid4())
        domaindn = "DC=COM,DC=EXAMPLE"
        self.domaindn = domaindn
        configdn = "CN=Configuration," + domaindn
        schemadn = "CN=Schema," + configdn
        domainguid = str(uuid.uuid4())
        policyguid = DEFAULT_POLICY_GUID
        domainsid = security.random_sid()
        path = os.path.join(self.tempdir, "samdb.ldb")
        session_info = system_session()
        
        hostname="foo"
        domain="EXAMPLE"
        dnsdomain="example.com" 
        serverrole="domain controller"
        policyguid_dc = DEFAULT_DC_POLICY_GUID

        smbconf = os.path.join(self.tempdir, "smb.conf")
        make_smbconf(smbconf, hostname, domain, dnsdomain,
                     serverrole, self.tempdir)

        self.lp = param.LoadParm()
        self.lp.load(smbconf)

        names = guess_names(lp=self.lp, hostname=hostname, 
                            domain=domain, dnsdomain=dnsdomain, 
                            serverrole=serverrole, 
                            domaindn=self.domaindn, configdn=configdn, 
                            schemadn=schemadn)

        paths = provision_paths_from_lp(self.lp, names.dnsdomain)

        logger = logging.getLogger("provision")

        provision_backend = ProvisionBackend("ldb", paths=paths,
                lp=self.lp, credentials=None,
                names=names, logger=logger)

        schema = Schema(domainsid, invocationid=invocationid,
                schemadn=names.schemadn, serverdn=names.serverdn,
                am_rodc=False)

        self.samdb = setup_samdb(path, session_info,
                provision_backend, self.lp, names, logger,
                domainsid, domainguid, policyguid, policyguid_dc, False,
                "secret", "secret", "secret", invocationid, "secret",
                None, "domain controller", schema=schema)
Пример #3
0
    def setUp(self):
        super(SamDBTestCase, self).setUp()
        invocationid = str(uuid.uuid4())
        domaindn = "DC=COM,DC=EXAMPLE"
        self.domaindn = domaindn
        configdn = "CN=Configuration," + domaindn
        schemadn = "CN=Schema," + configdn
        domainguid = str(uuid.uuid4())
        policyguid = str(uuid.uuid4())
        creds = Credentials()
        creds.set_anonymous()
        domainsid = security.random_sid()
        hostguid = str(uuid.uuid4())
        path = os.path.join(self.tempdir, "samdb.ldb")
        session_info = system_session()

        hostname = "foo"
        domain = "EXAMPLE"
        dnsdomain = "example.com"
        serverrole = "domain controller"

        smbconf = os.path.join(self.tempdir, "smb.conf")
        make_smbconf(smbconf, self.setup_path, hostname, domain, dnsdomain,
                     serverrole, self.tempdir)

        self.lp = param.LoadParm()
        self.lp.load(smbconf)

        names = guess_names(lp=self.lp,
                            hostname=hostname,
                            domain=domain,
                            dnsdomain=dnsdomain,
                            serverrole=serverrole,
                            domaindn=self.domaindn,
                            configdn=configdn,
                            schemadn=schemadn)
        setup_templatesdb(os.path.join(self.tempdir, "templates.ldb"),
                          self.setup_path,
                          session_info=session_info,
                          lp=self.lp)
        self.samdb = setup_samdb(path, self.setup_path, session_info, creds,
                                 self.lp, names, lambda x: None, domainsid,
                                 domainguid, policyguid, False, "secret",
                                 "secret", "secret", invocationid, "secret",
                                 "domain controller")
Пример #4
0
    def setUp(self):
        super(SamDBTestCase, self).setUp()
        invocationid = str(uuid.uuid4())
        domaindn = "DC=COM,DC=EXAMPLE"
        self.domaindn = domaindn
        configdn = "CN=Configuration," + domaindn
        schemadn = "CN=Schema," + configdn
        domainguid = str(uuid.uuid4())
        policyguid = str(uuid.uuid4())
        creds = Credentials()
        creds.set_anonymous()
        domainsid = security.random_sid()
        hostguid = str(uuid.uuid4())
        path = os.path.join(self.tempdir, "samdb.ldb")
        session_info = system_session()
        
        hostname="foo"
        domain="EXAMPLE"
        dnsdomain="example.com" 
        serverrole="domain controller"

        smbconf = os.path.join(self.tempdir, "smb.conf")
        make_smbconf(smbconf, self.setup_path, hostname, domain, dnsdomain, 
                     serverrole, self.tempdir)

        self.lp = param.LoadParm()
        self.lp.load(smbconf)

        names = guess_names(lp=self.lp, hostname=hostname, 
                            domain=domain, dnsdomain=dnsdomain, 
                            serverrole=serverrole, 
                            domaindn=self.domaindn, configdn=configdn, 
                            schemadn=schemadn)
        setup_templatesdb(os.path.join(self.tempdir, "templates.ldb"), 
                          self.setup_path, session_info=session_info, 
                          credentials=creds, lp=self.lp)
        self.samdb = setup_samdb(path, self.setup_path, session_info, creds, 
                                 self.lp, names, 
                                 lambda x: None, domainsid, 
                                 "# no aci", domainguid, 
                                 policyguid, False, "secret", 
                                 "secret", "secret", invocationid, 
                                 "secret", "domain controller")
Пример #5
0
    def setUp(self):
        super(SamDBTestCase, self).setUp()
        invocationid = str(uuid.uuid4())
        domaindn = "DC=COM,DC=EXAMPLE"
        self.domaindn = domaindn
        configdn = "CN=Configuration," + domaindn
        schemadn = "CN=Schema," + configdn
        domainguid = str(uuid.uuid4())
        policyguid = DEFAULT_POLICY_GUID
        domainsid = security.random_sid()
        path = os.path.join(self.tempdir, "samdb.ldb")
        session_info = system_session()

        hostname = "foo"
        domain = "EXAMPLE"
        dnsdomain = "example.com"
        serverrole = "domain controller"
        policyguid_dc = DEFAULT_DC_POLICY_GUID

        smbconf = os.path.join(self.tempdir, "smb.conf")
        make_smbconf(smbconf, hostname, domain, dnsdomain, serverrole,
                     self.tempdir)

        self.lp = param.LoadParm()
        self.lp.load(smbconf)

        names = guess_names(lp=self.lp,
                            hostname=hostname,
                            domain=domain,
                            dnsdomain=dnsdomain,
                            serverrole=serverrole,
                            domaindn=self.domaindn,
                            configdn=configdn,
                            schemadn=schemadn)

        paths = provision_paths_from_lp(self.lp, names.dnsdomain)

        logger = logging.getLogger("provision")

        provision_backend = ProvisionBackend("ldb",
                                             paths=paths,
                                             lp=self.lp,
                                             credentials=None,
                                             names=names,
                                             logger=logger)

        schema = Schema(domainsid,
                        invocationid=invocationid,
                        schemadn=names.schemadn,
                        serverdn=names.serverdn,
                        am_rodc=False)

        self.samdb = setup_samdb(path,
                                 session_info,
                                 provision_backend,
                                 self.lp,
                                 names,
                                 logger,
                                 domainsid,
                                 domainguid,
                                 policyguid,
                                 policyguid_dc,
                                 False,
                                 "secret",
                                 "secret",
                                 "secret",
                                 invocationid,
                                 "secret",
                                 None,
                                 "domain controller",
                                 schema=schema)
Пример #6
0
    def setUp(self):
        super(SamDBTestCase, self).setUp()
        invocationid = str(uuid.uuid4())
        domaindn = "DC=COM,DC=EXAMPLE"
        self.domaindn = domaindn
        configdn = "CN=Configuration," + domaindn
        schemadn = "CN=Schema," + configdn
        domainguid = str(uuid.uuid4())
        policyguid = str(uuid.uuid4())
        domainsid = security.random_sid()
        hostguid = str(uuid.uuid4())
        path = os.path.join(self.tempdir, "samdb.ldb")
        session_info = system_session()

        hostname = "foo"
        domain = "EXAMPLE"
        dnsdomain = "example.com"
        serverrole = "domain controller"

        smbconf = os.path.join(self.tempdir, "smb.conf")
        make_smbconf(smbconf, self.setup_path, hostname, domain, dnsdomain, serverrole, self.tempdir)

        self.lp = param.LoadParm()
        self.lp.load(smbconf)

        names = guess_names(
            lp=self.lp,
            hostname=hostname,
            domain=domain,
            dnsdomain=dnsdomain,
            serverrole=serverrole,
            domaindn=self.domaindn,
            configdn=configdn,
            schemadn=schemadn,
        )

        paths = provision_paths_from_lp(self.lp, names.dnsdomain)

        provision_backend = ProvisionBackend(
            "ldb",
            backend_type,
            paths=paths,
            setup_path=self.setup_path,
            lp=self.lp,
            credentials=None,
            names=names,
            message=message,
            hostname=hostname,
            root=root,
            schema=schema,
            domainsid=domainsid,
        )

        self.samdb = setup_samdb(
            path,
            self.setup_path,
            session_info,
            provision_backend,
            self.lp,
            names,
            lambda x: None,
            domainsid,
            domainguid,
            policyguid,
            False,
            "secret",
            "secret",
            "secret",
            invocationid,
            "secret",
            "domain controller",
        )