Commit 6ef32542 authored by Tom Lane's avatar Tom Lane

Document risks of "make check" in the regression testing instructions.

Since the temporary server started by "make check" uses "trust"
authentication, another user on the same machine could connect to it
as database superuser, and then potentially exploit the privileges of
the operating-system user who started the tests.  We should change
the testing procedures to prevent this risk; but discussion is required
about the best way to do that, as well as more testing than is practical
for an undisclosed security problem.  Besides, the same issue probably
affects some user-written test harnesses.  So for the moment, we'll just
warn people against using "make check" when there are untrusted users on
the same machine.

In passing, remove some ancient advice that suggested making the
regression testing subtree world-writable if you'd built as root.
That looks dangerously insecure in modern contexts, and anyway we
should not be encouraging people to build Postgres as root.

Security: CVE-2014-0067
parent 01824385
...@@ -56,25 +56,31 @@ make check ...@@ -56,25 +56,31 @@ make check
<quote>failure</> represents a serious problem. <quote>failure</> represents a serious problem.
</para> </para>
<warning>
<para> <para>
Because this test method runs a temporary server, it will not work This test method starts a temporary server, which is configured to accept
when you are the root user (since the server will not start as root). any connection originating on the local machine. Any local user can gain
If you already did the build as root, you do not have to start all database superuser privileges when connecting to this server, and could
over. Instead, make the regression test directory writable by in principle exploit all privileges of the operating-system user running
some other user, log in as that user, and restart the tests. the tests. Therefore, it is not recommended that you use <literal>make
For example: check</> on machines shared with untrusted users. Instead, run the tests
<screen> after completing the installation, as described in the next section.
<prompt>root# </prompt><userinput>chmod -R a+w src/test/regress</userinput> </para>
<prompt>root# </prompt><userinput>su - joeuser</userinput>
<prompt>joeuser$ </prompt><userinput>cd <replaceable>top-level build directory</></userinput> <para>
<prompt>joeuser$ </prompt><userinput>make check</userinput> On Unix-like machines, this danger can be avoided if the temporary
</screen> server's socket file is made inaccessible to other users, for example
(The only possible <quote>security risk</quote> here is that other by running the tests in a protected chroot. On Windows, the temporary
users might be able to alter the regression test results behind server opens a locally-accessible TCP socket, so filesystem protections
your back. Use common sense when managing user permissions.) cannot help.
</para> </para>
</warning>
<para> <para>
Alternatively, run the tests after installation. Because this test method runs a temporary server, it will not work
if you did the build as the root user, since the server will not start as
root. Recommended procedure is not to do the build as root, or else to
perform testing after completing the installation.
</para> </para>
<para> <para>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment