Beispiel #1
0
    def test_positive_create_with_ad(self, ldap_data, server_name):
        """Create/update/delete LDAP authentication with AD using names of different types

        :id: 093f6abc-91e7-4449-b484-71e4a14ac808

        :expectedresults: Whether creating/upating/deleting LDAP Auth with AD is successful.

        :CaseImportance: Critical
        """
        auth = make_ldap_auth_source(
            {
                'name': server_name,
                'onthefly-register': 'true',
                'host': ldap_data['ldap_hostname'],
                'server-type': LDAP_SERVER_TYPE['CLI']['ad'],
                'attr-login': LDAP_ATTR['login_ad'],
                'attr-firstname': LDAP_ATTR['firstname'],
                'attr-lastname': LDAP_ATTR['surname'],
                'attr-mail': LDAP_ATTR['mail'],
                'account': ldap_data['ldap_user_name'],
                'account-password': ldap_data['ldap_user_passwd'],
                'base-dn': ldap_data['base_dn'],
                'groups-base': ldap_data['group_base_dn'],
            }
        )
        assert auth['server']['name'] == server_name
        assert auth['server']['server'] == ldap_data['ldap_hostname']
        assert auth['server']['server-type'] == LDAP_SERVER_TYPE['CLI']['ad']
        new_name = gen_string('alpha')
        LDAPAuthSource.update({'name': server_name, 'new-name': new_name})
        updated_auth = LDAPAuthSource.info({'id': auth['server']['id']})
        assert updated_auth['server']['name'] == new_name
        LDAPAuthSource.delete({'name': new_name})
        with pytest.raises(CLIReturnCodeError):
            LDAPAuthSource.info({'name': new_name})
Beispiel #2
0
    def test_positive_end_to_end_with_ipa(self, ipa_data, server_name):
        """CRUD LDAP authentication with FreeIPA

        :id: 6cb54405-b579-4020-bf99-cb811a6aa28b

        :expectedresults: Whether creating/updating/deleting LDAP Auth with FreeIPA is successful.

        :CaseImportance: High
        """
        auth = make_ldap_auth_source(
            {
                'name': server_name,
                'onthefly-register': 'true',
                'host': ipa_data['ldap_ipa_hostname'],
                'server-type': LDAP_SERVER_TYPE['CLI']['ipa'],
                'attr-login': LDAP_ATTR['login'],
                'attr-firstname': LDAP_ATTR['firstname'],
                'attr-lastname': LDAP_ATTR['surname'],
                'attr-mail': LDAP_ATTR['mail'],
                'account': ipa_data['ldap_ipa_user_name'],
                'account-password': ipa_data['ldap_ipa_user_passwd'],
                'base-dn': ipa_data['ipa_base_dn'],
                'groups-base': ipa_data['ipa_group_base_dn'],
            }
        )
        assert auth['server']['name'] == server_name
        assert auth['server']['server'] == ipa_data['ldap_ipa_hostname']
        assert auth['server']['server-type'] == LDAP_SERVER_TYPE['CLI']['ipa']
        new_name = gen_string('alpha')
        LDAPAuthSource.update({'name': server_name, 'new-name': new_name})
        updated_auth = LDAPAuthSource.info({'id': auth['server']['id']})
        assert updated_auth['server']['name'] == new_name
        LDAPAuthSource.delete({'name': new_name})
        with pytest.raises(CLIReturnCodeError):
            LDAPAuthSource.info({'name': new_name})
    def test_positive_end_to_end_withipa(self):
        """CRUD LDAP authentication with FreeIPA

        :id: 6cb54405-b579-4020-bf99-cb811a6aa28b

        :expectedresults: Whether creating/updating/deleting LDAP Auth with FreeIPA is successful.

        :CaseImportance: High
        """
        for server_name in generate_strings_list():
            with self.subTest(server_name):
                auth = make_ldap_auth_source({
                    'name':
                    server_name,
                    'onthefly-register':
                    'true',
                    'host':
                    self.ldap_ipa_hostname,
                    'server-type':
                    LDAP_SERVER_TYPE['CLI']['ipa'],
                    'attr-login':
                    LDAP_ATTR['login'],
                    'attr-firstname':
                    LDAP_ATTR['firstname'],
                    'attr-lastname':
                    LDAP_ATTR['surname'],
                    'attr-mail':
                    LDAP_ATTR['mail'],
                    'account':
                    self.ldap_ipa_user_name,
                    'account-password':
                    self.ldap_ipa_user_passwd,
                    'base-dn':
                    self.ipa_base_dn,
                    'groups-base':
                    self.ipa_base_dn,
                })
                self.assertEqual(auth['server']['name'], server_name)
                self.assertEqual(auth['server']['server'],
                                 self.ldap_ipa_hostname)
                self.assertEqual(auth['server']['server-type'],
                                 LDAP_SERVER_TYPE['CLI']['ipa'])
                new_name = gen_string('alpha')
                LDAPAuthSource.update({
                    'name': server_name,
                    'new-name': new_name
                })
                updated_auth = LDAPAuthSource.info(
                    {'id': auth['server']['id']})
                self.assertEqual(updated_auth['server']['name'], new_name)
                LDAPAuthSource.delete({'name': new_name})
                with self.assertRaises(CLIReturnCodeError):
                    LDAPAuthSource.info({'name': new_name})
Beispiel #4
0
    def test_positive_create_withad(self):
        """Create/update/delete LDAP authentication with AD using names of different types

        :id: 093f6abc-91e7-4449-b484-71e4a14ac808

        :expectedresults: Whether creating/upating/deleting LDAP Auth with AD is successful.

        :CaseImportance: Critical
        """
        for server_name in generate_strings_list():
            with self.subTest(server_name):
                auth = make_ldap_auth_source({
                    u'name':
                    server_name,
                    u'onthefly-register':
                    'true',
                    u'host':
                    self.ldap_hostname,
                    u'server-type':
                    LDAP_SERVER_TYPE['CLI']['ad'],
                    u'attr-login':
                    LDAP_ATTR['login_ad'],
                    u'attr-firstname':
                    LDAP_ATTR['firstname'],
                    u'attr-lastname':
                    LDAP_ATTR['surname'],
                    u'attr-mail':
                    LDAP_ATTR['mail'],
                    u'account':
                    self.ldap_user_name,
                    u'account-password':
                    self.ldap_user_passwd,
                    u'base-dn':
                    self.base_dn,
                    u'groups-base':
                    self.group_base_dn,
                })
                self.assertEqual(auth['server']['name'], server_name)
                self.assertEqual(auth['server']['server'], self.ldap_hostname)
                self.assertEqual(auth['server']['server-type'],
                                 LDAP_SERVER_TYPE['CLI']['ad'])
                new_name = gen_string('alpha')
                LDAPAuthSource.update({
                    u'name': server_name,
                    u'new-name': new_name
                })
                updated_auth = LDAPAuthSource.info(
                    {u'id': auth['server']['id']})
                self.assertEqual(updated_auth['server']['name'], new_name)
                LDAPAuthSource.delete({u'name': new_name})
                with self.assertRaises(CLIReturnCodeError):
                    LDAPAuthSource.info({'name': new_name})
Beispiel #5
0
    def test_positive_end_to_end_with_open_ldap(self, open_ldap_data,
                                                server_name):
        """CRUD LDAP Operations with OpenLDAP

        :id: f84db334-0189-11eb-846c-d46d6dd3b5b2

        :parametrized: yes

        :expectedresults: Whether creating/updating/deleting LDAP Auth with OpenLDAP is successful.

        :CaseImportance: High
        """
        auth = make_ldap_auth_source({
            'name':
            server_name,
            'onthefly-register':
            'true',
            'host':
            open_ldap_data.hostname,
            'server-type':
            LDAP_SERVER_TYPE['CLI']['posix'],
            'attr-login':
            LDAP_ATTR['login_ad'],
            'attr-firstname':
            LDAP_ATTR['firstname'],
            'attr-lastname':
            LDAP_ATTR['surname'],
            'attr-mail':
            LDAP_ATTR['mail'],
            'account':
            open_ldap_data.username,
            'account-password':
            open_ldap_data.password,
            'base-dn':
            open_ldap_data.base_dn,
        })
        assert auth['server']['name'] == server_name
        assert auth['server']['server'] == open_ldap_data.hostname
        assert auth['server']['server-type'] == LDAP_SERVER_TYPE['CLI'][
            'posix']
        new_name = gen_string('alpha')
        LDAPAuthSource.update({'name': server_name, 'new-name': new_name})
        updated_auth = LDAPAuthSource.info({'id': auth['server']['id']})
        assert updated_auth['server']['name'] == new_name
        LDAPAuthSource.delete({'name': new_name})
        with pytest.raises(CLIReturnCodeError):
            LDAPAuthSource.info({'name': new_name})
Beispiel #6
0
def test_positive_automate_bz1426957(ldap_auth_source, function_user_group):
    """Verify role is properly reflected on AD user.

    :id: 1c1209a6-5bb8-489c-a151-bb2fce4dbbfc

    :parametrized: yes

    :expectedresults: Roles from usergroup is applied on AD user successfully.

    :customerscenario: true

    :CaseLevel: Integration

    :BZ: 1426957, 1667704
    """
    ext_user_group = make_usergroup_external({
        'auth-source-id':
        ldap_auth_source[1].id,
        'user-group-id':
        function_user_group['id'],
        'name':
        'foobargroup',
    })
    assert ext_user_group['auth-source'] == ldap_auth_source[1].name
    role = make_role()
    UserGroup.add_role({
        'id': function_user_group['id'],
        'role-id': role['id']
    })
    Task.with_user(
        username=ldap_auth_source[0]['ldap_user_name'],
        password=ldap_auth_source[0]['ldap_user_passwd'],
    ).list()
    UserGroupExternal.refresh({
        'user-group-id': function_user_group['id'],
        'name': 'foobargroup'
    })
    assert (role['name']
            in User.info({'login': ldap_auth_source[0]['ldap_user_name']
                          })['user-groups'])
    User.delete({'login': ldap_auth_source[0]['ldap_user_name']})
    LDAPAuthSource.delete({'id': ldap_auth_source[1].id})
    def test_positive_create_withad(self):
        """Create/update/delete LDAP authentication with AD using names of different types

        :id: 093f6abc-91e7-4449-b484-71e4a14ac808

        :expectedresults: Whether creating/upating/deleting LDAP Auth with AD is successful.

        :CaseImportance: Critical
        """
        for server_name in generate_strings_list():
            with self.subTest(server_name):
                auth = make_ldap_auth_source({
                    u'name': server_name,
                    u'onthefly-register': 'true',
                    u'host': self.ldap_hostname,
                    u'server-type': LDAP_SERVER_TYPE['CLI']['ad'],
                    u'attr-login': LDAP_ATTR['login_ad'],
                    u'attr-firstname': LDAP_ATTR['firstname'],
                    u'attr-lastname': LDAP_ATTR['surname'],
                    u'attr-mail': LDAP_ATTR['mail'],
                    u'account': self.ldap_user_name,
                    u'account-password': self.ldap_user_passwd,
                    u'base-dn': self.base_dn,
                    u'groups-base': self.group_base_dn,
                })
                self.assertEqual(auth['server']['name'], server_name)
                self.assertEqual(auth['server']['server'], self.ldap_hostname)
                self.assertEqual(auth['server']['server-type'], LDAP_SERVER_TYPE['CLI']['ad'])
                new_name = gen_string('alpha')
                LDAPAuthSource.update({
                    u'name': server_name,
                    u'new-name': new_name
                })
                updated_auth = LDAPAuthSource.info({u'id': auth['server']['id']})
                self.assertEqual(updated_auth['server']['name'], new_name)
                LDAPAuthSource.delete({
                    u'name': new_name
                })
                with self.assertRaises(CLIReturnCodeError):
                    LDAPAuthSource.info({'name': new_name})
    def test_positive_end_to_end_withipa(self):
        """CRUD LDAP authentication with FreeIPA

        :id: 6cb54405-b579-4020-bf99-cb811a6aa28b

        :expectedresults: Whether creating/updating/deleting LDAP Auth with FreeIPA is successful.

        :CaseImportance: Critical
        """
        for server_name in generate_strings_list():
            with self.subTest(server_name):
                auth = make_ldap_auth_source({
                    u'name': server_name,
                    u'onthefly-register': 'true',
                    u'host': self.ldap_ipa_hostname,
                    u'server-type': LDAP_SERVER_TYPE['CLI']['ipa'],
                    u'attr-login': LDAP_ATTR['login'],
                    u'attr-firstname': LDAP_ATTR['firstname'],
                    u'attr-lastname': LDAP_ATTR['surname'],
                    u'attr-mail': LDAP_ATTR['mail'],
                    u'account': self.ldap_ipa_user_name,
                    u'account-password': self.ldap_ipa_user_passwd,
                    u'base-dn': self.ipa_base_dn,
                    u'groups-base': self.ipa_base_dn,
                })
                self.assertEqual(auth['server']['name'], server_name)
                self.assertEqual(auth['server']['server'], self.ldap_ipa_hostname)
                self.assertEqual(auth['server']['server-type'], LDAP_SERVER_TYPE['CLI']['ipa'])
                new_name = gen_string('alpha')
                LDAPAuthSource.update({
                    u'name': server_name,
                    u'new-name': new_name
                })
                updated_auth = LDAPAuthSource.info({u'id': auth['server']['id']})
                self.assertEqual(updated_auth['server']['name'], new_name)
                LDAPAuthSource.delete({
                    u'name': new_name
                })
                with self.assertRaises(CLIReturnCodeError):
                    LDAPAuthSource.info({'name': new_name})
Beispiel #9
0
 def tearDownClass(cls):
     """Delete the IPA auth-source afterwards"""
     LDAPAuthSource.delete({'id': cls.auth['server']['id']})
     super(FreeIPAUserGroupTestCase, cls).tearDownClass()
Beispiel #10
0
 def tearDownClass(cls):
     """Delete the AD auth-source afterwards"""
     LDAPAuthSource.delete({'id': cls.auth['server']['id']})
     super(ActiveDirectoryUserGroupTestCase, cls).tearDownClass()
Beispiel #11
0
 def tearDownClass(cls):
     """Delete the AD auth-source afterwards"""
     LDAPAuthSource.delete({'id': cls.auth['server']['id']})
     super().tearDownClass()