Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
postgresql-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PostgreSQL
postgresql-common
Commits
aa4829c8
Commit
aa4829c8
authored
5 years ago
by
Christoph Berg
Browse files
Options
Downloads
Patches
Plain Diff
pg_virtualenv: Write temporary password file before chowning the file.
parent
3217f4e9
No related branches found
No related tags found
No related merge requests found
Pipeline
#62100
passed
5 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/changelog
+1
-0
1 addition, 0 deletions
debian/changelog
pg_virtualenv
+9
-7
9 additions, 7 deletions
pg_virtualenv
with
10 additions
and
7 deletions
debian/changelog
+
1
−
0
View file @
aa4829c8
...
...
@@ -8,6 +8,7 @@ postgresql-common (204) UNRELEASED; urgency=medium
use-cases do not need the header files and compiler dependencies
installed.
* debian/supported-versions: Use PG11 on Bullseye.
* pg_virtualenv: Write temporary password file before chowning the file.
-- Christoph Berg <myon@debian.org> Mon, 15 Jul 2019 14:33:16 +0200
...
...
This diff is collapsed.
Click to expand it.
pg_virtualenv
+
9
−
7
View file @
aa4829c8
...
...
@@ -98,6 +98,13 @@ shift $(($OPTIND - 1))
# if no command is given, open a shell
[
"
${
1
:-}
"
]
||
set
--
${
SHELL
:-
/bin/sh
}
# generate a password
if
[
-x
/usr/bin/pwgen
]
;
then
export
PGPASSWORD
=
$(
pwgen 20 1
)
else
export
PGPASSWORD
=
$(
dd
if
=
/dev/urandom
bs
=
1k
count
=
1 2>/dev/null |
md5sum
- |
awk
'{ print $1 }'
)
fi
# we are not root
if
[
"
$(
id
-u
)
"
!=
0
]
;
then
NONROOT
=
1
...
...
@@ -121,6 +128,7 @@ if [ "${NONROOT:-}" ]; then
mkdir
"
$PGSYSCONFDIR
"
"
$WORKDIR
/log"
PWFILE
=
"
$PGSYSCONFDIR
/pwfile"
LOGDIR
=
"
$WORKDIR
/log"
echo
"
$PGPASSWORD
"
>
"
$PWFILE
"
cleanup
()
{
set
+e
...
...
@@ -150,6 +158,7 @@ else
export
PGUSER
=
"postgres"
PWFILE
=
$(
mktemp
-t
pgpassword.XXXXXX
)
echo
"
$PGPASSWORD
"
>
"
$PWFILE
"
# write password before chowning the file
chown
postgres:postgres
"
$PWFILE
"
cleanup
()
{
...
...
@@ -175,13 +184,6 @@ else
fi
# create postgres environments
if
[
-x
/usr/bin/pwgen
]
;
then
export
PGPASSWORD
=
$(
pwgen 20 1
)
else
export
PGPASSWORD
=
$(
dd
if
=
/dev/urandom
bs
=
1k
count
=
1 2>/dev/null |
md5sum
- |
awk
'{ print $1 }'
)
fi
echo
"
$PGPASSWORD
"
>
"
$PWFILE
"
for
v
in
$PG_VERSIONS
;
do
# create temporary cluster
# we chdir to / so programs don't throw "could not change directory to ..."
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment