SlideShare ist ein Scribd-Unternehmen logo
1 von 50
Securing Data in Postgres
Payal Singh
@pallureshu
OmniTI Computer Consulting
https://omniti.com 1
Agenda
Host Based Authentication
Access Control Lists
Row-Level Security
SSL/TLS
Auditing
Encryption
PCI Compliance
Upcoming Features in pg10
Desired Features
2
Host Based Authentication
3
HBA
Host Based Authentication
4
HBA
Reloading authentication changes - pg_reload_conf()
5
HBA
Monitoring authentication - tail_n_mail
[1] (from line 262,856)
2017-05-30 17:35:39 EDT [[local]] [13667]: [2-1] user=marion,db=postgres,
e=28P01 FATAL: password authentication failed for user "marion" e=28P01
DETAIL: Connection matched pg_hba.conf line 18: "local all all md5"
6
HBA
Password file - .pgpass in $HOME
postgres@thinkpad ~ $ whoami
postgres
postgres@thinkpad ~ $ pwd
/home/postgres
postgres@thinkpad~ $ ls -l .pgpass
-rw------- 1 postgres postgres 29 Jul 9 11:23 .pgpass
postgres@thinkpad ~ $ cat .pgpass
*:*:*:postgres:HuyYheDAfqVq7
7
Access Control Lists
8
ACL
Access Control List
“list of permissions attached to an object. An ACL specifies which users or system processes are granted access to
objects, as well as what operations are allowed on given objects.”
GRANT - define access privileges
REVOKE - revoke access privileges
https://www.postgresql.org/docs/current/static/sql-grant.html
9
ACL
10
ACL
ACL commands are transactional in Postgres:
11
ACL
Not so much in MySQL:
12
ACL
Passwords In MySQL:
Passwords In Postgres:
13
ACL
SHOW GRANTS in MySQL
14
ACL
Roles and role membership
A role has privileges of all roles it is a member of
15
ACL
SET DEFAULT PRIVILEGES
ALTER DEFAULT PRIVILEGES IN SCHEMA <schema_name> GRANT <privilege> ON TABLES TO <role>;
Only applies to objects created in future
16
ACL
USAGE:
Roles must have usage on schema to access tables, functions
Usage on public schema granted by default to public role
Usage granted by default on all roles in MySQL
17
ACL - USAGE Example
18
Column Level ACLs
Grant privileges only on specific column(s)
NOTE: UPDATE privilege in practice requires SELECT as well
19
Row-Level Security
20
RLS
User-based or command-based row level access restrictions
Disabled by default
Exceptions - TRUNCATE, REFERENCES
Not a SQL Standard
Watch for performance improvements in pg10!
21
RLS
When enabled, all traffic goes through policies
22
RLS
Default Policy - all deny
23
RLS
Does not apply to table owner unless forced
BYPASSRLS attribute
24
RLS
In case of multiple policies, access is determined if any one or more of the policies
allow it (OR)
Referential integrity checks - covert channel leaks should be avoided
Race conditions - e.g. SELECT … FOR UPDATE
Solutions - SELECT … FOR SHARE; Exclusive locks on referenced
table
25
SSL/TLS
26
SSL/TLS
ssl = on # (change requires restart)
#ssl_ciphers = 'ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH' # allowed SSL ciphers
#ssl_prefer_server_ciphers = on # (change requires restart)
#ssl_ecdh_curve = 'prime256v1' # (change requires restart)
ssl_cert_file = '/etc/ssl/postgres/starry.io.crt' # (change requires restart)
ssl_key_file = '/etc/ssl/postgres/starry.io.key' # (change requires restart)
ssl_ca_file = '' # (change requires restart)
#ssl_crl_file = '' # (change requires restart)
27
SSL/TLS
Requirement: OpenSSL
At build time: --with-openssl
Authentication without encryption overhead: NULL-SHA or NULL-MD5
Not recommended: less secure
Overhead is minimal compared to authentication overhead
Certificate file permissions must be 600
Restart required for certs change
28
Event Triggers
29
Event Triggers
Database wide DDL event capture
Useful for:
Auditing
Unwanted modification of data
Accidental data loss
Trigger-based replication
http://tapoueh.org/images/confs/Fosdem2013_Event_Triggers.pdf
30
Event Triggers
31
Event Triggers
32
Event Triggers
Events:
ddl_command_start
ddl_command_end
sql_drop
table_rewrite in pg10!
33
Auditing
34
Auditing
Trigger based diff tracking
35
Auditing
Hstore - delta capture
36
Auditing
Delta function:
GIST and GIN index support for most operations
BTree and Hash index support useful for equivalence operations
37
Auditing
pgAudit extension
38
Auditing
PgAudit:
Shared_preload_libraries
Postgres development packages
Installation is a bit weird
39
Encryption and PCI Compliance
40
Encryption
pg_crypto extension - encrypts data
Encrypted backups
Postgres instance-level Encryption - 3rd party patch!
https://www.postgresql.org/message-
id/CA%2BCSw_tb3bk5i7if6inZFc3yyf%2B9HEVNTy51QFBoeUk7UE_V%3Dw@mail.gmail.com
http://www.cybertec.at/postgresql-instance-level-encryption/
SSL/TLS
41
PCI Compliance
pg_stat_statements extension
42
PCI Compliance
Monitors
43
PCI Compliance
Monitored queries:
44
PCI Compliance
pg_crypto
Key management
45
Upcoming Features in PG10
46
Upcoming
SSL - reload instead of a restart
SCRAM-SHA-256 authentication
Restrictive RLS Policies (AND)
New monitoring roles:
pg_monitor, pg_read_all_settings, pg_read_all_stats, and pg_stat_scan_tables
pg_hba_file_rules view
47
Desired Features
48
Desired
Data Redaction
Active Directory support
Oracle TDE - key management
http://www.oracle.com/technetwork/database/security/twp-transparent-data-encryption-bes-130696.pdf
SHOW GRANTS
49
Thank you!
Questions?
50
Twitter: @pallureshu
Email: payal@omniti.com

Weitere ähnliche Inhalte

Was ist angesagt?

PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_Tutorial
Vibhor Kumar
 
Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)
Tola LENG
 
Presentation netwok year 3
Presentation netwok year 3Presentation netwok year 3
Presentation netwok year 3
sroeurnsophai
 
Configuring cisco site to site ip sec vpn with dynamic ip endpoint cisco routers
Configuring cisco site to site ip sec vpn with dynamic ip endpoint cisco routersConfiguring cisco site to site ip sec vpn with dynamic ip endpoint cisco routers
Configuring cisco site to site ip sec vpn with dynamic ip endpoint cisco routers
phosika sithisane
 

Was ist angesagt? (19)

PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_Tutorial
 
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference ArchitectureMRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
MRA AMA Part 10: Kubernetes and the Microservices Reference Architecture
 
Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)Configure Proxy and Firewall (Iptables)
Configure Proxy and Firewall (Iptables)
 
What’s New in NGINX Plus R15?
What’s New in NGINX Plus R15?What’s New in NGINX Plus R15?
What’s New in NGINX Plus R15?
 
Open vpn server_linux
Open vpn server_linuxOpen vpn server_linux
Open vpn server_linux
 
Gns3moi
Gns3moiGns3moi
Gns3moi
 
Baking even more Clam(AV)s for Fun & Profit.
Baking even more Clam(AV)s for Fun & Profit.Baking even more Clam(AV)s for Fun & Profit.
Baking even more Clam(AV)s for Fun & Profit.
 
Introduction to HTTP/2
Introduction to HTTP/2Introduction to HTTP/2
Introduction to HTTP/2
 
Certificate Management on pfSense 2.4 - pfSense Hangout September 2017
Certificate Management on pfSense 2.4 - pfSense Hangout September 2017Certificate Management on pfSense 2.4 - pfSense Hangout September 2017
Certificate Management on pfSense 2.4 - pfSense Hangout September 2017
 
Squid
SquidSquid
Squid
 
Local DNS with pfSense 2.4 - pfSense Hangout April 2018
Local DNS with pfSense 2.4 - pfSense Hangout April 2018Local DNS with pfSense 2.4 - pfSense Hangout April 2018
Local DNS with pfSense 2.4 - pfSense Hangout April 2018
 
Presentation netwok year 3
Presentation netwok year 3Presentation netwok year 3
Presentation netwok year 3
 
Proxy SQL 2.0 with PXC
Proxy SQL 2.0 with PXCProxy SQL 2.0 with PXC
Proxy SQL 2.0 with PXC
 
HTTPS @Scale
HTTPS @ScaleHTTPS @Scale
HTTPS @Scale
 
Configuring cisco site to site ip sec vpn with dynamic ip endpoint cisco routers
Configuring cisco site to site ip sec vpn with dynamic ip endpoint cisco routersConfiguring cisco site to site ip sec vpn with dynamic ip endpoint cisco routers
Configuring cisco site to site ip sec vpn with dynamic ip endpoint cisco routers
 
Configure Webserver & SSL secure & redirect in SuSE Linux Enterprise
Configure Webserver & SSL secure & redirect in SuSE Linux EnterpriseConfigure Webserver & SSL secure & redirect in SuSE Linux Enterprise
Configure Webserver & SSL secure & redirect in SuSE Linux Enterprise
 
Ad, dns, dhcp, file server
Ad, dns, dhcp, file serverAd, dns, dhcp, file server
Ad, dns, dhcp, file server
 
EvasionTechniques
EvasionTechniquesEvasionTechniques
EvasionTechniques
 
RADIUS and LDAP on pfSense 2.4 - pfSense Hangout February 2018
RADIUS and LDAP on pfSense 2.4 - pfSense Hangout February 2018RADIUS and LDAP on pfSense 2.4 - pfSense Hangout February 2018
RADIUS and LDAP on pfSense 2.4 - pfSense Hangout February 2018
 

Ähnlich wie postgres_data_security_2017

Packet Inspection on ASA
Packet Inspection on ASAPacket Inspection on ASA
Packet Inspection on ASA
Pratik Bhide
 
At8000 s configurando_aaa
At8000 s configurando_aaaAt8000 s configurando_aaa
At8000 s configurando_aaa
NetPlus
 

Ähnlich wie postgres_data_security_2017 (20)

How to Bulletproof Your Scylla Deployment
How to Bulletproof Your Scylla DeploymentHow to Bulletproof Your Scylla Deployment
How to Bulletproof Your Scylla Deployment
 
PostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
PostgresOpen 2013 A Comparison of PostgreSQL Encryption OptionsPostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
PostgresOpen 2013 A Comparison of PostgreSQL Encryption Options
 
Postgre sql unleashed
Postgre sql unleashedPostgre sql unleashed
Postgre sql unleashed
 
DockerCon Live 2020 - Securing Your Containerized Application with NGINX
DockerCon Live 2020 - Securing Your Containerized Application with NGINXDockerCon Live 2020 - Securing Your Containerized Application with NGINX
DockerCon Live 2020 - Securing Your Containerized Application with NGINX
 
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
How to Secure Your Scylla Deployment: Authorization, Encryption, LDAP Authent...
 
Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18Hashicorp Vault: Open Source Secrets Management at #OPEN18
Hashicorp Vault: Open Source Secrets Management at #OPEN18
 
Securing your MySQL / MariaDB Server data
Securing your MySQL / MariaDB Server dataSecuring your MySQL / MariaDB Server data
Securing your MySQL / MariaDB Server data
 
Using Vault to decouple MySQL Secrets
Using Vault to decouple MySQL SecretsUsing Vault to decouple MySQL Secrets
Using Vault to decouple MySQL Secrets
 
Postgresql 12 streaming replication hol
Postgresql 12 streaming replication holPostgresql 12 streaming replication hol
Postgresql 12 streaming replication hol
 
Packet Inspection on ASA
Packet Inspection on ASAPacket Inspection on ASA
Packet Inspection on ASA
 
Percona Live 2019 - MySQL Security
Percona Live 2019 - MySQL SecurityPercona Live 2019 - MySQL Security
Percona Live 2019 - MySQL Security
 
Securing PostgreSQL from External Attack
Securing PostgreSQL from External AttackSecuring PostgreSQL from External Attack
Securing PostgreSQL from External Attack
 
Enhancing MySQL Security
Enhancing MySQL SecurityEnhancing MySQL Security
Enhancing MySQL Security
 
PostgreSQL: Welcome To Total Security
PostgreSQL: Welcome To Total SecurityPostgreSQL: Welcome To Total Security
PostgreSQL: Welcome To Total Security
 
How to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScaleHow to Manage Scale-Out Environments with MariaDB MaxScale
How to Manage Scale-Out Environments with MariaDB MaxScale
 
Dynamic Database Credentials: Security Contingency Planning
Dynamic Database Credentials: Security Contingency PlanningDynamic Database Credentials: Security Contingency Planning
Dynamic Database Credentials: Security Contingency Planning
 
At8000 s configurando_aaa
At8000 s configurando_aaaAt8000 s configurando_aaa
At8000 s configurando_aaa
 
NGINX Plus R20 Webinar
NGINX Plus R20 WebinarNGINX Plus R20 Webinar
NGINX Plus R20 Webinar
 
Upgrade ipa to rhel 7
Upgrade ipa to rhel 7Upgrade ipa to rhel 7
Upgrade ipa to rhel 7
 
Hacking the swisscom modem
Hacking the swisscom modemHacking the swisscom modem
Hacking the swisscom modem
 

Kürzlich hochgeladen

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

postgres_data_security_2017