blob: 8ea648bde893567aa1c776aa925a8edeb14bdb1a [file] [log] [blame] [raw]
#!/bin/sh
set -e
case "$1" in
configure)
logdir="/var/log/nginx"
# Ensure secure permissions (CVE-2013-0337)
# http://bugs.debian.org/701112
#
# nginx uses 0755 for log files making them world readable,
# we fix that by using 0750 for the log directory.
#
# Allow local admin to override:
# e.g. dpkg-statoverride --add root adm 0755 /var/log/nginx
if ! dpkg-statoverride --list "$logdir" >/dev/null; then
chown www-data:adm $logdir
chmod 0750 $logdir
fi
# If a symlink doesn't exist and can be created, then create it.
if [ -z $2 ] && [ ! -e /etc/nginx/sites-enabled/default ] &&
[ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ]; then
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0