summaryrefslogtreecommitdiff
path: root/contrib/start-scripts/osx/PostgreSQL
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2017-11-06 07:11:10 -0800
committerNoah Misch <noah@leadboat.com>2017-11-06 07:11:10 -0800
commitdfc015dcf46c1996bd7ed5866e9e045d258604b3 (patch)
treeac5e8c738afdebe6244b7cb17a2f510078b9c56e /contrib/start-scripts/osx/PostgreSQL
parent87b2ebd352c4afe1ded0841604b59a3afbae97d1 (diff)
start-scripts: switch to $PGUSER before opening $PGLOG.
By default, $PGUSER has permission to unlink $PGLOG. If $PGUSER replaces $PGLOG with a symbolic link, the server will corrupt the link-targeted file by appending log messages. Since these scripts open $PGLOG as root, the attack works regardless of target file ownership. "make install" does not install these scripts anywhere. Users having manually installed them in the past should repeat that process to acquire this fix. Most script users have $PGLOG writable to root only, located in $PGDATA. Just before updating one of these scripts, such users should rename $PGLOG to $PGLOG.old. The script will then recreate $PGLOG with proper ownership. Reviewed by Peter Eisentraut. Reported by Antoine Scemama. Security: CVE-2017-12172
Diffstat (limited to 'contrib/start-scripts/osx/PostgreSQL')
-rwxr-xr-xcontrib/start-scripts/osx/PostgreSQL8
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/start-scripts/osx/PostgreSQL b/contrib/start-scripts/osx/PostgreSQL
index 7ff1d0e377f..7ac12bb9e33 100755
--- a/contrib/start-scripts/osx/PostgreSQL
+++ b/contrib/start-scripts/osx/PostgreSQL
@@ -80,9 +80,9 @@ StartService () {
if [ "${POSTGRESQL:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting PostgreSQL database server"
if [ "${ROTATELOGS}" = "1" ]; then
- sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' &" 2>&1 | ${LOGUTIL} "${PGLOG}" ${ROTATESEC} &
+ sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' 2>&1 | ${LOGUTIL} \"${PGLOG}\" ${ROTATESEC} &"
else
- sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' &" >>"$PGLOG" 2>&1
+ sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' >>\"$PGLOG\" 2>&1 &"
fi
fi
}
@@ -99,9 +99,9 @@ RestartService () {
sudo -u $PGUSER sh -c "$PGCTL stop -D '${PGDATA}' -s"
# should match StartService:
if [ "${ROTATELOGS}" = "1" ]; then
- sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' &" 2>&1 | ${LOGUTIL} "${PGLOG}" ${ROTATESEC} &
+ sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' 2>&1 | ${LOGUTIL} \"${PGLOG}\" ${ROTATESEC} &"
else
- sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' &" >>"$PGLOG" 2>&1
+ sudo -u $PGUSER sh -c "${DAEMON} -D '${PGDATA}' >>\"$PGLOG\" 2>&1 &"
fi
else
StopService