All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 2/2] package/postgresql: enable data checksums by default for initdb
@ 2019-11-21 10:15 Pascal de Bruijn
  2019-11-25  9:22 ` Peter Seiderer
  0 siblings, 1 reply; 2+ messages in thread
From: Pascal de Bruijn @ 2019-11-21 10:15 UTC (permalink / raw)
  To: buildroot

From: Pascal de Bruijn <pmjdebruijn@pcode.nl>

This makes PostgreSQL as robust as possible by default

Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
---
 package/postgresql/S50postgresql      | 2 +-
 package/postgresql/postgresql.service | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/postgresql/S50postgresql b/package/postgresql/S50postgresql
index 3c0c520..ce72e12 100644
--- a/package/postgresql/S50postgresql
+++ b/package/postgresql/S50postgresql
@@ -7,7 +7,7 @@ umask 077
 
 if [ ! -f /var/lib/pgsql/PG_VERSION ]; then
 	echo "Initializing postgresql data base..."
-	su - postgres -c '/usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8'
+	su - postgres -c '/usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8 -o --data-checksums'
 	echo "done"
 fi
 
diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
index 4bbe742..2f5d2a9 100644
--- a/package/postgresql/postgresql.service
+++ b/package/postgresql/postgresql.service
@@ -17,7 +17,7 @@ StandardError=syslog
 SyslogIdentifier=postgres
 PIDFile=/var/lib/pgsql/postmaster.pid
 
-ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8; fi"
+ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8 -o --data-checksums; fi"
 ExecStart=/usr/bin/postgres -D /var/lib/pgsql
 ExecReload=/usr/bin/kill -HUP $MAINPID
 KillMode=mixed
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH 2/2] package/postgresql: enable data checksums by default for initdb
  2019-11-21 10:15 [Buildroot] [PATCH 2/2] package/postgresql: enable data checksums by default for initdb Pascal de Bruijn
@ 2019-11-25  9:22 ` Peter Seiderer
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Seiderer @ 2019-11-25  9:22 UTC (permalink / raw)
  To: buildroot

Hello Pascal,

On Thu, 21 Nov 2019 11:15:52 +0100, Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> From: Pascal de Bruijn <pmjdebruijn@pcode.nl>
>
> This makes PostgreSQL as robust as possible by default
>
> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> ---
>  package/postgresql/S50postgresql      | 2 +-
>  package/postgresql/postgresql.service | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/postgresql/S50postgresql b/package/postgresql/S50postgresql
> index 3c0c520..ce72e12 100644
> --- a/package/postgresql/S50postgresql
> +++ b/package/postgresql/S50postgresql
> @@ -7,7 +7,7 @@ umask 077
>
>  if [ ! -f /var/lib/pgsql/PG_VERSION ]; then
>  	echo "Initializing postgresql data base..."
> -	su - postgres -c '/usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8'
> +	su - postgres -c '/usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8 -o --data-checksums'

Thanks for the patch, but I believe buildroot is about providing a very
basic/minimum setup as starting point customized projects and the
postgresql documentation states ([1]):

	 Enabling checksums may incur a noticeable performance penalty.

And I think not everyone (specially for embedded projects) will accept this
performance vs. data security tradeoff..., same applies to your
locale/en_US.UTF-8 suggestion (not everyone will be happy/use en_US and I
hope no one will run a non-customized production project)...

Regards,
Peter

[1] https://www.postgresql.org/docs/12/app-initdb.html

>  	echo "done"
>  fi
>
> diff --git a/package/postgresql/postgresql.service b/package/postgresql/postgresql.service
> index 4bbe742..2f5d2a9 100644
> --- a/package/postgresql/postgresql.service
> +++ b/package/postgresql/postgresql.service
> @@ -17,7 +17,7 @@ StandardError=syslog
>  SyslogIdentifier=postgres
>  PIDFile=/var/lib/pgsql/postmaster.pid
>
> -ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8; fi"
> +ExecStartPre=/bin/sh -c "if [ ! -f /var/lib/pgsql/PG_VERSION ]; then /usr/bin/pg_ctl initdb -D /var/lib/pgsql -o --locale=en_US.UTF-8 -o --data-checksums; fi"
>  ExecStart=/usr/bin/postgres -D /var/lib/pgsql
>  ExecReload=/usr/bin/kill -HUP $MAINPID
>  KillMode=mixed

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-25  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 10:15 [Buildroot] [PATCH 2/2] package/postgresql: enable data checksums by default for initdb Pascal de Bruijn
2019-11-25  9:22 ` Peter Seiderer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.