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

Check that IPA configuration has MS-PAC generation enabled #332

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/ipahealthcheck/ipa/trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,3 +684,23 @@ def check(self):
key='adtrustpackage',
msg='trust-ad sub-package is not installed. '
'Administration will be limited.')


@registry
class IPAauthzdatapacCheck(IPAPlugin):
"""
Verify that the MS-PAC generation is not disabled
"""
@duration
def check(self):
ipaconfig = api.Command.config_show(raw=True)
krbauthzdata = ipaconfig['result'].get('ipakrbauthzdata', tuple())
authzdata = 'MS-PAC'
if authzdata not in krbauthzdata:
yield Result(self, constants.ERROR,
key=authzdata,
error='access to IPA API will not work',
msg='MS-PAC generation is not enabled '
'in IPA configuration {key}: {error}')
else:
yield Result(self, constants.SUCCESS, key='MS-PAC')
44 changes: 43 additions & 1 deletion tests/test_ipa_trust.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
IPATrustControllerGroupSIDCheck,
IPATrustControllerAdminSIDCheck,
IPATrustControllerConfCheck,
IPATrustPackageCheck)
IPATrustPackageCheck,
IPAauthzdatapacCheck)

from ipalib import errors
from ipapython.dn import DN
Expand Down Expand Up @@ -1287,3 +1288,44 @@ def test_agent_without_package(self):
assert result.source == 'ipahealthcheck.ipa.trust'
assert result.check == 'IPATrustPackageCheck'
sys.modules['ipaserver.install'] = save


class TestConfiguration(BaseTest):

def test_ipakrbauthzdata_positive(self):
framework = object()
registry.initialize(framework, config.Config)
f = IPAauthzdatapacCheck(registry)

m_api.Command.config_show.side_effect = [{
'result': {
'ipakrbauthzdata': ['MS-PAC', 'nfs:NONE', ]
}
}]
self.results = capture_results(f)

assert len(self.results) == 1

result = self.results.results[0]
assert result.result == constants.SUCCESS
assert result.source == 'ipahealthcheck.ipa.trust'
assert result.check == 'IPAauthzdatapacCheck'

def test_ipakrbauthzdata_negative(self):
framework = object()
registry.initialize(framework, config.Config)
f = IPAauthzdatapacCheck(registry)

m_api.Command.config_show.side_effect = [{
'result': {
'ipakrbauthzdata': ['nfs:NONE', ]
}
}]
self.results = capture_results(f)

assert len(self.results) == 1

result = self.results.results[0]
assert result.result == constants.ERROR
assert result.source == 'ipahealthcheck.ipa.trust'
assert result.check == 'IPAauthzdatapacCheck'
Loading