Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replica: Ensure that ipaapi user is allowed to access ifp #4914

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion ipaserver/install/server/replicainstall.py
Expand Up @@ -22,7 +22,7 @@
from pkg_resources import parse_version
import six

from ipaclient.install.client import check_ldap_conf
from ipaclient.install.client import check_ldap_conf, sssd_enable_ifp
import ipaclient.install.timeconf
from ipalib.install import certstore, sysrestore
from ipalib.install.kinit import kinit_keytab
Expand Down Expand Up @@ -462,6 +462,9 @@ def promote_sssd(host_name):
domain.set_option('ipa_server', host_name)
domain.set_option('ipa_server_mode', True)
sssdconfig.save_domain(domain)

sssd_enable_ifp(sssdconfig)

sssdconfig.write()

sssd = services.service('sssd', api)
Expand Down
41 changes: 41 additions & 0 deletions ipatests/test_integration/test_replica_promotion.py
Expand Up @@ -47,6 +47,21 @@ def test_kra_install_master(self):
assert(found > 0), result2.stdout_text


def sssd_config_allows_ipaapi_access_to_ifp(host):
"""Checks that the sssd configuration allows the ipaapi user to access
ifp

:param host the machine on which to check that sssd allows ipaapi
access to ifp
"""
with tasks.remote_sssd_config(host) as sssd_conf:
ifp = sssd_conf.get_service('ifp')
uids = [
uid.strip() for uid in ifp.get_option('allowed_uids').split(',')
]
assert 'ipaapi' in uids


class TestReplicaPromotionLevel1(ReplicaPromotionBase):
"""
TestCase: http://www.freeipa.org/page/V4/Replica_Promotion/Test_plan#
Expand Down Expand Up @@ -100,6 +115,16 @@ def test_one_command_installation(self):
result = self.replicas[0].run_command(['ipa-pkinit-manage', 'status'])
assert "PKINIT is enabled" in result.stdout_text

@replicas_cleanup
def test_sssd_config_allows_ipaapi_access_to_ifp(self):
"""Verify that the sssd configuration allows the ipaapi user to
access ifp

Test for ticket 8403.
"""
for replica in self.replicas:
sssd_config_allows_ipaapi_access_to_ifp(replica)


class TestUnprivilegedUserPermissions(IntegrationTest):
"""
Expand Down Expand Up @@ -171,6 +196,22 @@ def test_replica_promotion_after_adding_to_admin_group(self):
'-r', self.master.domain.realm,
'-U'])

def test_sssd_config_allows_ipaapi_access_to_ifp(self):
self.master.run_command(['ipa', 'group-add-member', 'admins',
'--users=%s' % self.username])

# Configure firewall first
Firewall(self.replicas[0]).enable_services(["freeipa-ldap",
"freeipa-ldaps"])
self.replicas[0].run_command(['ipa-replica-install',
'-P', self.username,
'-p', self.new_password,
'-n', self.master.domain.name,
'-r', self.master.domain.realm,
'-U'])

sssd_config_allows_ipaapi_access_to_ifp(self.replicas[0])


class TestProhibitReplicaUninstallation(IntegrationTest):
topology = 'line'
Expand Down