Disallow removal of dogtag and ipa-dnskeysyncd services on IPA servers

Also removes dogtagldap from unremovable services

Fixes: https://pagure.io/freeipa/issue/9764
Signed-off-by: David Hanina <dhanina@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
David Hanina authored and Sudhir Menon committed 2025-03-19 21:40:06 +05:30
1 parent ed8b4bc363
commit 1419689113
2 files changed
+27 -1

No files matched your search

+1 -1
View File
@@ -323,7 +323,7 @@ def check_required_principal(ldap, principal):
try:
host_is_master(ldap, principal.hostname)
except errors.ValidationError:
service_types = {'http', 'ldap', 'dns', 'dogtagldap'}
service_types = {'http', 'ldap', 'dns', 'dogtag', 'ipa-dnskeysyncd'}
if principal.service_name.lower() in service_types:
raise errors.ValidationError(
name='principal',
@@ -864,6 +864,32 @@ class test_service(Declarative):
),
),
dict(
desc=('Delete the current host (master?) %s dogtag service,'
' should be caught' % api.env.host),
command=('service_del', ['dogtag/%s' % api.env.host], {}),
expected=errors.ValidationError(
name='principal',
error='dogtag/%s@%s is required by the IPA master' % (
api.env.host,
api.env.realm
)
),
),
dict(
desc=('Delete the current host (master?) %s ipa-dnskeysyncd'
' service, should be caught' % api.env.host),
command=('service_del', ['ipa-dnskeysyncd/%s' % api.env.host], {}),
expected=errors.ValidationError(
name='principal',
error='ipa-dnskeysyncd/%s@%s is required by the IPA master' % (
api.env.host,
api.env.realm
)
),
),
dict(
desc='Disable the current host (master?) %s HTTP service, should be caught' % api.env.host,