Skip to content

Commit b7c2e0a

Browse files
committed
#15 Ansible: adding security updates & pgAudit
1 parent 63d368c commit b7c2e0a

File tree

5 files changed

+55
-11
lines changed

5 files changed

+55
-11
lines changed

Diff for: ansible/files/apt_periodic

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
APT::Periodic::Update-Package-Lists "1";
2+
APT::Periodic::Download-Upgradeable-Packages "1";
3+
APT::Periodic::AutocleanInterval "7";
4+
APT::Periodic::Unattended-Upgrade "1";

Diff for: ansible/playbook.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@
2929
file:
3030
path: /tmp/00-schema.sql
3131
state: absent
32-
33-
- name: Set up password for superadmin postgres
34-
become: yes
35-
become_user: postgres
36-
postgresql_user:
37-
name: postgres
38-
password: "{{ postgres_superadmin_password }}"
3932

33+
- name: Adjust APT update intervals
34+
copy:
35+
src: files/apt_periodic
36+
dest: /etc/apt/apt.conf.d/10periodic
37+
4038
- name: UFW - Allow SSH connections
4139
ufw:
4240
rule: allow

Diff for: ansible/tasks/setup-extensions.yml

+31
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,37 @@
4343
update_cache: yes
4444
cache_valid_time: 3600
4545

46+
- name: pgAudit - download & install dependencies
47+
apt:
48+
pkg:
49+
- postgresql-server-dev-12
50+
- libssl-dev
51+
- libkrb5-dev
52+
update_cache: yes
53+
install_recommends: no
54+
55+
- name: pgAudit - download latest release
56+
git:
57+
repo: https://github.com/pgaudit/pgaudit.git
58+
dest: /tmp/pgaudit
59+
become: yes
60+
61+
- name: pgAudit - build
62+
make:
63+
chdir: /tmp/pgaudit
64+
target: check
65+
params:
66+
USE_PGXS: 1
67+
become: yes
68+
69+
- name: pgAudit - install
70+
make:
71+
chdir: /tmp/pgaudit
72+
target: install
73+
params:
74+
USE_PGXS: 1
75+
become: yes
76+
4677
- name: plv8 - download & install dependencies
4778
apt:
4879
pkg:

Diff for: ansible/tasks/setup-system.yml

+7
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,18 @@
1313
apt:
1414
pkg:
1515
- ufw
16+
- fail2ban
17+
- unattended-upgrades
1618
- python3
1719
- python3-pip
1820
update_cache: yes
1921
cache_valid_time: 3600
2022

23+
- name: Adjust APT update intervals
24+
copy:
25+
src: files/apt_periodic
26+
dest: /etc/apt/apt.conf.d/10periodic
27+
2128
- name: Install psycopg2 to enable ansible postgreSQL features
2229
pip:
2330
name: psycopg2-binary

Diff for: ansible/vars.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ postgresql_ext_install_dev_headers: yes
1111
# Warning: Make sure the postgresql & postgis versions are compatible with one another
1212
postgresql_ext_postgis_version: 3
1313

14-
postgresql_shared_preload_libraries: [pg_stat_statements]
14+
postgresql_shared_preload_libraries: [pg_stat_statements, pgaudit]
1515

1616
postgresql_pg_hba_custom:
1717
- {type: "host", database: "all", user: "all", address: "0.0.0.0/0", method: "md5" }
1818

19-
postgres_superadmin_password: "a1b2c3d4e5f6g7"
20-
2119
pgtap_release: v1.1.0
22-
pgtap_release_checksum: sha1:cca57708e723de18735a723b774577dc52f6f31e
20+
pgtap_release_checksum: sha1:cca57708e723de18735a723b774577dc52f6f31e
21+
22+
postgresql_log_destination: "csvlog"
23+
postgresql_logging_collector: on
24+
postgresql_log_filename: "postgresql.log"
25+
postgresql_log_rotation_age: 0
26+
postgresql_log_rotation_size: 0

0 commit comments

Comments
 (0)