summaryrefslogtreecommitdiffstats
path: root/ipaplatform/base
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2016-08-16 09:03:19 -0400
committerJan Cholasta <jcholast@redhat.com>2017-02-15 07:13:37 +0100
commit4fd89833ee5421b05c10329d627d0e0fc8496046 (patch)
treef6b6eb3492859af483d3e9542253f0894ca11043 /ipaplatform/base
parentc2b1b2a36200b50babfda1eca37fb4b51fefa9c6 (diff)
downloadfreeipa-4fd89833ee5421b05c10329d627d0e0fc8496046.tar.gz
freeipa-4fd89833ee5421b05c10329d627d0e0fc8496046.tar.xz
freeipa-4fd89833ee5421b05c10329d627d0e0fc8496046.zip
Add a new user to run the framework code
Add the apache user the ipawebui group. Make the ccaches directory owned by the ipawebui group and make mod_auth_gssapi write the ccache files as r/w by the apache user and the ipawebui group. Fix tmpfiles creation ownership and permissions to allow the user to access ccaches files. The webui framework now works as a separate user than apache, so the certs used to access the dogtag instance need to be usable by this new user as well. Both apache and the webui user are in the ipawebui group, so use that. https://fedorahosted.org/freeipa/ticket/5959 Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaplatform/base')
-rw-r--r--ipaplatform/base/paths.py1
-rw-r--r--ipaplatform/base/tasks.py15
2 files changed, 15 insertions, 1 deletions
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index b8cd5ca5e..8db9e61f5 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -203,6 +203,7 @@ class BasePathNamespace(object):
DNSSEC_KEYFROMLABEL = "/usr/sbin/dnssec-keyfromlabel-pkcs11"
GETSEBOOL = "/usr/sbin/getsebool"
GROUPADD = "/usr/sbin/groupadd"
+ USERMOD = "/usr/sbin/usermod"
HTTPD = "/usr/sbin/httpd"
IPA_CLIENT_INSTALL = "/usr/sbin/ipa-client-install"
IPA_DNS_INSTALL = "/usr/sbin/ipa-dns-install"
diff --git a/ipaplatform/base/tasks.py b/ipaplatform/base/tasks.py
index 49b87613f..5806e7504 100644
--- a/ipaplatform/base/tasks.py
+++ b/ipaplatform/base/tasks.py
@@ -181,7 +181,9 @@ class BaseTaskNamespace(object):
raise NotImplementedError()
- def create_system_user(self, name, group, homedir, shell, uid=None, gid=None, comment=None, create_homedir=False):
+ def create_system_user(self, name, group, homedir, shell,
+ uid=None, gid=None, comment=None,
+ create_homedir=False, groups=None):
"""Create a system user with a corresponding group"""
try:
grp.getgrnam(group)
@@ -218,6 +220,8 @@ class BaseTaskNamespace(object):
args += ['-m']
else:
args += ['-M']
+ if groups is not None:
+ args += ['-G', groups.join(',')]
try:
ipautil.run(args)
log.debug('Done adding user')
@@ -261,3 +265,12 @@ class BaseTaskNamespace(object):
def is_fips_enabled(self):
return False
+
+ def add_user_to_group(self, user, group):
+ log.debug('Adding user %s to group %s', user, group)
+ args = [paths.USERMOD, '-a', '-G', group, user]
+ try:
+ ipautil.run(args)
+ log.debug('Done adding user to group')
+ except ipautil.CalledProcessError as e:
+ log.debug('Failed to add user to group: %s', e)