summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/httpinstance.py
diff options
context:
space:
mode:
authorMartin Babinsky <mbabinsk@redhat.com>2016-11-03 17:43:33 +0100
committerJan Cholasta <jcholast@redhat.com>2016-11-11 12:17:25 +0100
commit81bf72dc350b9c7daab669aaa796e96aee6ecbb8 (patch)
tree8d3606de6168be72ca405e47662de42cddc3c6df /ipaserver/install/httpinstance.py
parent15f282cf2c4a5315aa3e259bd923718685d88245 (diff)
downloadfreeipa-81bf72dc350b9c7daab669aaa796e96aee6ecbb8.tar.gz
freeipa-81bf72dc350b9c7daab669aaa796e96aee6ecbb8.tar.xz
freeipa-81bf72dc350b9c7daab669aaa796e96aee6ecbb8.zip
Make service user name a class member of Service
This will aid further refactoring of service installers, since the user will be defined only once during parent class initialization. https://fedorahosted.org/freeipa/ticket/6392 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipaserver/install/httpinstance.py')
-rw-r--r--ipaserver/install/httpinstance.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index 71cdcdd05..2869116af 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -123,7 +123,8 @@ class HTTPInstance(service.Service):
super(HTTPInstance, self).__init__(
"httpd",
service_desc="the web interface",
- fstore=fstore)
+ fstore=fstore,
+ service_user=HTTPD_USER)
self.cert_nickname = cert_nickname
self.ca_is_configured = True
@@ -206,7 +207,7 @@ class HTTPInstance(service.Service):
installutils.create_keytab(paths.IPA_KEYTAB, self.principal)
self.move_service(self.principal)
- pent = pwd.getpwnam(HTTPD_USER)
+ pent = pwd.getpwnam(self.service_user)
os.chown(paths.IPA_KEYTAB, pent.pw_uid, pent.pw_gid)
def remove_httpd_ccache(self):
@@ -214,7 +215,8 @@ class HTTPInstance(service.Service):
# Make sure that empty env is passed to avoid passing KRB5CCNAME from
# current env
ipautil.run(
- [paths.KDESTROY, '-A'], runas=HTTPD_USER, raiseonerr=False, env={})
+ [paths.KDESTROY, '-A'], runas=self.service_user, raiseonerr=False,
+ env={})
def __configure_http(self):
self.update_httpd_service_ipa_conf()
@@ -326,7 +328,7 @@ class HTTPInstance(service.Service):
self.fix_cert_db_perms()
def fix_cert_db_perms(self):
- pent = pwd.getpwnam(constants.HTTPD_USER)
+ pent = pwd.getpwnam(self.service_user)
for filename in NSS_FILES:
nss_path = os.path.join(certs.NSS_DIR, filename)
@@ -527,7 +529,7 @@ class HTTPInstance(service.Service):
installutils.remove_keytab(paths.IPA_KEYTAB)
installutils.remove_ccache(ccache_path=paths.KRB5CC_HTTPD,
- run_as=HTTPD_USER)
+ run_as=self.service_user)
# Remove the configuration files we create
installutils.remove_file(paths.HTTPD_IPA_REWRITE_CONF)