Skip to content

Commit 8b7c947

Browse files
committed
Feat: Add Postgres-13/14/15
Signed-off-by: Mahdi Fooladgar (professormahi) <professormahi_f@yahoo.com>
1 parent fcfe9c6 commit 8b7c947

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

roles/postgres_hardening/defaults/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ log_disconnections: "on"
2121
log_duration: "on"
2222
log_hostname: "on"
2323
log_directory: pg_log
24-
log_line_prefix: "%t %u %d %h"
24+
log_line_prefix: "%t %u %d %h"

roles/postgres_hardening/tasks/hardening.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@
8787
group: "{{ postgres_group }}"
8888
mode: u=rw,g=r,o=
8989

90-
- name: Manage permissions on /etc/postgresql/<version>/main/pg_hba.conf
91-
ansible.builtin.file:
92-
path: "/etc/postgresql/{{ postgres_version }}/main/pg_hba.conf"
93-
state: file
94-
owner: "{{ postgres_user }}"
95-
group: "{{ postgres_group }}"
96-
mode: u=rw,g=,o=
97-
9890
#################################
9991
# POSTGRES-11/12/16 #############
10092
#################################
@@ -125,6 +117,18 @@
125117
regexp: "#?log_line_prefix\\s?="
126118
notify: Restart postgres
127119

120+
#################################
121+
# POSTGRES-13/14/15 #############
122+
#################################
123+
- name: Secure pg_hba.conf Configuration
124+
ansible.builtin.template:
125+
src: templates/pg_hba.conf
126+
dest: /etc/postgresql/{{ postgres_version }}/main/pg_hba.conf
127+
owner: "{{ postgres_user }}"
128+
group: "{{ postgres_group }}"
129+
mode: u=rw,g=,o=
130+
notify: Restart postgres
131+
128132
#################################
129133
# POSTGRES-20 ###################
130134
#################################
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
local all postgres peer
2+
local all all peer
3+
hostssl all all 127.0.0.1/32 scram-sha-256
4+
hostssl all all ::1/128 scram-sha-256
5+
local replication all peer

0 commit comments

Comments
 (0)