SlideShare a Scribd company logo
Security Best Practices for
your Postgres Deployment
Presented by
Sameer Kumar, DB Solution Architect, Ashnik
“By default PostgreSQL is Possibly the most
security – aware database available…”
- Database Hacker’s Handbook
pgDayAsia2016,Singapore
• Security Model
• Security Features in Postgres
• Securing the access
• Avoiding common attacks
• Access Control and Securing data
• Logging and Auditing
• Patching – OS and PostgreSQL
Agenda
2
pgDayAsia2016,Singapore
• A random Oracle-DB2 DBA who started working on PostgreSQL
• And found it absolutely great
• Works for Ashnik Pte Ltd – Open Source Solutions and consulting
• Who also works on noSQL databases
• Hobbies – Cycling and Photography
3
About Me
Postgres Security
pgDayAsia2016,Singapore
Secure access is a two step process:
• Authentication
• Ensures a user is who he/she claims to be
• Authorization
• Ensures an authenticated user has access to only the data for which
he/she has been granted the appropriate privileges.
Security Model: Authentication and Authorization
5
pgDayAsia2016,Singapore
• Object level privileges assigned to roles and users
• Virtual Private Database- Row level security
• Kerberos and LDAP authentication
• Host base authentication
• SSL communication
• Data Level Encryption (AES, 3DES, etc)
• Ability to utilize 3rd party Key Stores in a full PKI Infrastructure
• Foundation for full compliance with the strictest of security
standards (PCI Data Security Standard)
• Flexible field level encryption and row level security
High Level Features
6
pgDayAsia2016,Singapore
• Kerberos : Kerberos based encrypted "ticket" for authentication
• Password : md5 and plain text
• LDAP authentication : It uses LDAP as the password verification
method
• Trust : Authentication without password or Auth token
• RADIUS: Use radius server for authentication
Different Authentication Methods
7
Securing Postgres
pgDayAsia2016,Singapore
• Override the default port of Postgres
• Use a non-default name for the superuser
• Can be specified during “initdb”
• While initializing the cluster with “initdb” use -A to specify
authentication mode
• By default each new DB has connect privilege granted to public
• revoke connect on my_new_db from public;
• grant connect on my_new_db to my_app_user;
Override the defaults
9
pgDayAsia2016,Singapore
• Use listen_addresses to control where you Database is listening for
connections
• Make sure that you don’t listen on public network interface
• Control who can connect from where
• Use pg_hba.conf to control which user can connect to specific databases from
specific IP addresses
• Avoid using general rules e.g. Database name “all” or IP Address range –
“0.0.0.0/0”
• Restrict superuser access
• Allow superuser to make connections only from the localhost/unix domain
• Avoid using “trust” authentication
• Effectively use “reject”
• reject the connections from blacklist/exception IP addresses/users
Secure the access
10
pgDayAsia2016,Singapore
• Use different users for different purpose
• A separate user for owning application database and schema
• Use a different user for making DB connection from application
• Allow DBAs to use their personal users (e.g. DBA Sameer uses a
user “sameer”)
• Use a different (non-superuser) user for physical backup and
replication
• Allow replication connection using specific user from specific hosts
• Use a different user for logical backup
Separating users as per their role
11
pgDayAsia2016,Singapore
• Password hacks are vulnerable to
• Weak passwords
• Re-use of old passwords
• Brute-force password attack
• These attacks can be avoided by
• Maintaining strong passwords or enforcing password policy
• Enforce password expiry and reuse policy
• Enforce account lock policy on consecutive authentication failures
• These can be enforced with external authentication methods e.g. LDAP,
PAM etc
Avoid Password Hacks
12
pgDayAsia2016,Singapore
• Control the number connections
• max_connection
• superuser_reserved_slots
• max_replication_slots
• max_wal_senders
• Don’t use a superuser as an application user
• For multi-user/multi-DB server set DB or user level limit
• Set temp_file_limit to control the disk usage per session for sorting
• Log long running queries
• Monitor transactions and sessions
• long running transactions
• sessions with “idle in transaction state”
• Use connection timeout
Avoid Denial of Service Attack – Set limits
13
pgDayAsia2016,Singapore
• Set per statement/sessions parameters wisely
• work_mem
• maintenance_work_mem
• temp_buffers
• max_prepared_transactions
• Some of these parameters can be set at user, db or session level
• Set them at appropriate granularity
Avoid Denial of Service Attack – Parameter
granularity
14
pgDayAsia2016,Singapore
• Typically network attacks
• Eavesdropping
• Protection against Man-in-the-middle
• Impersonation
• Postgres clients send query in plain-text format
• Data is sent is not encrypted
• Use SSL connection to encrypt client/server communication
• sslmode – prefer is not secure
• sslmode – require – data is encrypted but still exposed to impersonation and
Man-in-the-middle
• Use sslmode verify-ca or verify-full in client connection to avoid all THREE
• SSL usage must be configured on both client and sever
Avoid Network Spoofing
15
pgDayAsia2016,Singapore
• Control which users have access to what
• Use GRANT and REVOKE to control access to
• DATABASE
• TABLESPACE
• SCHEMA
• OBJECTS
• Use row level security to restrict access to specific rows for specific
users
Access Control
16
pgDayAsia2016,Singapore
• Use pg_crypto or application API for encryption/decryption
• Encrypt personal and profile data e.g. Credit Card information
• Key Maintenance
• Use an intermediate key store
• Use a hardware for key/token generation on client end
• Hash the sensitive data e.g. password, pin etc
• Matches are always done using hash of input criteria
• Use disk level or file system level encryption
Securing Data
17
pgDayAsia2016,Singapore
• Enable logging and auditing to ensure all events are logged
• logging_collector must be on
• log_destination
• log_directory
• Avoid overwriting log files
• Set log_truncate_on_rotation to off
• PostgreSQL does not have separate Audit handlers
• pg_audit
• EDB Audit
Logging and Auditing – Avoid pitfalls
18
pgDayAsia2016,Singapore
• Log important events
• Connections and Disconnections, Long running operations, Replication
commands
• Log Resource usages
• Checkpoints, Temp Files
• Control information being logged
• Statements, Hostname, Application Name
• log_line_prefix – Application Name, Hostname, DB Name, User Name etc
• PostgreSQL does not have separate Audit handlers
• pg_audit
• EDB Audit
• Triggers and Event Triggers
Logging and Auditing – Log to Track
19
pgDayAsia2016,Singapore
Avoid Vulnerabilities – Timely Patching
• Keep a tab on latest vulnerabilities announced by various
organizations
• Ensure that your whole stack is timely patched
• A bug or security vulnerability in OS or one of the libraries can lead
to a leak in DB as well
• Ensure you apply OS and library patches
• Ensure you apply patches released by Postgres community/your
vendor
20
pgDayAsia2016,Singapore
- Achieving PCI Compliance with PostgreSQL
- IBM Developer Work Article on Total Security in PostgreSQL
- Bruce Momjian’s PPT
- PostgreSQL Hardening – By OpenSGC
Further Resources
21
Twitter - @sameerkasi200x | @ashnikbiz
Email - sameer.kumar@ashnik.com | success@ashnik.com
LinkedIn - https://www.linkedin.com/in/samkumar150288
We are hiring!

More Related Content

PDF
PostgreSQL and RAM usage
PDF
Linux cgroups and namespaces
PDF
Vacuum in PostgreSQL
PDF
Patroni: Kubernetes-native PostgreSQL companion
ODP
PostgreSQL Administration for System Administrators
PPTX
Achieving High Availability in PostgreSQL
PDF
Desmistificando Replicação no PostgreSQL
PDF
Patroni - HA PostgreSQL made easy
PostgreSQL and RAM usage
Linux cgroups and namespaces
Vacuum in PostgreSQL
Patroni: Kubernetes-native PostgreSQL companion
PostgreSQL Administration for System Administrators
Achieving High Availability in PostgreSQL
Desmistificando Replicação no PostgreSQL
Patroni - HA PostgreSQL made easy

What's hot (20)

PPTX
FreeIPA - Attacking the Active Directory of Linux
PDF
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
PDF
Presto Summit 2018 - 09 - Netflix Iceberg
PDF
High Availability PostgreSQL with Zalando Patroni
PDF
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
PDF
PostgreSQL Performance Tuning
PDF
Deep dive into PostgreSQL statistics.
PDF
Oracle Multitenant meets Oracle RAC - IOUG 2014 Version
PDF
Stream Processing 과 Confluent Cloud 시작하기
PPTX
Running MariaDB in multiple data centers
PDF
2019.06.27 Intro to Ceph
PDF
Kernel Recipes 2019 - Faster IO through io_uring
PDF
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PDF
PostgreSQL Extensions: A deeper look
PDF
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
PDF
Postgresql database administration volume 1
ODP
OpenGurukul : Database : PostgreSQL
PDF
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdf
PDF
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
PPTX
Getting started with postgresql
FreeIPA - Attacking the Active Directory of Linux
[pgday.Seoul 2022] 서비스개편시 PostgreSQL 도입기 - 진소린 & 김태정
Presto Summit 2018 - 09 - Netflix Iceberg
High Availability PostgreSQL with Zalando Patroni
Best Practices for the Most Impactful Oracle Database 18c and 19c Features
PostgreSQL Performance Tuning
Deep dive into PostgreSQL statistics.
Oracle Multitenant meets Oracle RAC - IOUG 2014 Version
Stream Processing 과 Confluent Cloud 시작하기
Running MariaDB in multiple data centers
2019.06.27 Intro to Ceph
Kernel Recipes 2019 - Faster IO through io_uring
PGConf APAC 2018 - Managing replication clusters with repmgr, Barman and PgBo...
PostgreSQL Extensions: A deeper look
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
Postgresql database administration volume 1
OpenGurukul : Database : PostgreSQL
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdf
[OpenStack Days Korea 2016] Track1 - 카카오는 오픈스택 기반으로 어떻게 5000VM을 운영하고 있을까?
Getting started with postgresql
Ad

Viewers also liked (9)

PDF
Researching postgresql
PDF
PostgreSQL Conference: West 08
PDF
5 Tips to Simplify the Management of Your Postgres Database
 
PPTX
Enterprise grade deployment and security with PostgreSQL
PDF
PostgreSQL Portland Performance Practice Project - Database Test 2 Filesystem...
PDF
24/7 Monitoring and Alerting of PostgreSQL
PDF
Pitr Made Easy
PDF
Managing Postgres with Ansible
PPTX
PGDay India 2016
Researching postgresql
PostgreSQL Conference: West 08
5 Tips to Simplify the Management of Your Postgres Database
 
Enterprise grade deployment and security with PostgreSQL
PostgreSQL Portland Performance Practice Project - Database Test 2 Filesystem...
24/7 Monitoring and Alerting of PostgreSQL
Pitr Made Easy
Managing Postgres with Ansible
PGDay India 2016
Ad

Similar to Security Best Practices for your Postgres Deployment (20)

PPTX
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
PPTX
Enterprise-class security with PostgreSQL - 1
PPTX
PGEncryption_Tutorial
PPTX
Soccnx10: Best and worst practices deploying IBM Connections
PPTX
Going outside the application
PPT
005.itsecurity bcp v1
PDF
MySQL Security
PDF
Presentation database security enhancements with oracle
PDF
(ATS6-PLAT07) Managing AEP in an enterprise environment
PPTX
Securing Your MongoDB Deployment
PDF
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
PDF
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
PPTX
Best And Worst Practices Deploying IBM Connections
PDF
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
PDF
PostgreSQL High Availability in a Containerized World
PPTX
Securing Windows with Group Policy
PDF
be the captain of your connections deployment
PDF
PPTX
The Spy Who Loathed Me - An Intro to SQL Server Security
ODP
CISSP Week 13
Security of Oracle EBS - How I can Protect my System (UKOUG APPS 18 edition)
Enterprise-class security with PostgreSQL - 1
PGEncryption_Tutorial
Soccnx10: Best and worst practices deploying IBM Connections
Going outside the application
005.itsecurity bcp v1
MySQL Security
Presentation database security enhancements with oracle
(ATS6-PLAT07) Managing AEP in an enterprise environment
Securing Your MongoDB Deployment
KoprowskiT_SQLRelayCaerdydd_SQLSecurityInTheClouds
KoprowskiT_SQLRelayBirmingham_SQLSecurityInTheClouds
Best And Worst Practices Deploying IBM Connections
SQLSaturday 664 - Troubleshoot SQL Server performance problems like a Microso...
PostgreSQL High Availability in a Containerized World
Securing Windows with Group Policy
be the captain of your connections deployment
The Spy Who Loathed Me - An Intro to SQL Server Security
CISSP Week 13

More from PGConf APAC (20)

PDF
PGConf APAC 2018: Sponsored Talk by Fujitsu - The growing mandatory requireme...
PDF
PGConf APAC 2018: PostgreSQL 10 - Replication goes Logical
PDF
PGConf APAC 2018 - Lightening Talk #3: How To Contribute to PostgreSQL
PDF
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
PDF
Sponsored Talk @ PGConf APAC 2018 - Choosing the right partner in your Postgr...
PDF
PGConf APAC 2018 - A PostgreSQL DBAs Toolbelt for 2018
PDF
PGConf APAC 2018 - Patroni: Kubernetes-native PostgreSQL companion
PDF
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PDF
PGConf APAC 2018 - Monitoring PostgreSQL at Scale
PDF
PGConf APAC 2018 - Where's Waldo - Text Search and Pattern in PostgreSQL
PDF
PGConf APAC 2018 - PostgreSQL HA with Pgpool-II and whats been happening in P...
PDF
PGConf APAC 2018 - PostgreSQL performance comparison in various clouds
PDF
Sponsored Talk @ PGConf APAC 2018 - Migrating Oracle to EDB Postgres Approach...
PDF
PGConf APAC 2018 - Tale from Trenches
PDF
PGConf APAC 2018 Keynote: PostgreSQL goes eleven
PDF
Amazon (AWS) Aurora
PDF
Use Case: PostGIS and Agribotics
PDF
How to teach an elephant to rock'n'roll
PDF
PostgreSQL on Amazon RDS
PDF
PostgreSQL WAL for DBAs
PGConf APAC 2018: Sponsored Talk by Fujitsu - The growing mandatory requireme...
PGConf APAC 2018: PostgreSQL 10 - Replication goes Logical
PGConf APAC 2018 - Lightening Talk #3: How To Contribute to PostgreSQL
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
Sponsored Talk @ PGConf APAC 2018 - Choosing the right partner in your Postgr...
PGConf APAC 2018 - A PostgreSQL DBAs Toolbelt for 2018
PGConf APAC 2018 - Patroni: Kubernetes-native PostgreSQL companion
PGConf APAC 2018 - High performance json postgre-sql vs. mongodb
PGConf APAC 2018 - Monitoring PostgreSQL at Scale
PGConf APAC 2018 - Where's Waldo - Text Search and Pattern in PostgreSQL
PGConf APAC 2018 - PostgreSQL HA with Pgpool-II and whats been happening in P...
PGConf APAC 2018 - PostgreSQL performance comparison in various clouds
Sponsored Talk @ PGConf APAC 2018 - Migrating Oracle to EDB Postgres Approach...
PGConf APAC 2018 - Tale from Trenches
PGConf APAC 2018 Keynote: PostgreSQL goes eleven
Amazon (AWS) Aurora
Use Case: PostGIS and Agribotics
How to teach an elephant to rock'n'roll
PostgreSQL on Amazon RDS
PostgreSQL WAL for DBAs

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Cloud computing and distributed systems.
PPTX
Big Data Technologies - Introduction.pptx
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Transforming Manufacturing operations through Intelligent Integrations
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Cloud computing and distributed systems.
Big Data Technologies - Introduction.pptx
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
NewMind AI Weekly Chronicles - August'25 Week I
Transforming Manufacturing operations through Intelligent Integrations
20250228 LYD VKU AI Blended-Learning.pptx
Empathic Computing: Creating Shared Understanding
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Sensors and Actuators in IoT Systems using pdf
NewMind AI Monthly Chronicles - July 2025
Per capita expenditure prediction using model stacking based on satellite ima...
Understanding_Digital_Forensics_Presentation.pptx

Security Best Practices for your Postgres Deployment

  • 1. Security Best Practices for your Postgres Deployment Presented by Sameer Kumar, DB Solution Architect, Ashnik “By default PostgreSQL is Possibly the most security – aware database available…” - Database Hacker’s Handbook
  • 2. pgDayAsia2016,Singapore • Security Model • Security Features in Postgres • Securing the access • Avoiding common attacks • Access Control and Securing data • Logging and Auditing • Patching – OS and PostgreSQL Agenda 2
  • 3. pgDayAsia2016,Singapore • A random Oracle-DB2 DBA who started working on PostgreSQL • And found it absolutely great • Works for Ashnik Pte Ltd – Open Source Solutions and consulting • Who also works on noSQL databases • Hobbies – Cycling and Photography 3 About Me
  • 5. pgDayAsia2016,Singapore Secure access is a two step process: • Authentication • Ensures a user is who he/she claims to be • Authorization • Ensures an authenticated user has access to only the data for which he/she has been granted the appropriate privileges. Security Model: Authentication and Authorization 5
  • 6. pgDayAsia2016,Singapore • Object level privileges assigned to roles and users • Virtual Private Database- Row level security • Kerberos and LDAP authentication • Host base authentication • SSL communication • Data Level Encryption (AES, 3DES, etc) • Ability to utilize 3rd party Key Stores in a full PKI Infrastructure • Foundation for full compliance with the strictest of security standards (PCI Data Security Standard) • Flexible field level encryption and row level security High Level Features 6
  • 7. pgDayAsia2016,Singapore • Kerberos : Kerberos based encrypted "ticket" for authentication • Password : md5 and plain text • LDAP authentication : It uses LDAP as the password verification method • Trust : Authentication without password or Auth token • RADIUS: Use radius server for authentication Different Authentication Methods 7
  • 9. pgDayAsia2016,Singapore • Override the default port of Postgres • Use a non-default name for the superuser • Can be specified during “initdb” • While initializing the cluster with “initdb” use -A to specify authentication mode • By default each new DB has connect privilege granted to public • revoke connect on my_new_db from public; • grant connect on my_new_db to my_app_user; Override the defaults 9
  • 10. pgDayAsia2016,Singapore • Use listen_addresses to control where you Database is listening for connections • Make sure that you don’t listen on public network interface • Control who can connect from where • Use pg_hba.conf to control which user can connect to specific databases from specific IP addresses • Avoid using general rules e.g. Database name “all” or IP Address range – “0.0.0.0/0” • Restrict superuser access • Allow superuser to make connections only from the localhost/unix domain • Avoid using “trust” authentication • Effectively use “reject” • reject the connections from blacklist/exception IP addresses/users Secure the access 10
  • 11. pgDayAsia2016,Singapore • Use different users for different purpose • A separate user for owning application database and schema • Use a different user for making DB connection from application • Allow DBAs to use their personal users (e.g. DBA Sameer uses a user “sameer”) • Use a different (non-superuser) user for physical backup and replication • Allow replication connection using specific user from specific hosts • Use a different user for logical backup Separating users as per their role 11
  • 12. pgDayAsia2016,Singapore • Password hacks are vulnerable to • Weak passwords • Re-use of old passwords • Brute-force password attack • These attacks can be avoided by • Maintaining strong passwords or enforcing password policy • Enforce password expiry and reuse policy • Enforce account lock policy on consecutive authentication failures • These can be enforced with external authentication methods e.g. LDAP, PAM etc Avoid Password Hacks 12
  • 13. pgDayAsia2016,Singapore • Control the number connections • max_connection • superuser_reserved_slots • max_replication_slots • max_wal_senders • Don’t use a superuser as an application user • For multi-user/multi-DB server set DB or user level limit • Set temp_file_limit to control the disk usage per session for sorting • Log long running queries • Monitor transactions and sessions • long running transactions • sessions with “idle in transaction state” • Use connection timeout Avoid Denial of Service Attack – Set limits 13
  • 14. pgDayAsia2016,Singapore • Set per statement/sessions parameters wisely • work_mem • maintenance_work_mem • temp_buffers • max_prepared_transactions • Some of these parameters can be set at user, db or session level • Set them at appropriate granularity Avoid Denial of Service Attack – Parameter granularity 14
  • 15. pgDayAsia2016,Singapore • Typically network attacks • Eavesdropping • Protection against Man-in-the-middle • Impersonation • Postgres clients send query in plain-text format • Data is sent is not encrypted • Use SSL connection to encrypt client/server communication • sslmode – prefer is not secure • sslmode – require – data is encrypted but still exposed to impersonation and Man-in-the-middle • Use sslmode verify-ca or verify-full in client connection to avoid all THREE • SSL usage must be configured on both client and sever Avoid Network Spoofing 15
  • 16. pgDayAsia2016,Singapore • Control which users have access to what • Use GRANT and REVOKE to control access to • DATABASE • TABLESPACE • SCHEMA • OBJECTS • Use row level security to restrict access to specific rows for specific users Access Control 16
  • 17. pgDayAsia2016,Singapore • Use pg_crypto or application API for encryption/decryption • Encrypt personal and profile data e.g. Credit Card information • Key Maintenance • Use an intermediate key store • Use a hardware for key/token generation on client end • Hash the sensitive data e.g. password, pin etc • Matches are always done using hash of input criteria • Use disk level or file system level encryption Securing Data 17
  • 18. pgDayAsia2016,Singapore • Enable logging and auditing to ensure all events are logged • logging_collector must be on • log_destination • log_directory • Avoid overwriting log files • Set log_truncate_on_rotation to off • PostgreSQL does not have separate Audit handlers • pg_audit • EDB Audit Logging and Auditing – Avoid pitfalls 18
  • 19. pgDayAsia2016,Singapore • Log important events • Connections and Disconnections, Long running operations, Replication commands • Log Resource usages • Checkpoints, Temp Files • Control information being logged • Statements, Hostname, Application Name • log_line_prefix – Application Name, Hostname, DB Name, User Name etc • PostgreSQL does not have separate Audit handlers • pg_audit • EDB Audit • Triggers and Event Triggers Logging and Auditing – Log to Track 19
  • 20. pgDayAsia2016,Singapore Avoid Vulnerabilities – Timely Patching • Keep a tab on latest vulnerabilities announced by various organizations • Ensure that your whole stack is timely patched • A bug or security vulnerability in OS or one of the libraries can lead to a leak in DB as well • Ensure you apply OS and library patches • Ensure you apply patches released by Postgres community/your vendor 20
  • 21. pgDayAsia2016,Singapore - Achieving PCI Compliance with PostgreSQL - IBM Developer Work Article on Total Security in PostgreSQL - Bruce Momjian’s PPT - PostgreSQL Hardening – By OpenSGC Further Resources 21
  • 22. Twitter - @sameerkasi200x | @ashnikbiz Email - [email protected] | [email protected] LinkedIn - https://www.linkedin.com/in/samkumar150288 We are hiring!