mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 11:24:50 +00:00
Merge pull request #897 from t-woerner/add_ipaserver_idstart_check
ipaserver: Add missing idstart check
This commit is contained in:
@@ -225,7 +225,8 @@ from ansible.module_utils.ansible_ipa_server import (
|
|||||||
read_cache, ca, tasks, check_ldap_conf, timeconf, httpinstance,
|
read_cache, ca, tasks, check_ldap_conf, timeconf, httpinstance,
|
||||||
check_dirsrv, ScriptError, get_fqdn, verify_fqdn, BadHostError,
|
check_dirsrv, ScriptError, get_fqdn, verify_fqdn, BadHostError,
|
||||||
validate_domain_name, load_pkcs12, IPA_PYTHON_VERSION,
|
validate_domain_name, load_pkcs12, IPA_PYTHON_VERSION,
|
||||||
encode_certificate, check_available_memory, getargspec, adtrustinstance
|
encode_certificate, check_available_memory, getargspec, adtrustinstance,
|
||||||
|
get_min_idstart
|
||||||
)
|
)
|
||||||
from ansible.module_utils import six
|
from ansible.module_utils import six
|
||||||
|
|
||||||
@@ -579,6 +580,16 @@ def main():
|
|||||||
"'--ignore-topology-disconnect/--ignore-last-of-role' "
|
"'--ignore-topology-disconnect/--ignore-last-of-role' "
|
||||||
"options can be used only during uninstallation")
|
"options can be used only during uninstallation")
|
||||||
|
|
||||||
|
if get_min_idstart is not None:
|
||||||
|
min_idstart = get_min_idstart()
|
||||||
|
if self.idstart < min_idstart:
|
||||||
|
raise RuntimeError(
|
||||||
|
"idstart (%i) must be larger than UID_MAX/GID_MAX "
|
||||||
|
"(%i) setting in /etc/login.defs." % (
|
||||||
|
self.idstart, min_idstart
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if self.idmax < self.idstart:
|
if self.idmax < self.idstart:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"idmax (%s) cannot be smaller than idstart (%s)" %
|
"idmax (%s) cannot be smaller than idstart (%s)" %
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ __all__ = ["IPAChangeConf", "certmonger", "sysrestore", "root_logger",
|
|||||||
"adtrustinstance", "IPAAPI_USER", "sync_time", "PKIIniLoader",
|
"adtrustinstance", "IPAAPI_USER", "sync_time", "PKIIniLoader",
|
||||||
"default_subject_base", "default_ca_subject_dn",
|
"default_subject_base", "default_ca_subject_dn",
|
||||||
"check_ldap_conf", "encode_certificate", "decode_certificate",
|
"check_ldap_conf", "encode_certificate", "decode_certificate",
|
||||||
"check_available_memory", "getargspec"]
|
"check_available_memory", "getargspec", "get_min_idstart"]
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -200,6 +200,11 @@ else:
|
|||||||
from ipalib.x509 import load_certificate
|
from ipalib.x509 import load_certificate
|
||||||
load_pem_x509_certificate = None
|
load_pem_x509_certificate = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ipaserver.install.server.install import get_min_idstart
|
||||||
|
except ImportError:
|
||||||
|
get_min_idstart = None
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# IPA version < 4.5
|
# IPA version < 4.5
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user