More working on getting rhel6 for horizon working.
This commit is contained in:
parent
a908dfa977
commit
9bfd64c4d1
@ -191,16 +191,14 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
||||
sh.root_mode()
|
||||
#fix the socket prefix to someplace we can use
|
||||
socket_conf = "/etc/httpd/conf.d/wsgi_socket_prefix.conf"
|
||||
wsgi_socket_loc = self.log_dir
|
||||
wsgi_socket_loc = sh.joinpths(self.log_dir, "wsgi-socket")
|
||||
fc = "WSGISocketPrefix %s" % (wsgi_socket_loc)
|
||||
sh.write_file(socket_conf, fc)
|
||||
#now write a file that changes the apache user and group ran with
|
||||
user_conf = "/etc/httpd/conf.d/httpd_run_user.conf"
|
||||
fc = '''
|
||||
User {user}
|
||||
Group {group}
|
||||
'''
|
||||
sh.write_file(user_conf, fc.format(user=user, group=group))
|
||||
#now adjust the run user and group
|
||||
cmd = ['perl', '-p', '-i', '-e', "'s/^User.*/User " + user + "/g'", '/etc/httpd/conf/httpd.conf']
|
||||
sh.execute(*cmd, run_as_root=True)
|
||||
cmd = ['perl', '-p', '-i', '-e', "'s/^Group.*/Group " + group + "/g'", '/etc/httpd/conf/httpd.conf']
|
||||
sh.execute(*cmd, run_as_root=True)
|
||||
finally:
|
||||
sh.user_mode()
|
||||
|
||||
|
@ -496,12 +496,15 @@ def got_root():
|
||||
|
||||
def root_mode():
|
||||
uid_gid = (getuid(ROOT_USER), getgid(ROOT_USER))
|
||||
try:
|
||||
LOG.debug("Escalating permissions to (user=%s, group=%s)" % (uid_gid[0], uid_gid[1]))
|
||||
os.setreuid(0, uid_gid[0])
|
||||
os.setregid(0, uid_gid[1])
|
||||
except:
|
||||
LOG.warn("Cannot escalate permissions to (user=%s, group=%s)" % (uid_gid[0], uid_gid[1]))
|
||||
if uid_gid[0] is None or uid_gid[1] is None:
|
||||
LOG.warn("Cannot escalate permissions to (user=%s) - does that user exist??" % (ROOT_USER))
|
||||
else:
|
||||
try:
|
||||
LOG.debug("Escalating permissions to (user=%s, group=%s)" % (uid_gid[0], uid_gid[1]))
|
||||
os.setreuid(0, uid_gid[0])
|
||||
os.setregid(0, uid_gid[1])
|
||||
except:
|
||||
LOG.warn("Cannot escalate permissions to (user=%s, group=%s)" % (uid_gid[0], uid_gid[1]))
|
||||
|
||||
|
||||
def user_mode():
|
||||
@ -513,6 +516,8 @@ def user_mode():
|
||||
os.setreuid(0, int(sudo_uid))
|
||||
except OSError:
|
||||
LOG.warn("Cannot drop permissions to (user=%s, group=%s)" % (sudo_uid, sudo_gid))
|
||||
else:
|
||||
LOG.warn("Can not switch to user mode, no suid user id or group id")
|
||||
|
||||
|
||||
def geteuid():
|
||||
|
Loading…
x
Reference in New Issue
Block a user