From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6FD12138202 for ; Sat, 3 Aug 2013 13:24:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EDFC3E0A7E; Sat, 3 Aug 2013 13:24:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 76541E0A7E for ; Sat, 3 Aug 2013 13:24:23 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 56F4033EC1E for ; Sat, 3 Aug 2013 13:24:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id DE136E5459 for ; Sat, 3 Aug 2013 13:24:20 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1375535979.a0eaa253b2950ecd1a88db3b3a3b298b03498e4c.blueness@gentoo> Subject: [gentoo-commits] proj/webapp-config:master commit in: WebappConfig/, doc/ X-VCS-Repository: proj/webapp-config X-VCS-Files: WebappConfig/config.py WebappConfig/server.py doc/webapp-config.5.xml X-VCS-Directories: WebappConfig/ doc/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: a0eaa253b2950ecd1a88db3b3a3b298b03498e4c X-VCS-Branch: master Date: Sat, 3 Aug 2013 13:24:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e017e9fe-4b79-4c3a-a4a3-aba010b0edb0 X-Archives-Hash: 150c64eba28e9f798751f4994f322d47 commit: a0eaa253b2950ecd1a88db3b3a3b298b03498e4c Author: Vincent Brillault lerya net> AuthorDate: Sat Aug 3 13:08:42 2013 +0000 Commit: Anthony G. Basile gentoo org> CommitDate: Sat Aug 3 13:19:39 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=a0eaa253 WebappConfig/{config.py,server.py}: set server uid/gid in the config X-Gentoo-Bug: 432908 X-Gentoo-Bug-URL: https://bugs.gentoo.org/432908 --- WebappConfig/config.py | 36 ++++++++++++++++++++++++++++++------ WebappConfig/server.py | 20 +++++++++++--------- doc/webapp-config.5.xml | 20 ++++++++++++++++++++ 3 files changed, 61 insertions(+), 15 deletions(-) diff --git a/WebappConfig/config.py b/WebappConfig/config.py index 04fb6f2..bf55d1e 100644 --- a/WebappConfig/config.py +++ b/WebappConfig/config.py @@ -708,6 +708,18 @@ class Config: ' variable "' + user + "'") return result + def maybe_get_user(self, user): + result = None + input_user = self.maybe_get(user) + if not input_user: + return result + try: + result = Perm.get_user(input_user) + except KeyError: + OUT.die('You specified an invalid user value for the' + ' variable "' + user + "'") + return result + def get_group(self, group): result = None try: @@ -717,6 +729,18 @@ class Config: ' variable "' + group + "'") return result + def maybe_get_group(self, group): + result = None + input_group = self.maybe_get(group) + if not input_group: + return result + try: + result = Perm.get_group(input_group) + except KeyError: + OUT.die('You specified an invalid group value for the' + ' variable "' + group + "'") + return result + def installdir(self): return self.maybe_get('g_installdir') @@ -1514,27 +1538,27 @@ class Config: self.get_group('vhost_default_gid'), self.get_perm('vhost_perms_virtualowned_file')], # These will be re-set by the servers - 'server-owned' : [None, - None, + 'server-owned' : [self.maybe_get_user('vhost_server_uid'), + self.maybe_get_group('vhost_server_gid'), self.get_perm('vhost_perms_serverowned_file')], 'config-owned' : [self.get_user('vhost_config_uid'), self.get_group('vhost_config_gid'), self.get_perm('vhost_perms_configowned_file')], 'config-server-owned' : [self.get_user('vhost_config_uid'), - None, + self.maybe_get_group('vhost_server_gid'), self.get_perm('vhost_perms_serverowned_file')],}, 'dir' : {'default-owned' :[self.get_user('vhost_default_uid'), self.get_group('vhost_default_gid'), self.get_perm('vhost_perms_defaultowned_dir')], # These will be re-set by the servers - 'server-owned' : [None, - None, + 'server-owned' : [self.maybe_get_user('vhost_server_uid'), + self.maybe_get_group('vhost_server_gid'), self.get_perm('vhost_perms_serverowned_dir')], 'config-owned' : [self.get_user('vhost_config_uid'), self.get_group('vhost_config_gid'), self.get_perm('vhost_perms_configowned_dir')], 'config-server-owned' : [self.get_user('vhost_config_uid'), - None, + self.maybe_get_group('vhost_server_gid'), self.get_perm('vhost_perms_serverowned_dir')], 'install-owned': [self.get_user('vhost_default_uid'), self.get_group('vhost_default_gid'), diff --git a/WebappConfig/server.py b/WebappConfig/server.py index f67ecdb..a2b8e3f 100644 --- a/WebappConfig/server.py +++ b/WebappConfig/server.py @@ -67,15 +67,17 @@ class Basic: self.__vhostroot = directories['vhostroot'] # + server owned - permissions['file']['server-owned'][0] = self.vhost_server_uid - permissions['file']['server-owned'][1] = self.vhost_server_gid - permissions['dir']['server-owned'][0] = self.vhost_server_uid - permissions['dir']['server-owned'][1] = self.vhost_server_gid - # and config owned directories have server gid - permissions['dir']['config-owned'][1] = self.vhost_server_gid - # allows server and config owned - permissions['file']['config-server-owned'][1] = self.vhost_server_gid - permissions['dir']['config-server-owned'][1] = self.vhost_server_gid + if permissions['file']['server-owned'][0] == 0: + permissions['file']['server-owned'][0] = self.vhost_server_uid + permissions['dir']['server-owned'][0] = self.vhost_server_uid + if permissions['file']['server-owned'][1] == 0: + permissions['file']['server-owned'][1] = self.vhost_server_gid + permissions['dir']['server-owned'][1] = self.vhost_server_gid + # and config owned directories have server gid + permissions['dir']['config-owned'][1] = self.vhost_server_gid + # allows server and config owned + permissions['file']['config-server-owned'][1] = self.vhost_server_gid + permissions['dir']['config-server-owned'][1] = self.vhost_server_gid self.__perm = permissions self.__handler = handler diff --git a/doc/webapp-config.5.xml b/doc/webapp-config.5.xml index 49de978..f7fdab4 100644 --- a/doc/webapp-config.5.xml +++ b/doc/webapp-config.5.xml @@ -118,6 +118,26 @@ + vhost_server_uid + + Overiding parameter for the server-dependant hardcoded uid which specifies the user to own all files and directories that are server-owned. + Warning: webapp-config's switch does not overide this parameter. + By default, this is disabled. + This can be either the name of a user or their numerical user id. + + + + + vhost_server_gid + + Overiding parameter for the server-dependant hardcoded gid which specifies the group to own all files and directories that are server-owned. + Warning: webapp-config's switch does not overide this parameter. + By default, this is disabled. + This can be either the name of a group or their numerical group id. + + + + vhost_config_uid Default value when webapp-config's switch hasn't been used.