addsite: Give lighttpd more permissions on logs.
[matthijs/servers/drsnuggles.git] / usr / local / bin / addsite
index 9ef8ae46876253e7881b007541091e35d4df3897..7d318071d47456bfb88fa4573de04c2a630f1916 100755 (executable)
@@ -19,8 +19,8 @@ HTTPD_USERS_GID=1002
 # The template to copy
 TEMPLATE_DIR=/data/www/template
 # The bases to create users under
-USERBASE="ou=Httpd Users,ou=Users,dc=drsnuggles,dc=stderr,dc=nl"
-GROUPBASE="ou=Domain Groups,ou=Groups,dc=drsnuggles,dc=stderr,dc=nl"
+USERBASE="uniqueIdentifier=7,uniqueIdentifier=6,dc=drsnuggles,dc=stderr,dc=nl"
+GROUPBASE="uniqueIdentifier=4,uniqueIdentifier=8,dc=drsnuggles,dc=stderr,dc=nl"
 # PHP config to change the error_log setting in
 PHP_CONFIG=conf/php.ini.override
 # PHP error logfile to set error_log to
@@ -68,17 +68,20 @@ else
        ldapvi --profile bind --add --in --ldapvi <<EOF || exit
 add cn=$GROUP,$GROUPBASE
 cn: $GROUP
+displayName: $SITE
 gidNumber: $ID
-objectClass: posixGroup
+objectClass: simplePosixGroup
+objectClass: simpleGroup
 objectClass: top
 
-add cn=$SITE,$USERBASE
-cn: $SITE
+add cn=$SCRIPT_USER,$USERBASE
+cn: $SCRIPT_USER
+displayName: $SITE
 uidNumber: $ID
 gidNumber: $HTTPD_USERS_GID
 homeDirectory: $DIR
 objectClass: posixAccount
-objectClass: account
+objectClass: simpleObject
 objectClass: top
 uid: $SCRIPT_USER
 EOF
@@ -107,8 +110,8 @@ sudo setfacl -m u:$HTTPD_USER:rx "$DIR"
 # Allow lighttpd to read anything in htdocs, applications, conf and data
 sudo setfacl -R -m d:u:$HTTPD_USER:rX,u:$HTTPD_USER:rX "$DIR/htdocs" "$DIR/applications" "$DIR/conf" "$DIR/data"
 
-# Allow lighttpd to write new files in logs (but not touch existing or those created by lighttpd)
-sudo setfacl -m u:$HTTPD_USER:rwX "$DIR/logs"
+# Allow lighttpd to write new files in logs
+sudo setfacl -m d:u:$HTTPD_USER:rwX,u:$HTTPD_USER:rwX "$DIR/logs"
 
 # Give scripts read access to the dir itself
 sudo setfacl -m u:$SCRIPT_USER:rx "$DIR"