Skip to content
Snippets Groups Projects
Commit 0b83c1f2 authored by Tom Lane's avatar Tom Lane
Browse files

Prevent pg_ctl from being run as root. Since it uses configuration files

owned by postgres, doing "pg_ctl start" as root could allow a privilege
escalation attack, as pointed out by iDEFENSE.  Of course the postmaster would
fail, but we ought to fail a little sooner to protect sysadmins unfamiliar
with Postgres.  The chosen fix is to disable root use of pg_ctl in all cases,
just to be confident there are no other holes.
parent d9c1e5e1
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# #
# #
# IDENTIFICATION # IDENTIFICATION
# $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.30 2002/10/18 22:05:35 petere Exp $ # $Header: /cvsroot/pgsql/src/bin/pg_ctl/Attic/pg_ctl.sh,v 1.30.2.1 2004/10/22 00:24:33 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -110,6 +110,14 @@ fi ...@@ -110,6 +110,14 @@ fi
po_path="$PGPATH/postmaster" po_path="$PGPATH/postmaster"
if [ `$PGPATH/pg_id -u` -eq 0 ]
then
echo "$CMDNAME: cannot be run as root" 1>&2
echo "Please log in (using, e.g., \"su\") as the (unprivileged) user that will" 1>&2
echo "own the server process." 1>&2
exit 1
fi
wait= wait=
wait_seconds=60 wait_seconds=60
logfile= logfile=
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment