[packages/postgresql] Rel 2. init: peer/scram-sha-256 auth, hba.d and conf.d includes

arekm arekm at pld-linux.org
Mon Nov 9 15:07:45 CET 2026


commit cee55038b182a1461b18e82fc4e4bad04affc598
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon Nov 9 14:42:20 2026 +0100

    Rel 2. init: peer/scram-sha-256 auth, hba.d and conf.d includes
    
    initdb without -A left trust on the socket, 127.0.0.1 and ::1.

 postgresql.init | 10 +++++++++-
 postgresql.spec |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/postgresql.spec b/postgresql.spec
index c4fe26a..18bbf1e 100644
--- a/postgresql.spec
+++ b/postgresql.spec
@@ -41,7 +41,7 @@ Summary(uk.UTF-8):	PostgreSQL - система керування базами 
 Summary(zh_CN.UTF-8):	PostgreSQL 客户端程序和库文件
 Name:		postgresql
 Version:	%{mver}.6
-Release:	1
+Release:	2
 License:	BSD
 Group:		Applications/Databases
 Source0:	https://ftp.postgresql.org/pub/source/v%{version}/%{name}-%{version}.tar.bz2
diff --git a/postgresql.init b/postgresql.init
index 6aeca49..2cca0c7 100644
--- a/postgresql.init
+++ b/postgresql.init
@@ -250,9 +250,17 @@ case "$action" in
 			mkdir -p $pgdir
 			chmod 700 $pgdir
 			chown postgres:postgres $pgdir
-			LC_ALL=$PG_INIT_LOCALE TMPDIR=/tmp su postgres -s /bin/sh -c "initdb -E UNICODE --data-checksums -D $pgdir"
+			if LC_ALL=$PG_INIT_LOCALE TMPDIR=/tmp su postgres -s /bin/sh -c "initdb -E UNICODE --data-checksums --auth-local=peer --auth-host=scram-sha-256 -D $pgdir" &&
+			   install -d -o postgres -g postgres -m 700 $pgdir/hba.d $pgdir/conf.d; then
+				# includes go last: the first matching hba line wins, so local and localhost stay as initdb set them
+				echo "include_dir hba.d" >> $pgdir/pg_hba.conf
+				echo "include_dir = 'conf.d'" >> $pgdir/postgresql.conf
+			else
+				RETVAL=1
+			fi
 		fi
 	done
+	echo $(nls "Connect as database superuser with: %s" "su postgres -c psql")
 	echo $(nls "REMEMBER to setup password for user \"postgres\"")'!'
 	;;
   *)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/postgresql.git/commitdiff/cee55038b182a1461b18e82fc4e4bad04affc598



More information about the pld-cvs-commit mailing list