From 78a9d4966ec997c0ce6e72eecfadaa53074369c3 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 5 May 2011 14:38:19 -0700 Subject: [PATCH] set the permissions properly for installer --- .../domainstatusnetworkinstaller.php | 18 +++++++++++++++++- scripts/setup.cfg.sample | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php b/plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php index c871c2328e..b2042abe94 100644 --- a/plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php +++ b/plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php @@ -212,7 +212,23 @@ class DomainStatusNetworkInstaller extends Installer foreach (array('AVATARBASE', 'BACKGROUNDBASE', 'FILEBASE') as $key) { $base = $config[$key]; - mkdir($base.'/'.$this->nickname, 0777, true); + $dirname = $base.'/'.$this->nickname; + + // Make sure our bits are set + $mask = umask(0); + mkdir($dirname, 0770, true); + umask($mask); + + // If you set the setuid bit on your base dirs this should be + // unnecessary, but just in case. You must be root for this + // to work. + + if (array_key_exists('WEBUSER', $config)) { + chown($dirname, $config['WEBUSER']); + } + if (array_key_exists('WEBGROUP', $config)) { + chgrp($dirname, $config['WEBGROUP']); + } } } diff --git a/scripts/setup.cfg.sample b/scripts/setup.cfg.sample index f247a3bcae..049cd3e859 100644 --- a/scripts/setup.cfg.sample +++ b/scripts/setup.cfg.sample @@ -16,3 +16,5 @@ export WILDCARD=example.net export MAILTEMPLATE=/etc/statusnet/newsite-mail.txt export MAILSUBJECT="Your new StatusNet site" export POSTINSTALL=/etc/statusnet/morestuff.sh +export WEBUSER=www-data +export WEBGROUP=www-data -- 2.39.5