Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
taste-setup
Commits
a3fbb0b4
Commit
a3fbb0b4
authored
Aug 01, 2017
by
Thanassis Tsiodras
Browse files
Tell PostgreSQL to trust local connections.
parent
a4c38f42
Changes
1
Hide whitespace changes
Inline
Side-by-side
install/65_postgres.sh
View file @
a3fbb0b4
#!/bin/bash
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
else
echo
'[-] Good, found config file under '
"
${
CONF_FILE
}
"
fi
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
}
"
else
echo
'[-] All good, already set as such.'
fi
echo
"[-] Checking whether a local postgres DB install has a 'taste' user..."
echo
| psql
-U
taste postgres 2>/dev/null
if
[
$?
-ne
0
]
;
then
...
...
@@ -10,7 +26,7 @@ if [ $? -ne 0 ] ; then
exit
1
fi
else
echo
'[-] Already there.'
echo
'[-]
Already there.'
fi
PGPASS
=
"
$HOME
/.pgpass"
LINE
=
'127.0.0.1:5432:*:postgres:tastevm'
...
...
@@ -21,5 +37,6 @@ if ! grep "${LINE/*/\\*}" "$PGPASS" >/dev/null 2>&1 ; then
LINE
=
'localhost:5432:*:postgres:tastevm'
echo
"
$LINE
"
>>
"
$PGPASS
"
else
echo
'[-] Already
the
re.'
echo
'[-]
Already
sto
re
d
.'
fi
chmod
600
"
${
PGPASS
}
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment