Commit a3fbb0b4 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

Tell PostgreSQL to trust local connections.

parent a4c38f42
echo "[-] Checking for a local PostgreSQL installation..."
CONF_FILE=$(/bin/ls /etc/postgresql/*/main/pg_hba.conf 2>/dev/null | head -1)
if [ -z "${CONF_FILE}" ] ; then
echo '[x] No pg_hba.conf file under /etc/postgresql/*/main/ ... Aborting.'
exit 1
echo '[-] Good, found config file under '"${CONF_FILE}"
echo "[-] Checking whether local connections to PostgreSQL are trusted..."
if ! sudo grep '^local.*trust$' "${CONF_FILE}" >/dev/null 2>&1 ; then
echo "[-] Setting local connections to PostgreSQL as trusted..."
echo "local all all trust" | \
sudo tee -a "${CONF_FILE}"
echo '[-] All good, already set as such.'
echo "[-] Checking whether a local postgres DB install has a 'taste' user..."
echo | psql -U taste postgres 2>/dev/null
if [ $? -ne 0 ] ; then
......@@ -21,5 +37,6 @@ if ! grep "${LINE/*/\\*}" "$PGPASS" >/dev/null 2>&1 ; then
echo "$LINE" >> "$PGPASS"
echo '[-] Already there.'
echo '[-] Already stored.'
chmod 600 "${PGPASS}"
Supports Markdown
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