def client(request):
    tasks.install_client(request.cls.master, request.cls.clients[0])

    def teardown_client():
        tasks.uninstall_client(request.cls.clients[0])
        request.cls.delete_client_host_entry()
    request.addfinalizer(teardown_client)
def client(request):
    # Here we call "fix_resolv_conf" method before every ipa-client-install so
    # we get the client pointing to ipa master as DNS server.
    request.cls.fix_resolv_conf(request.cls.clients[0], request.cls.master)
    tasks.install_client(request.cls.master, request.cls.clients[0])

    def teardown_client():
        tasks.uninstall_client(request.cls.clients[0])
        request.cls.delete_client_host_entry()
    request.addfinalizer(teardown_client)
Ejemplo n.º 3
0
 def test_replica_promotion_by_unprivileged_user(self):
     replica = self.replicas[0]
     tasks.install_client(self.master, replica)
     result2 = replica.run_command([
         'ipa-replica-install', '-P', self.username, '-p',
         self.new_password, '-n', self.master.domain.name, '-r',
         self.master.domain.realm
     ],
                                   raiseonerr=False)
     assert_error(result2, "Insufficient privileges to promote the server",
                  1)
Ejemplo n.º 4
0
 def test_replica_promotion_by_unprivileged_user(self):
     replica = self.replicas[0]
     tasks.install_client(self.master, replica)
     result2 = replica.run_command(['ipa-replica-install',
                                    '-P', self.username,
                                    '-p', self.new_password,
                                    '-n', self.master.domain.name,
                                    '-r', self.master.domain.realm],
                                   raiseonerr=False)
     assert_error(result2,
                  "Insufficient privileges to promote the server", 1)
Ejemplo n.º 5
0
 def test_promotion_disabled(self):
     """
     Testcase:
     http://www.freeipa.org/page/V4/Replica_Promotion/Test_plan#Test_case:
     _Make_sure_the_feature_is_unavailable_under_domain_level_0
     """
     client = self.replicas[0]
     tasks.install_client(self.master, client)
     args = ['ipa-replica-install', '-U',
             '-p', self.master.config.dirman_password,
             '-w', self.master.config.admin_password,
             '--ip-address', client.ip]
     result = client.run_command(args, raiseonerr=False)
     assert_error(result,
                  'You must provide a file generated by ipa-replica-prepare'
                  ' to create a replica when the domain is at level 0', 1)
Ejemplo n.º 6
0
 def test_promotion_disabled(self):
     """
     Testcase:
     http://www.freeipa.org/page/V4/Replica_Promotion/Test_plan#Test_case:
     _Make_sure_the_feature_is_unavailable_under_domain_level_0
     """
     client = self.replicas[0]
     tasks.install_client(self.master, client)
     args = ['ipa-replica-install', '-U',
             '-p', self.master.config.dirman_password,
             '-w', self.master.config.admin_password,
             '--ip-address', client.ip]
     result = client.run_command(args, raiseonerr=False)
     assert_error(result,
                  'You must provide a file generated by ipa-replica-prepare'
                  ' to create a replica when the domain is at level 0', 1)
Ejemplo n.º 7
0
    def test_installclient_as_user_admin(self):
        """ipa-client-install should not use hardcoded admin for principal

        In ipaclient-install.log it should use the username that was entered
        earlier in the install process at the prompt.
        Related to : https://pagure.io/freeipa/issue/5406
        """
        client = self.clients[0]
        tasks.install_master(self.master)
        tasks.kinit_admin(self.master)
        username = '******'
        password = '******'
        password_confirmation = "%s\n%s\n" % (password,
                                              password)

        self.master.run_command(['ipa', 'user-add', username,
                                 '--first', username,
                                 '--last', username,
                                 '--password'],
                                stdin_text=password_confirmation)

        role_add = ['ipa', 'role-add', 'useradmin']
        self.master.run_command(role_add)
        self.master.run_command(['ipa', 'privilege-add', 'Add Hosts'])
        self.master.run_command(['ipa', 'privilege-add-permission',
                                 '--permissions', 'System: Add Hosts',
                                 'Add Hosts'])

        self.master.run_command(['ipa', 'role-add-privilege', 'useradmin',
                                 '--privileges', 'Host Enrollment'])

        self.master.run_command(['ipa', 'role-add-privilege', 'useradmin',
                                 '--privileges', 'Add Hosts'])

        role_member_add = ['ipa', 'role-add-member', 'useradmin',
                           '--users={}'.format(username)]
        self.master.run_command(role_member_add)
        user_kinit = "%s\n%s\n%s\n" % (password, password, password)
        self.master.run_command(['kinit', username],
                                stdin_text=user_kinit)
        tasks.install_client(self.master, client, user=username,
                             password=password)
        msg = "args=['/usr/bin/getent', 'passwd', '%s@%s']" % \
              (username, client.domain.name)
        install_log = client.get_file_contents(paths.IPACLIENT_INSTALL_LOG,
                                               encoding='utf-8')
        assert msg in install_log