supported versions of our database system, including 11.5, 10.10,
9.6.15, 9.5.19, and 9.4.24, as well as the third beta of PostgreSQL 12.
This release fixes two security issues in the PostgreSQL server, two
security issues found in one of the PostgreSQL Windows installers, and
over 40 bugs reported since the previous release.
Users should install these updates as soon as possible.
A Note on the PostgreSQL 12 Beta
================================
In the spirit of the open source PostgreSQL community, we strongly
encourage you to test the new features of PostgreSQL 12 in your database
systems to help us eliminate any bugs or other issues that may exist.
While we do not advise you to run PostgreSQL 12 Beta 3 in your
production environments, we encourage you to find ways to run your
typical application workloads against this beta release.
Your testing and feedback will help the community ensure that the
PostgreSQL 12 release upholds our standards of providing a stable,
reliable release of the world's most advanced open source relational
database.
Security Issues
===============
Two security vulnerabilities have been closed by this release:
* CVE-2019-10208: `TYPE` in `pg_temp` executes arbitrary SQL during
`SECURITY DEFINER` execution
Versions Affected: 9.4 - 11
Given a suitable `SECURITY DEFINER` function, an attacker can execute
arbitrary SQL under the identity of the function owner. An attack
requires `EXECUTE` permission on the function, which must itself contain
a function call having inexact argument type match. For example,
`length('foo'::varchar)` and `length('foo')` are inexact, while
`length('foo'::text)` is exact. As part of exploiting this
vulnerability, the attacker uses `CREATE DOMAIN` to create a type in a
`pg_temp` schema. The attack pattern and fix are similar to that for
CVE-2007-2138.
Writing `SECURITY DEFINER` functions continues to require following the
considerations noted in the documentation:
https://www.postgresql.org/docs/devel/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY
The PostgreSQL project thanks Tom Lane for reporting this problem.
* CVE-2019-10209: Memory disclosure in cross-type comparison for hashed
subplan
Versions Affected: 11
In a database containing hypothetical, user-defined hash equality operators, an attacker could read arbitrary bytes of server memory. For an attack to become possible, a superuser would need to create unusual operators. It is possible for operators not purpose-crafted for attack to have the properties that enable an attack, but we are not aware of specific examples.
The PostgreSQL project thanks Andreas Seltenreich for reporting this problem.
117 lines
3.0 KiB
Bash
117 lines
3.0 KiB
Bash
#!/bin/sh
|
||
#
|
||
# $FreeBSD$
|
||
#
|
||
# Maintenance shell script to vacuum and backup database
|
||
# Put this in /usr/local/etc/periodic/daily, and it will be run
|
||
# every night
|
||
#
|
||
# Written by Palle Girgensohn <girgen@pingpong.net>
|
||
#
|
||
# In public domain, do what you like with it,
|
||
# and use it at your own risk... :)
|
||
#
|
||
|
||
# Define these variables in either /etc/periodic.conf or
|
||
# /etc/periodic.conf.local to override the default values.
|
||
#
|
||
# daily_pgsql_backup_enable="YES" # do backup of all databases
|
||
# daily_pgsql_backup_enable="foo bar db1 db2" # only do backup of a limited selection of databases
|
||
# daily_pgsql_vacuum_enable="YES" # do vacuum
|
||
|
||
# If there is a global system configuration file, suck it in.
|
||
#
|
||
if [ -r /etc/defaults/periodic.conf ]
|
||
then
|
||
. /etc/defaults/periodic.conf
|
||
source_periodic_confs
|
||
fi
|
||
|
||
: ${daily_pgsql_user:="%%PG_USER%%"}
|
||
: ${daily_pgsql_port:=5432}
|
||
: ${daily_pgsql_vacuum_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -qaz"}
|
||
: ${daily_pgsql_pgdump_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port} -bF c"}
|
||
: ${daily_pgsql_pgdumpall_globals_args:="-U ${daily_pgsql_user} -p ${daily_pgsql_port}"}
|
||
# backupdir is relative to ~pgsql home directory unless it begins with a slash:
|
||
: ${daily_pgsql_backupdir:="~${daily_pgsql_user}/backups"}
|
||
: ${daily_pgsql_savedays:="7"}
|
||
|
||
# allow '~´ in dir name
|
||
eval backupdir=${daily_pgsql_backupdir}
|
||
|
||
rc=0
|
||
|
||
pgsql_backup() {
|
||
# daily_pgsql_backupdir must be writeable by user %%PG_USER%%
|
||
# ~%%PG_USER%% is just that under normal circumstances,
|
||
# but this might not be where you want the backups...
|
||
if [ ! -d ${backupdir} ] ; then
|
||
echo Creating ${backupdir}
|
||
mkdir -m 700 ${backupdir}; chown ${daily_pgsql_user} ${backupdir}
|
||
fi
|
||
|
||
echo
|
||
echo "PostgreSQL backups"
|
||
|
||
# Protect the data
|
||
umask 077
|
||
rc=$?
|
||
now=`date "+%Y-%m-%dT%H:%M:%S"`
|
||
file=${daily_pgsql_backupdir}/pgglobals_${now}
|
||
su -l ${daily_pgsql_user} -c \
|
||
"umask 077; pg_dumpall -g ${daily_pgsql_pgdumpall_globals_args} | gzip -9 > ${file}.gz"
|
||
|
||
db=$1
|
||
while shift; do
|
||
echo -n " $db"
|
||
file=${backupdir}/pgdump_${db}_${now}
|
||
su -l ${daily_pgsql_user} -c "umask 077; pg_dump ${daily_pgsql_pgdump_args} -f ${file} ${db}"
|
||
[ $? -gt 0 ] && rc=3
|
||
db=$1
|
||
done
|
||
|
||
if [ $rc -gt 0 ]; then
|
||
echo
|
||
echo "Errors were reported during backup."
|
||
fi
|
||
|
||
# cleaning up old data
|
||
find ${backupdir} \( -name 'pgdump_*' -o -name 'pgglobals_*' -o -name '*.dat.gz' -o -name 'toc.dat' \) \
|
||
-a -mtime +${daily_pgsql_savedays} -delete
|
||
echo
|
||
}
|
||
|
||
case "$daily_pgsql_backup_enable" in
|
||
[Yy][Ee][Ss])
|
||
dbnames=`su -l ${daily_pgsql_user} -c "umask 077; psql -U ${daily_pgsql_user} -p ${daily_pgsql_port} -q -t -A -d template1 -c SELECT\ datname\ FROM\ pg_database\ WHERE\ datname!=\'template0\'"`
|
||
pgsql_backup $dbnames
|
||
;;
|
||
|
||
[Nn][Oo])
|
||
;;
|
||
|
||
"")
|
||
;;
|
||
|
||
*)
|
||
pgsql_backup $daily_pgsql_backup_enable
|
||
;;
|
||
esac
|
||
|
||
case "$daily_pgsql_vacuum_enable" in
|
||
[Yy][Ee][Ss])
|
||
|
||
echo
|
||
echo "PostgreSQL vacuum"
|
||
su -l ${daily_pgsql_user} -c "vacuumdb ${daily_pgsql_vacuum_args}"
|
||
if [ $? -gt 0 ]
|
||
then
|
||
echo
|
||
echo "Errors were reported during vacuum."
|
||
rc=3
|
||
fi
|
||
;;
|
||
esac
|
||
|
||
exit $rc
|