Child pages
  • Scripting handwork rg. PostgreSQL bug CVE-2017-7547

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: snippet finetuning

...

Overall (several variants, read before execution)

No Format
# download
cd /tmp
#sudo apt-get install ca-certificates
wget https://download.clazzes.org/pg_fix_usermappings/pg_fix_usermappings.sh \
  -O /tmp/pg_fix_usermappings.sh


# make it executable, for user postgres
chmod ugo+rx /tmp/pg_fix_usermappings.sh

# it's safe to call the script without any parameters ...
/tmp/pg_fix_usermappings.sh

# think about version
ls -ld /etc/postgresql/*
dpkg -l |egrep " postgresql-9.[0-9] "

# execute for 9.6 as non root logging the output
export MYPGVER=9.6
( sudo sudo -u postgres /tmp/pg_fix_usermappings.sh 9.6${MYPGVER} ) \
  2>&1 |tee /var/tmp/pg_fix_usermappings_9.6.${MYPGVER}.log

# after success maybe document
sudo mv -v /tmp/pg_fix_usermappings.sh /var/tmp/pg_fix_usermappings*.log /var/log/postgresql/

...