2016-11-01 03:25:16 -05:00
|
|
|
#
|
|
|
|
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
|
|
|
|
#
|
|
|
|
|
2018-04-05 02:21:16 -05:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2016-11-01 03:25:16 -05:00
|
|
|
import six
|
2018-08-02 06:45:19 -05:00
|
|
|
from ipatests.pytest_ipa.integration import tasks
|
2018-11-09 04:24:59 -06:00
|
|
|
from ipatests.pytest_ipa.integration.firewall import Firewall
|
2016-11-01 03:25:16 -05:00
|
|
|
from ipatests.test_integration.base import IntegrationTest
|
|
|
|
from ipaplatform.paths import paths
|
|
|
|
|
|
|
|
|
|
|
|
if six.PY3:
|
|
|
|
unicode = str
|
|
|
|
|
|
|
|
|
|
|
|
class TestHttpKdcProxy(IntegrationTest):
|
|
|
|
topology = "line"
|
|
|
|
num_clients = 1
|
2018-11-09 04:24:59 -06:00
|
|
|
# Firewall rules without --append/-A, --delete/-D, .. First entry of
|
|
|
|
# each rule is the chain name, the argument to add or delete the rule
|
|
|
|
# will be added by the used Firewall method. See firewall.py for more
|
|
|
|
# information.
|
|
|
|
fw_rules = [['OUTPUT', '-p', 'tcp', '--dport', '88', '-j', 'DROP'],
|
|
|
|
['OUTPUT', '-p', 'udp', '--dport', '88', '-j', 'DROP']]
|
2016-11-01 03:25:16 -05:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def install(cls, mh):
|
|
|
|
super(TestHttpKdcProxy, cls).install(mh)
|
|
|
|
# Block access from client to master's port 88
|
2018-11-09 04:24:59 -06:00
|
|
|
Firewall(cls.clients[0]).prepend_passthrough_rules(cls.fw_rules)
|
2016-11-01 03:25:16 -05:00
|
|
|
# configure client
|
|
|
|
cls.clients[0].run_command(
|
2018-09-24 03:49:45 -05:00
|
|
|
r"sed -i 's/ kdc = .*$/ kdc = https:\/\/%s\/KdcProxy/' %s" % (
|
2016-11-01 03:25:16 -05:00
|
|
|
cls.master.hostname, paths.KRB5_CONF)
|
|
|
|
)
|
|
|
|
cls.clients[0].run_command(
|
2018-09-24 03:49:45 -05:00
|
|
|
r"sed -i 's/master_kdc = .*$/master_kdc"
|
|
|
|
r" = https:\/\/%s\/KdcProxy/' %s" % (
|
2016-11-01 03:25:16 -05:00
|
|
|
cls.master.hostname, paths.KRB5_CONF)
|
|
|
|
)
|
|
|
|
# Workaround for https://fedorahosted.org/freeipa/ticket/6443
|
|
|
|
cls.clients[0].run_command(['systemctl', 'restart', 'sssd.service'])
|
|
|
|
# End of workaround
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def uninstall(cls, mh):
|
|
|
|
super(TestHttpKdcProxy, cls).uninstall(mh)
|
2018-11-09 04:24:59 -06:00
|
|
|
Firewall(cls.clients[0]).remove_passthrough_rules(cls.fw_rules)
|
2016-11-01 03:25:16 -05:00
|
|
|
|
|
|
|
def test_http_kdc_proxy_works(self):
|
|
|
|
result = tasks.kinit_admin(self.clients[0], raiseonerr=False)
|
|
|
|
assert(result.returncode == 0), (
|
|
|
|
"Unable to kinit using KdcProxy: %s" % result.stderr_text
|
|
|
|
)
|