aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2011-05-19 14:03:15 -0400
committerMagnus Hagander <magnus@hagander.net>2011-05-19 14:03:15 -0400
commita937b07121d8ab51ba6fb44618254ec13cdcdfa0 (patch)
treea7707a9c25562b4ef161e8e4f8186b5a2d33e6ca /src
parent74aaa2136d13d613ffcea3171781d2e0c65a2e10 (diff)
downloadpostgresql-a937b07121d8ab51ba6fb44618254ec13cdcdfa0.tar.gz
postgresql-a937b07121d8ab51ba6fb44618254ec13cdcdfa0.zip
Add example for replication in pg_hba.conf
Selena Deckelmann
Diffstat (limited to 'src')
-rw-r--r--src/backend/libpq/pg_hba.conf.sample8
-rw-r--r--src/bin/initdb/initdb.c5
2 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/libpq/pg_hba.conf.sample b/src/backend/libpq/pg_hba.conf.sample
index 0a90b68c100..c40696b6b50 100644
--- a/src/backend/libpq/pg_hba.conf.sample
+++ b/src/backend/libpq/pg_hba.conf.sample
@@ -22,7 +22,9 @@
# plain TCP/IP socket.
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
-# database name, or a comma-separated list thereof.
+# database name, or a comma-separated list thereof. The "all"
+# keyword does not match "replication". Access to replication
+# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof. In both the DATABASE and USER fields
@@ -80,3 +82,7 @@
host all all 127.0.0.1/32 @authmethod@
# IPv6 local connections:
host all all ::1/128 @authmethod@
+# Allow replication connections from localhost, by a user with the
+# replication privilege.
+# host replication @default_username@ 127.0.0.1/32 @authmethod@
+# host replication @default_username@ ::1/128 @authmethod@
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 56a396bdddc..4949af96572 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1086,6 +1086,11 @@ setup_config(void)
"@authcomment@",
strcmp(authmethod, "trust") ? "" : AUTHTRUST_WARNING);
+ /* Replace username for replication */
+ conflines = replace_token(conflines,
+ "@default_username@",
+ username);
+
snprintf(path, sizeof(path), "%s/pg_hba.conf", pg_data);
writefile(path, conflines);