mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Don't create log files from help scripts
Helper scripts now use api.bootstrap(log=None) to avoid the creation of log files. Helper scripts are typically executed from daemons which perform their own logging. The helpers still log to stderr/stdout. This also gets rid of some SELinux AVCs when the script tries to write to /root/.ipa/. Fixes: https://pagure.io/freeipa/issue/8075 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
98ee5f2472
commit
90f7232454
@ -477,7 +477,9 @@ def main():
|
||||
if operation not in ('SUBMIT', 'POLL'):
|
||||
return OPERATION_NOT_SUPPORTED_BY_HELPER
|
||||
|
||||
api.bootstrap(in_server=True, context='renew', confdir=paths.ETC_IPA)
|
||||
api.bootstrap(
|
||||
in_server=True, context='renew', confdir=paths.ETC_IPA, log=None
|
||||
)
|
||||
api.finalize()
|
||||
|
||||
tmpdir = tempfile.mkdtemp(prefix="tmp-")
|
||||
|
@ -43,7 +43,9 @@ from ipapython.certdb import TrustFlags
|
||||
def _main():
|
||||
nickname = sys.argv[1]
|
||||
|
||||
api.bootstrap(in_server=True, context='restart', confdir=paths.ETC_IPA)
|
||||
api.bootstrap(
|
||||
in_server=True, context='restart', confdir=paths.ETC_IPA, log=None
|
||||
)
|
||||
api.finalize()
|
||||
|
||||
dogtag_service = services.knownservices['pki_tomcatd']
|
||||
|
@ -34,7 +34,9 @@ from ipaplatform.paths import paths
|
||||
|
||||
|
||||
def _main():
|
||||
api.bootstrap(in_server=True, context='restart', confdir=paths.ETC_IPA)
|
||||
api.bootstrap(
|
||||
in_server=True, context='restart', confdir=paths.ETC_IPA, log=None
|
||||
)
|
||||
api.finalize()
|
||||
|
||||
tmpdir = tempfile.mkdtemp(prefix="tmp-")
|
||||
|
@ -34,7 +34,9 @@ def _main():
|
||||
except IndexError:
|
||||
instance = ""
|
||||
|
||||
api.bootstrap(in_server=True, context='restart', confdir=paths.ETC_IPA)
|
||||
api.bootstrap(
|
||||
in_server=True, context='restart', confdir=paths.ETC_IPA, log=None
|
||||
)
|
||||
api.finalize()
|
||||
|
||||
syslog.syslog(syslog.LOG_NOTICE, "certmonger restarted dirsrv instance '%s'" % instance)
|
||||
|
@ -28,7 +28,9 @@ from ipaserver.install import certs
|
||||
|
||||
|
||||
def main():
|
||||
api.bootstrap(in_server=True, context='restart', confdir=paths.ETC_IPA)
|
||||
api.bootstrap(
|
||||
in_server=True, context='restart', confdir=paths.ETC_IPA, log=None
|
||||
)
|
||||
api.finalize()
|
||||
|
||||
dogtag_service = services.knownservices['pki_tomcatd']
|
||||
|
@ -102,7 +102,7 @@ class IPACustodiaTester:
|
||||
self.args = args
|
||||
if not api.isdone('bootstrap'):
|
||||
# bootstrap to initialize api.env
|
||||
api.bootstrap()
|
||||
api.bootstrap(log=None)
|
||||
self.debug("IPA API bootstrapped")
|
||||
self.realm = api.env.realm
|
||||
self.host = api.env.host
|
||||
|
@ -186,8 +186,10 @@ class KDCProxyConfig:
|
||||
def main(debug=DEBUG, time_limit=TIME_LIMIT):
|
||||
# initialize API without file logging
|
||||
if not api.isdone('bootstrap'):
|
||||
api.bootstrap(context='server', confdir=paths.ETC_IPA,
|
||||
log=None, debug=debug)
|
||||
api.bootstrap(
|
||||
context='server', confdir=paths.ETC_IPA, log=None,
|
||||
debug=debug
|
||||
)
|
||||
standard_logging_setup(verbose=True, debug=debug)
|
||||
|
||||
try:
|
||||
|
@ -88,7 +88,7 @@ def main():
|
||||
sys.exit(EXIT_SUCCESS)
|
||||
|
||||
# bootstrap ipalib.api to parse config file
|
||||
api.bootstrap(confdir=paths.ETC_IPA)
|
||||
api.bootstrap(confdir=paths.ETC_IPA, log=None)
|
||||
timeout = api.env.startup_timeout
|
||||
|
||||
conn = get_conn(api.env.host, subsystem=SUBSYSTEM)
|
||||
|
@ -8,9 +8,9 @@ import os
|
||||
|
||||
from ipalib import api
|
||||
from ipalib import errors
|
||||
from ipaplatform.paths import paths
|
||||
from ipapython.dn import DN
|
||||
from ipapython.ipaldap import LDAPClient
|
||||
from ipaserver.install.installutils import realm_to_ldapi_uri
|
||||
from ipapython.ipaldap import LDAPClient, realm_to_ldapi_uri
|
||||
from . import common
|
||||
|
||||
CN_CONFIG = DN(('cn', 'config'))
|
||||
@ -46,7 +46,7 @@ def main():
|
||||
|
||||
# create LDAP connection using LDAPI and EXTERNAL bind as root
|
||||
if not api.isdone('bootstrap'):
|
||||
api.bootstrap()
|
||||
api.bootstrap(confdir=paths.ETC_IPA, log=None)
|
||||
realm = api.env.realm
|
||||
ldap_uri = realm_to_ldapi_uri(realm)
|
||||
conn = LDAPClient(ldap_uri=ldap_uri, no_schema=True)
|
||||
|
Loading…
Reference in New Issue
Block a user