|
|
9f2552 |
From b4a3b88faeafa6aa197d88ee84e4b2dbadd37ace Mon Sep 17 00:00:00 2001
|
|
|
9f2552 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
9f2552 |
Date: Mon, 1 Nov 2021 10:42:27 -0400
|
|
|
9f2552 |
Subject: [PATCH 06/12] Issue 4973 - installer changes permissions on /run
|
|
|
9f2552 |
|
|
|
9f2552 |
Description: There was a regression when we switched over to using /run
|
|
|
9f2552 |
that caused the installer to try and create /run which
|
|
|
9f2552 |
caused the ownership to change. Fixed this by changing
|
|
|
9f2552 |
the "run_dir" to /run/dirsrv
|
|
|
9f2552 |
|
|
|
9f2552 |
relates: https://github.com/389ds/389-ds-base/issues/4973
|
|
|
9f2552 |
|
|
|
9f2552 |
Reviewed by: jchapman(Thanks!)
|
|
|
9f2552 |
---
|
|
|
9f2552 |
ldap/admin/src/defaults.inf.in | 2 +-
|
|
|
9f2552 |
src/lib389/lib389/instance/remove.py | 10 +---------
|
|
|
9f2552 |
src/lib389/lib389/instance/setup.py | 13 +++----------
|
|
|
9f2552 |
3 files changed, 5 insertions(+), 20 deletions(-)
|
|
|
9f2552 |
|
|
|
9f2552 |
diff --git a/ldap/admin/src/defaults.inf.in b/ldap/admin/src/defaults.inf.in
|
|
|
9f2552 |
index e02248b89..92b93d695 100644
|
|
|
9f2552 |
--- a/ldap/admin/src/defaults.inf.in
|
|
|
9f2552 |
+++ b/ldap/admin/src/defaults.inf.in
|
|
|
9f2552 |
@@ -35,7 +35,7 @@ sysconf_dir = @sysconfdir@
|
|
|
9f2552 |
initconfig_dir = @initconfigdir@
|
|
|
9f2552 |
config_dir = @instconfigdir@/slapd-{instance_name}
|
|
|
9f2552 |
local_state_dir = @localstatedir@
|
|
|
9f2552 |
-run_dir = @localrundir@
|
|
|
9f2552 |
+run_dir = @localrundir@/dirsrv
|
|
|
9f2552 |
# This is the expected location of ldapi.
|
|
|
9f2552 |
ldapi = @localrundir@/slapd-{instance_name}.socket
|
|
|
9f2552 |
pid_file = @localrundir@/slapd-{instance_name}.pid
|
|
|
9f2552 |
diff --git a/src/lib389/lib389/instance/remove.py b/src/lib389/lib389/instance/remove.py
|
|
|
9f2552 |
index 1a35ddc07..e96db3896 100644
|
|
|
9f2552 |
--- a/src/lib389/lib389/instance/remove.py
|
|
|
9f2552 |
+++ b/src/lib389/lib389/instance/remove.py
|
|
|
9f2552 |
@@ -52,9 +52,9 @@ def remove_ds_instance(dirsrv, force=False):
|
|
|
9f2552 |
remove_paths['ldif_dir'] = dirsrv.ds_paths.ldif_dir
|
|
|
9f2552 |
remove_paths['lock_dir'] = dirsrv.ds_paths.lock_dir
|
|
|
9f2552 |
remove_paths['log_dir'] = dirsrv.ds_paths.log_dir
|
|
|
9f2552 |
- # remove_paths['run_dir'] = dirsrv.ds_paths.run_dir
|
|
|
9f2552 |
remove_paths['inst_dir'] = dirsrv.ds_paths.inst_dir
|
|
|
9f2552 |
remove_paths['etc_sysconfig'] = "%s/sysconfig/dirsrv-%s" % (dirsrv.ds_paths.sysconf_dir, dirsrv.serverid)
|
|
|
9f2552 |
+ remove_paths['ldapi'] = dirsrv.ds_paths.ldapi
|
|
|
9f2552 |
|
|
|
9f2552 |
tmpfiles_d_path = dirsrv.ds_paths.tmpfiles_d + "/dirsrv-" + dirsrv.serverid + ".conf"
|
|
|
9f2552 |
|
|
|
9f2552 |
@@ -80,14 +80,6 @@ def remove_ds_instance(dirsrv, force=False):
|
|
|
9f2552 |
|
|
|
9f2552 |
### ANY NEW REMOVAL ACTION MUST BE BELOW THIS LINE!!!
|
|
|
9f2552 |
|
|
|
9f2552 |
- # Remove LDAPI socket file
|
|
|
9f2552 |
- ldapi_path = os.path.join(dirsrv.ds_paths.run_dir, "slapd-%s.socket" % dirsrv.serverid)
|
|
|
9f2552 |
- if os.path.exists(ldapi_path):
|
|
|
9f2552 |
- try:
|
|
|
9f2552 |
- os.remove(ldapi_path)
|
|
|
9f2552 |
- except OSError as e:
|
|
|
9f2552 |
- _log.debug(f"Failed to remove LDAPI socket ({ldapi_path}) Error: {str(e)}")
|
|
|
9f2552 |
-
|
|
|
9f2552 |
# Remove these paths:
|
|
|
9f2552 |
# for path in ('backup_dir', 'cert_dir', 'config_dir', 'db_dir',
|
|
|
9f2552 |
# 'ldif_dir', 'lock_dir', 'log_dir', 'run_dir'):
|
|
|
9f2552 |
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
|
|
|
9f2552 |
index 57e7a9fd4..be6854af8 100644
|
|
|
9f2552 |
--- a/src/lib389/lib389/instance/setup.py
|
|
|
9f2552 |
+++ b/src/lib389/lib389/instance/setup.py
|
|
|
9f2552 |
@@ -732,10 +732,6 @@ class SetupDs(object):
|
|
|
9f2552 |
dse += line.replace('%', '{', 1).replace('%', '}', 1)
|
|
|
9f2552 |
|
|
|
9f2552 |
with open(os.path.join(slapd['config_dir'], 'dse.ldif'), 'w') as file_dse:
|
|
|
9f2552 |
- if os.path.exists(os.path.dirname(slapd['ldapi'])):
|
|
|
9f2552 |
- ldapi_path = slapd['ldapi']
|
|
|
9f2552 |
- else:
|
|
|
9f2552 |
- ldapi_path = os.path.join(slapd['run_dir'], "slapd-%s.socket" % slapd['instance_name'])
|
|
|
9f2552 |
dse_fmt = dse.format(
|
|
|
9f2552 |
schema_dir=slapd['schema_dir'],
|
|
|
9f2552 |
lock_dir=slapd['lock_dir'],
|
|
|
9f2552 |
@@ -759,7 +755,7 @@ class SetupDs(object):
|
|
|
9f2552 |
db_dir=slapd['db_dir'],
|
|
|
9f2552 |
db_home_dir=slapd['db_home_dir'],
|
|
|
9f2552 |
ldapi_enabled="on",
|
|
|
9f2552 |
- ldapi=ldapi_path,
|
|
|
9f2552 |
+ ldapi=slapd['ldapi'],
|
|
|
9f2552 |
ldapi_autobind="on",
|
|
|
9f2552 |
)
|
|
|
9f2552 |
file_dse.write(dse_fmt)
|
|
|
9f2552 |
@@ -861,7 +857,7 @@ class SetupDs(object):
|
|
|
9f2552 |
SER_ROOT_PW: self._raw_secure_password,
|
|
|
9f2552 |
SER_DEPLOYED_DIR: slapd['prefix'],
|
|
|
9f2552 |
SER_LDAPI_ENABLED: 'on',
|
|
|
9f2552 |
- SER_LDAPI_SOCKET: ldapi_path,
|
|
|
9f2552 |
+ SER_LDAPI_SOCKET: slapd['ldapi'],
|
|
|
9f2552 |
SER_LDAPI_AUTOBIND: 'on'
|
|
|
9f2552 |
}
|
|
|
9f2552 |
|
|
|
9f2552 |
@@ -905,13 +901,10 @@ class SetupDs(object):
|
|
|
9f2552 |
self.log.info("Perform SELinux labeling ...")
|
|
|
9f2552 |
selinux_paths = ('backup_dir', 'cert_dir', 'config_dir', 'db_dir',
|
|
|
9f2552 |
'ldif_dir', 'lock_dir', 'log_dir', 'db_home_dir',
|
|
|
9f2552 |
- 'schema_dir', 'tmp_dir')
|
|
|
9f2552 |
+ 'run_dir', 'schema_dir', 'tmp_dir')
|
|
|
9f2552 |
for path in selinux_paths:
|
|
|
9f2552 |
selinux_restorecon(slapd[path])
|
|
|
9f2552 |
|
|
|
9f2552 |
- # Don't run restorecon on the entire /run directory
|
|
|
9f2552 |
- selinux_restorecon(slapd['run_dir'] + '/dirsrv')
|
|
|
9f2552 |
-
|
|
|
9f2552 |
selinux_label_port(slapd['port'])
|
|
|
9f2552 |
|
|
|
9f2552 |
# Start the server
|
|
|
9f2552 |
--
|
|
|
9f2552 |
2.31.1
|
|
|
9f2552 |
|