aboutsummaryrefslogtreecommitdiffstats
path: root/main/postgresql/postgresql.pre-install
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2019-07-22 19:57:36 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2019-07-23 11:27:10 +0200
commit16f9f0de85fd8a19ed735cc87cb9844dd4b52ac6 (patch)
tree250ecf664123320c32a46562dba646c3f5bab277 /main/postgresql/postgresql.pre-install
parenteed389c20a1983f34afd744ce1a596cc0bd2db6e (diff)
downloadaports-16f9f0de85fd8a19ed735cc87cb9844dd4b52ac6.tar.bz2
aports-16f9f0de85fd8a19ed735cc87cb9844dd4b52ac6.tar.xz
main/postgresql: create postgres account
This change was made due to complains that /etc/passwd contains system accounts with login shells, postgres being one of them [0]. Setting the shell of the postgres account to /sbin/nologin was not deemed feasible as the official document suggests login in as the postgres user via su(1) [1]. Other Linux distribution (Debian, Gentoo, Arch) also create the account with a shell. Not creating the postgres account by default (via alpine-baselayout) and instead creating it on demand from the package was deemed a reasonable compromise. [0]: https://gitlab.alpinelinux.org/alpine/aports/issues/10579 [1]: https://wiki.postgresql.org/wiki/First_steps
Diffstat (limited to 'main/postgresql/postgresql.pre-install')
-rw-r--r--main/postgresql/postgresql.pre-install10
1 files changed, 10 insertions, 0 deletions
diff --git a/main/postgresql/postgresql.pre-install b/main/postgresql/postgresql.pre-install
new file mode 100644
index 0000000000..dd34706224
--- /dev/null
+++ b/main/postgresql/postgresql.pre-install
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Fixed GID/UID values as this users was previously included in the
+# default /etc/passwd as shipped by main/alpine-baselayout.
+
+addgroup -g 70 -S postgres 2>/dev/null
+adduser -u 70 -S -D -H -h /var/lib/postgresql -g "Postgres user" \
+ -s /bin/sh -G postgres postgres 2>/dev/null
+
+exit 0