SlideShare a Scribd company logo
Copyright©2017 NTT Corp. All Rights Reserved.
PostgreSQL Security. How Do We Think?
Masanori Oyama @ooyamams1987
NTT OSS Center
1Copyright©2017 NTT Corp. All Rights Reserved.
Who am I?
Masanori Oyama / 大山 真実
twitter @ooyamams1987
Work
– PostgreSQL engineering support and consultation.
 Recently focus to database security.
– Extensive quality verification of PostgreSQL releases.
 Latest work: Parallel query evaluation.
pgconf.asia “What’s new in 9.6, by PostgreSQL contributor” by Masahiko Sawada
https://www.slideshare.net/masahikosawada98/whats-new-in-96-by-postgresql-contributor
Prev work
– Hadoop engineering support and consultation at NTT DATA Inc.
 I had managed a big Hadoop cluster (1000 node, 200PB!).
2Copyright©2017 NTT Corp. All Rights Reserved.
About NTT
• Who we are?
– NTT(Nippon Telegraph and Telephone Corporation)
– National flagship carrier in Japan
• What NTT OSS Center is doing?
– Promotes the adoption of OSS by the group companies
• Total support
– support desk, Introduction support, Product maintenance
• R&D
– developing OSS and related tools with the communities
– Deals with about 60 OSS products.
NTT group
subsidiary
about 900 companies
NTT
NTT OSS Center
3Copyright©2017 NTT Corp. All Rights Reserved.
Agenda
1. Introduction
2. Database Security Requirements
3. How to Apply to PostgreSQL
4Copyright©2017 NTT Corp. All Rights Reserved.
1. Introduction
5Copyright©2017 NTT Corp. All Rights Reserved.
The circumstances in Japan
• Japanese government aims to implement an action plan
for strengthening the security of credit card transactions
by 2020.
 Make business operators holding such information conform to the
PCI DSS.
 Multi-layered measures are introduced by retailers dealing with
EC transactions.
• Some our projects try to conform to PCI DSS.
ref: http://www.meti.go.jp/english/press/2016/0223_02.html
6Copyright©2017 NTT Corp. All Rights Reserved.
What is PCI DSS?
• PCI DSS (Payment Card Industry Data Security Standard)
is credit card industry security standard.
ref: https://www.pcisecuritystandards.org/pci_security/
7Copyright©2017 NTT Corp. All Rights Reserved.
What is PCI DSS?
• PCI DSS (Payment Card Industry Data Security Standard)
is credit card industry security standard.
ref: https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-2.pdf
8Copyright©2017 NTT Corp. All Rights Reserved.
2. Database Security Requirements
9Copyright©2017 NTT Corp. All Rights Reserved.
The requirements of PCI DSS related to database
Keep your Database Secure.
Data Encryption
and Key Management.
User Identification, Authentication,
Authorization, Identity management.
Audit.
10Copyright©2017 NTT Corp. All Rights Reserved.
The requirements of PCI DSS related to database
Keep your Database Secure.
Data Encryption
and Key Management.
User Identification, Authentication,
Authorization, Identity management.
Audit.
Keep your Database Secure.
11Copyright©2017 NTT Corp. All Rights Reserved.
i. Keep your Database Secure
PCI DSS Requirements 2 & 6 say
• Don’t use a default user account and password.
• Don’t use unnecessary modules, functions, protocols.
• Admin control accesses have to be encrypted.
• Use a latest software version.
These are not difficult.
Traditional (or basic) security practices are important!
12Copyright©2017 NTT Corp. All Rights Reserved.
The requirements of PCI DSS related to database
Keep your Database Secure.
Data Encryption
and Key Management.
User Identification, Authentication,
Authorization, Identity management.
Audit.
Data Encryption
and Key Management.
13Copyright©2017 NTT Corp. All Rights Reserved.
ii. Encryption and Key Management
PCI DSS Requirement 3 says
• PAN (Primary account number) must be unreadable or
encrypted.
unreadable
strong encryption
• One-way hashes
af1bcec2664906a9f587fb
• Truncation
XXXX XXXX XXXX 1234
• AES, TDES/TDEA, RSA
(see PCI DSS Glossary “Strong Cryptography”)
• With key-management
• Only valid user can decrypt
reversible
irreversible
PAN
14Copyright©2017 NTT Corp. All Rights Reserved.
ii. Encryption and Key Management
Encryption key-management Outline
• Two-tier encryption
 Data-encrypting key
 Key-encrypting keys
… … …
… … …
… … …
encrypt
decrypt
encrypt
decrypt
Database Server
Key-Store Server
• Replace in a
certain period
• Store separately • Restricted access
• Stored in the fewest locations
• Accesses to key are Audited
see Requirements 3.5, 3.6
15Copyright©2017 NTT Corp. All Rights Reserved.
The requirements of PCI DSS related to database
Keep your Database Secure.
Data Encryption
and Key Management.
User Identification, Authentication,
Authorization, Identity management.
User Identification, Authentication,
Authorization, Identity management.
16Copyright©2017 NTT Corp. All Rights Reserved.
iii. Identification, Authentication, Authorization, Identity management
PCI DSS requirements 7 & 8 say
Authorization
Provide just the minimum necessary
authority for application user,
database administrators,
database operators and so on.
Authentication
Password
(some password policy. See Requirement 8.2)
Token device
Biometrics
Identification
All users are identified
by user ID.
Identity management
(User ID life cycle control)
Delete, Lock out user ID,
Disconnect idle connection
(some management policy. See Requirement 8.1)
17Copyright©2017 NTT Corp. All Rights Reserved.
The requirements of PCI DSS related to database
Keep your Database Secure.
Data Encryption
and Key Management.
User Identification, Authentication,
Authorization, Identity management.
Audit.
18Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
PCI DSS Requirement 10 says
• These events must be audited.
# Requirement
10.2.1 Access to PANs
10.2.2 All operations of administrators
10.2.3 Access to audit logs
10.2.4 Invalid access
10.2.5 Operation about Identification, Authentication (DCL)
10.2.6 Change audit log setting and Stop to audit
10.2.7 DDL
19Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
PCI DSS Requirement 10 says
• Audit logs must output following information.
# Requirement
10.3.1 User ID
10.3.2 Event category (ex. READ, WRITE)
10.3.3 Date and time
10.3.4 Success or Failure
10.3.5 Client information (ex. IP address)
10.3.6 Object name, Object id (ex. Table name, Column name)
• 10.5 Audit logs also must be protected.
20Copyright©2017 NTT Corp. All Rights Reserved.
3. How to Apply to PostgreSQL
i. Keep your Database Secure.
ii. Data Encryption and Key Management.
iii. User Identification, Authentication,
Authorization, Identity management.
iv. Audit.
21Copyright©2017 NTT Corp. All Rights Reserved.
i. Keep your Database Secure
• Don’t use postgres(default) account.
• Change 5432(default) port.
• Use openSSL connection with psql.
 See manual.
https://www.postgresql.org/docs/current/static/runtime-config-
connection.html
 See Bruce Momjian’s Blog.
http://momjian.us/main/blogs/pgblog/2017.html#January_9_2017
• Restrict unnecessary access by pg_hba.conf
 See manual.
https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
• Update binaries to latest minor version.
Again,
Traditional security practices are important!
To Do
22Copyright©2017 NTT Corp. All Rights Reserved.
ii. Data Encryption and Key Management
pgcrypto is a good encryption module.
see manual. https://www.postgresql.org/docs/current/static/pgcrypto.html
• Manage two-tier encryption key by yourself
 An application development is hard!
To Do
• Use pgcrypto
Difficulty to apply PCI DSS to PostgreSQL.
PostgreSQL needs
TDE (Transparent Data Encryption) with
KMS (Key Management Service).
Should we start discussion in PostgreSQL community?
It seems to me that ...
You should consult the PostgreSQL vendors.
23Copyright©2017 NTT Corp. All Rights Reserved.
iii. User Identification, Authentication,
Authorization, Identity management
• Don’t use superuser!
• Apply PCI DSS password policies.
• Manage each user id.
For details, next slides!
To Do
24Copyright©2017 NTT Corp. All Rights Reserved.
• Don’t use superuser!
Superuser can do everything!
All user id must be restricted to least privileges necessary to perform job
responsibilities.
see manual https://www.postgresql.org/docs/current/static/ddl-priv.html
https://www.postgresql.org/docs/current/static/ddl-rowsecurity.html
Superuser must be audited fully.
iii. User Identification, Authentication,
Authorization, Identity management
To Do
Difficulties to apply PCI DSS to PostgreSQL.
Some useful SQLs and functions need superuser privilege.
For example,
 CREATE/ALTER EVENT TRIGGER
 CREATE FOREIGN DATA WRAPPER
 CREATE TABLESPACE
 pg_reload_conf(), pg_rotate_logfile(), pg_switch_xlog()
It seems to me that ...
25Copyright©2017 NTT Corp. All Rights Reserved.
• Apply password policy
 Use contrib/passwordchk.
 A minimum length of 8 characters.
 Not contain user/role name.
 Mix of letter and non-letter.
see https://www.postgresql.org/docs/current/static/passwordcheck.html
 Use “CREATE ROLE ... WITH VALID UNTIL ...;”
 The password is valid until the end of a specific date.
see https://www.postgresql.org/docs/current/static/sql-createrole.html
We should use a directory service.
iii. User Identification, Authentication,
Authorization, Identity management
To Do
Difficulties to apply PCI DSS to PostgreSQL.
• These password policies cannot be implemented in PostgreSQL.
• 8.2.5 Do not allow a new password that is the same as any of the last 4 passwords used.
• 8.2.6 Set passwords for first-time use and change immediately after the first use.
It seems to me that ...
26Copyright©2017 NTT Corp. All Rights Reserved.
• Manage each user id.
 Delete or Lockout user id according to PCI DSS requirements.
Delete: DROP ROLE ...; see manual https://www.postgresql.org/docs/current/static/sql-droprole.html
Lockout: ALTER ROLE ... WITH NOLOGIN;
see manual https://www.postgresql.org/docs/current/static/sql-droprole.html
iii. User Identification, Authentication,
Authorization, Identity management
To Do
• Use LDAP authentication.
see https://www.postgresql.org/docs/current/static/auth-methods.html
Difficulties to apply PCI DSS to PostgreSQL.
• To perform the following requirement is hard only in PostgreSQL.
 8.1.4 Inactive user accounts within 90 days.
 8.1.6 Repeated access attempts after not more than six attempts.
 8.1.8 Require the user to re-authenticate If a session has been idle for
more than 15 minutes.
We should use a directory service.
It seems to me that ...
27Copyright©2017 NTT Corp. All Rights Reserved.
Apache DS and Apache Directory studio
• Apache DS is directory service software.
• Apache Directory studio is GUI console of directory service.
https://directory.apache.org/studio/
http://directory.apache.org/apacheds/
iii. User Identification, Authentication,
Authorization, Identity management
28Copyright©2017 NTT Corp. All Rights Reserved.
Apache DS and Apache Directory studio
• Rich password policy configuration.
• Rich lock out policy configuration.
• Authentication Log
see official document.
http://directory.apache.org/apacheds/
https://directory.apache.org/studio/
iii. User Identification, Authentication,
Authorization, Identity management
29Copyright©2017 NTT Corp. All Rights Reserved.
• Apache DS can not create user accounts in PostgreSQL
 Create a PostgreSQL user accounts then register them to Apache
DS.
• Apache DS and Apache Directory studio can not control and edit
authorization of PostgreSQL.
 You need to login to PostgreSQL to edit authorization of
PostgreSQL.
iii. User Identification, Authentication,
Authorization, Identity management
Difficulties to apply PCI DSS to PostgreSQL with Apache DS.
30Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
• Use PostgreSQL server log.
To Do
PostgreSQL server log can output the following events.
see manual https://www.postgresql.org/docs/current/static/runtime-config-logging.html
# Requirement postgresql.conf parameters
10.2.1 Access to PANs log_statement = all
10.2.2 All operations of administrators log_statement = all
10.2.3 Access to audit logs #Use OS module (ex. auditd)
10.2.4 Invalid access log_connection,
log_disconnection
10.2.5 Operation about Identification,
Authentication (DCL)
log_statement = all
10.2.6 Change audit log setting and Stop to
audit
log_statement = all
#And use OS module
10.2.7 DDL log_statement = all
see
https://access.redhat.
com/documentation/e
n-
US/Red_Hat_Enterpri
se_Linux/7/html/Secu
rity_Guide/chap-
system_auditing.html
31Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
# Requirement postgresql.conf parameters
10.3.1 User ID log_line_prefix
10.3.2 Event category (ex. READ, WRITE) log_line_prefix
10.3.3 Date and time log_line_prefix
10.3.4 Success or Failure log_line_prefix
10.3.5 Client information (ex. IP address) log_line_prefix
10.3.6 Object name, Object id (ex. Table
name)
No such configuration params...
• Use Syslog to send another server and use auditd.
• Use PostgreSQL server log.
To Do
PostgreSQL server log can output the following information.
see manual https://www.postgresql.org/docs/current/static/runtime-config-logging.html
32Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
• Object name do not output.
 Some SQLs are difficult to audit.
For example, “DO”
testdb=# DO $$
BEGIN
EXECUTE 'SELECT * FROM import' || 'ant_table';
END $$;
server log output (log_statement=all)
LOG: statement: DO $$
BEGIN
EXECUTE 'SELECT * FROM import' || 'ant_table';
END $$;
To search SQL accessing to "important_table" is hard.
Difficulties to apply PCI DSS to PostgreSQL.
• Log size is big.
 It does not have useful log filters.
33Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
Difficulties to apply PCI DSS to PostgreSQL.
• Superuser can change server log settings easily.
 Hard to confirm to Requirement 10.2.2
Requirement 10.2.2
All operations of administrators must be audited
• Can not divide a log for auditing into a log for operating.
 Hard to confirm to Requirement 10.5
Requirement 10.5
Audit logs also must be protected.
server log
information
for operating
information
for auditing
auditeroperator
34Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
pgaudit is developed by 2ndquadrant and Crunchy Data.
https://github.com/pgaudit/pgaudit
Install pgaudit and
set shared_preload_libraries = ‘pgaudit‘ in postgresql.conf.
We should use pgaudit!
It seems to me that ...
35Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
• pgaudit can reduce audit log size.
Set class name to pgaudit.log parameter in postgresql.conf.
pgaudit.log = class name, ...
class name outputted SQL
READ SELECT, VALUES, COPY etc.
WRITE INSERT, UPDATE, DELETE, TRUNCATE, COPY etc.
FUNCTION DO etc.
ROLE CREATE|ALTER|DROP USER|ROLE|GROUP, GRANT, REVOKE etc.
DDL CREATE ... , ALTER ... , DROP ... , REINDEX, SELECT INTO etc.
MISC VACUUM, ANALYZE, BEGIN, COMMIT, ROLLBACK, SET, LOCK etc.
ALL ALL SQLs
pgaudit output only SQLs belonging to the class.
36Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
For example,
postgresql.conf
shared_preload_libraries = pgaudit
pgaudit.log = 'WRITE, DDL, MISC’
testdb=# BEGIN;
testdb=# SELECT * FROM pgbench_accounts LIMIT 1;
testdb=# UPDATE pgbench_accounts SET bid = '4' WHERE aid = '1';
testdb=# COMMIT;
LOG: AUDIT: SESSION,1,1,MISC,BEGIN,,,BEGIN;,<not logged>
LOG: AUDIT: SESSION,2,1,WRITE,UPDATE,,,
UPDATE pgbench_accounts SET bid = '4'
WHERE aid = '1';,<not logged>
LOG: AUDIT: SESSION,3,1,MISC,COMMIT,,,COMMIT;,<not logged>
SQL
Audit log
-> “SELECT” does not output.
The log size is suppressed to a minimum.
37Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
• pgaudit can output object name.
postgresql.conf
shared_preload_libraries = pgaudit
pgaudit.log = 'READ'
testdb=# DO $$
BEGIN
EXECUTE 'SELECT * FROM import' || 'ant_table';
END $$;
LOG: AUDIT: SESSION,2,1,READ,SELECT,TABLE,
public.important_table,
SELECT * FROM important_table,<none>
SQL
Audit log
-> Table name is outputted with schema name.
To search SQL accessing to "important_table" is easy!
38Copyright©2017 NTT Corp. All Rights Reserved.
iv. Audit
pgaudit is good tool!
However,
pgaudit can not cover the following two PCI DSS requirements yet.
• Superuser can change pgaudit settings easily.
 Hard to confirm to Requirement 10.2.2
• Can not divide a server log into a pgaudit log.
 Hard to confirm to Requirement 10.5
Difficulties to apply PCI DSS to PostgreSQL with pgaudit.
• Superuser must not be able to change pgaudit settings easily!
• Divide a server log into a pgaudit log.
It seems to me that ...
39Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit! Why not?
So we forked the pgaudit and add some new features.
NTT OSS Center pgaudit (called NTT pgaudit today)
https://github.com/ossc-db/pgaudit/tree/refactored
NTT pgaudit enhancement points.
• Restarting PostgreSQL is needed to change audit settings.
 NTT pgaudit config file is divided from postgresql.conf
• Divide a server log into an audit log.
 Audit logs is sent to log management server by Syslog.
• Rich Log filter.
 Minimum log size.
↑refactored branch is latest.
40Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
NTT pgaudit configuration file consists of three sections.
[output]
Logger settings you use server log or syslog.
[option]
Some misc. configurations.
[rule]
Filter rules.
For description, please read the README!
41Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
• Restarting PostgreSQL is needed to change audit
settings.
$ vi $PGDATA/postgresql.conf
shared_preload_libraries = 'pgaudit'
pgaudit.config_file = '/path/to/pgaudit.conf'
NTT pgaudit has only two parameters in postgresql.conf
Other pgaduit parameters are in pgaudit.conf.
# login by auditor
$ vim /audit_conf/pgaudit.conf
# some settings...
[output]
logger= 'serverlog‘
...
$ chmod +r /path/to/pgaudit.conf
$ ll /path/to/pgaudit.conf
-rw-rw-r--. 1 auditer auditer 384 11月 25 23:33 /path/to/pgaudit.conf
Only the auditor had better be able to edit pgaudit.conf
-> Superuser can not edit pgaudit.conf!
42Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
• Divide a server log into an audit log.
NTT pgaudit can export to serverlog or syslog.
Parameters in [output] section
Parameter Description Remarks
logger Logger you use; serverlog or syslog -
pathlog Specifies the socket to which syslog listens Parameter for syslog
facility See man 3 syslog for value Parameter for syslog
priority See man 3 syslog for value Parameter for syslog
ident See man 3 syslog for value Parameter for syslog
option See man 3 syslog for value Parameter for syslog
server log
information for
operating
information for
auditing
auditer
operator
NTT pgaudit log
43Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
• Rich Log filter.
NTT pgaudit has these filters. Parameters in [rule] section.
NTT pgaudit can have several [rule] sections.
Field name Description Sample setting
timestamp Timestamp range
timestamp = '09:00:00 - 10:00:00,
18:00:00 - 18:30:00
database Database name datebase = 'prodcut_db'
audit_role Role name audit_role ='superuser1'
class
Type of operation. Possible values are,
BACKUP, CONNECT, DDL, ERROR, FUNCTION, MISC, READ,
ROLE, WRITE, SYSTEM
class = 'READ, WRITE'
command_tag command_tag = 'CREATE, SELECT'
object_type
Type of object. Possible values are,
TABLE, INDEX, SEQUENCE, TOAST_VALUE, VIEW,
MATERIALIZED_VIEW, COMPOSITE_TYPE, FOREIGN_TABLE,
FUNCTION
object_type = 'TABLE, INDEX'
object_name Qualified object name
object_name =
'myschema.hoge_table'
application_name Connecting application name application_name = 'myapp'
remote_host Host name remote_host = 'ap_server'
44Copyright©2017 NTT Corp. All Rights Reserved.
Example use case
AP user
Auditor
OLTP
AP
PostgreSQL primary
BI User
Analysis
AP
PostgreSQL
secondary
Audit log
management
server
Administration
Task
Audit
task
Replication
Audit All
SQL
DB admin
Operation
Task
DB ops
pgaudit
syslog
pgaudit
syslog
Fluentd
Fluentd
• Each audit logs
are also audited
by auditdAudit READ and
WRITE SQL to
important table
Audit all READ
SQL to ALL table
https://access.redhat.com/doc
umentation/en-
US/Red_Hat_Enterprise_Linux/
7/html/Security_Guide/chap-
system_auditing.html
Audit All
SQL
45Copyright©2017 NTT Corp. All Rights Reserved.
Wrap up.
PostgreSQL can conform to PCI DSS by the following things.
• Set basic configurations.
• Use pgcrypto.
• Use a directory service.
• Use NTT pgaudit.
Should be better.
• TDE (Transparent Data Encryption).
• KMS (Key Management Service).
• Operation without superuser privilege.
46Copyright©2017 NTT Corp. All Rights Reserved.
END
47Copyright©2017 NTT Corp. All Rights Reserved.
0
10000
20000
30000
40000
50000
60000
70000
80000
90000
log_statement=none log_statement=all (log
size 14MB/s)
ntt_puaudit (no
output)
pgbench(read only, scale 100) TPS
NTT pgaudit
Performance evaluation.
13%down 6%down
TPS If you define targets of the
audit event, the
performance degradation is
suppressed to a minimum.
Please try it!
And provide us the
feedback!
48Copyright©2017 NTT Corp. All Rights Reserved.
Disk encryption
• Disk encryption is allowed by PCI DSS,
But how to apply to PostgreSQL?
Requirement 3.4.1
If disk encryption is used (rather than file- or column-level database
encryption), logical access must be managed separately and
independently of native operating system authentication and access
control mechanisms (for example, by not using local user account
databases or general network login credentials). Decryption keys must
not be associated with user accounts.
Note: This requirement applies in addition to all other PCI DSS encryption
and key-management requirements.
49Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
Get Started!
• Install PostgreSQL
$ # sudo yum install readline readline-devel zlib zlib-devel bison bison-devel flex flex-devel
$ git cloene https://github.com/postgres/postgres.git
$ cd postgres
$ ./configure --enable-debug --prefix=/usr/local/pgsql_latest/ --with-pgport=5555
$ make -j 4
$ sudo make install
$ cd postgres/contrib
$ git clone https://github.com/ossc-db/pgaudit.git
$ cd pgaudit/
$ git checkout -b refactored remotes/origin/refactored
$ make
$ sudo make install
• Install NTT pgaudit
50Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
Get Started!
• Configuration postgresql.conf
$ vim /home/masanori/data/postgresql.conf
shared_preload_libraries = 'pgaudit'
log_connections = on
log_disconnections = on
log_replication_commands = on
pgaudit.config_file = '/audit_conf/pgaudit.conf'
DB admin creates and edits postgresql.conf
51Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
Get Started!
• Configuration pgaudit.conf
$ vim /audit_conf/pgaudit.conf
# Where to log (e.g. log to serverlog).
[output]
logger= 'serverlog'
# Behavior of the PGAUDIT (e.g. setting log_catalog)
[option]
log_catalog = true
# Selection conditions of the Session-Audit-Logging.
[rule]
format = 'CONNECTION: %d,%u,"%connection_message"'
class = 'CONNECT'
[rule]
format = 'DML: %d,%u,%class,%command_tag,"%object_name","%command_text"'
class = 'READ,WRITE‘
$ chmod +r /audit_conf/pgaudit.conf
$ ll /audit_conf/pgaudit.conf
-rw-rw-r--. 1 auditer auditer 384 11月 25 23:33 /audit_conf/pgaudit.conf
Auditor creates and edits pgaudit.conf
-> DB admin can not edit pgaudit.conf!
52Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
Get Started!
• Start PostgreSQL
$ /usr/local/pgsql_latest/bin/pg_ctl start -D /home/masanori/data
waiting for server to start....2016-11-25 23:36:53.469 JST [21880] LOG: log_catalog = 1
2016-11-25 23:36:53.469 JST [21880] LOG: log_level_string = (null)
2016-11-25 23:36:53.469 JST [21880] LOG: log_level = 15
2016-11-25 23:36:53.469 JST [21880] LOG: log_parameter = 0
2016-11-25 23:36:53.469 JST [21880] LOG: log_statement_once = 0
2016-11-25 23:36:53.469 JST [21880] LOG: log_for_test = 0
2016-11-25 23:36:53.469 JST [21880] LOG: role =
... skip ...
2016-11-25 23:36:53.469 JST [21880] LOG: Rule 0
2016-11-25 23:36:53.469 JST [21880] LOG: BMP class = 2
2016-11-25 23:36:53.469 JST [21880] LOG: Rule 1
2016-11-25 23:36:53.469 JST [21880] LOG: BMP class = 320
2016-11-25 23:36:53.469 JST [21880] LOG: pgaudit extension initialized
2016-11-25 23:36:53.489 JST [21881] LOG: database system was shut down at 2016-11-25 23:11:15 JST
2016-11-25 23:36:53.489 JST [21881] LOG: MultiXact member wraparound protections are now enabled
2016-11-25 23:36:53.492 JST [21880] LOG: database system is ready to accept connections
2016-11-25 23:36:53.493 JST [21887] LOG: logical replication launcher started
2016-11-25 23:36:53.493 JST [21885] LOG: autovacuum launcher started
After starting PostgreSQL, the audit setting is logged.
53Copyright©2017 NTT Corp. All Rights Reserved.
NTT pgaudit
Get Started!
• Access to PostgreSQL
$ /usr/local/pgsql_latest/bin/psql -p 5555 -d postgres
2016-11-25 23:40:24.276 JST [21909] LOG: AUDIT: SESSION,,,CONNECT,2016-11-25 23:40:24
JST,,,[local],[unknown],,0,00000,connection received: host=[local],,,,,
2016-11-25 23:40:24.276 JST [21909] LOG: connection received: host=[local]
2016-11-25 23:40:24.277 JST [21909] LOG: AUDIT: SESSION,,,CONNECT,2016-11-25 23:40:24
JST,postgres,Masanori,[local],[unknown],3/10,0,00000,connection authorized: user=Masanori database=postgres,,,,,
2016-11-25 23:40:24.277 JST [21909] LOG: connection authorized: user=Masanori database=postgres
connection logs is exported.

More Related Content

What's hot

Deploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesDeploying PostgreSQL on Kubernetes
Deploying PostgreSQL on Kubernetes
Jimmy Angelakos
 
AWS Black Belt Techシリーズ Amazon VPC
AWS Black Belt Techシリーズ Amazon VPCAWS Black Belt Techシリーズ Amazon VPC
AWS Black Belt Techシリーズ Amazon VPC
Amazon Web Services Japan
 
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
yoku0825
 
AWS X-Rayによるアプリケーションの分析とデバッグ
AWS X-Rayによるアプリケーションの分析とデバッグAWS X-Rayによるアプリケーションの分析とデバッグ
AWS X-Rayによるアプリケーションの分析とデバッグ
Amazon Web Services Japan
 
CDNの仕組み(JANOG36)
CDNの仕組み(JANOG36)CDNの仕組み(JANOG36)
CDNの仕組み(JANOG36)
J-Stream Inc.
 
Database Encryption and Key Management for PostgreSQL - Principles and Consid...
Database Encryption and Key Management for PostgreSQL - Principles and Consid...Database Encryption and Key Management for PostgreSQL - Principles and Consid...
Database Encryption and Key Management for PostgreSQL - Principles and Consid...
Masahiko Sawada
 
Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)
Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)
Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)
NTT DATA Technology & Innovation
 
アーキテクチャから理解するPostgreSQLのレプリケーション
アーキテクチャから理解するPostgreSQLのレプリケーションアーキテクチャから理解するPostgreSQLのレプリケーション
アーキテクチャから理解するPostgreSQLのレプリケーション
Masahiko Sawada
 
Microsoft licensing on AWS
Microsoft licensing on AWSMicrosoft licensing on AWS
Microsoft licensing on AWS
Amazon Web Services
 
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
Amazon Web Services Japan
 
AWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリAWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリ
Amazon Web Services Japan
 
ProxySQL on Kubernetes
ProxySQL on KubernetesProxySQL on Kubernetes
ProxySQL on Kubernetes
René Cannaò
 
Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기
NeoClova
 
PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_TutorialVibhor Kumar
 
ロードバランスへの長い道
ロードバランスへの長い道ロードバランスへの長い道
ロードバランスへの長い道
Jun Kato
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
I Goo Lee
 
AWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
AWS Black Belt Online Seminar 2016 Amazon EC2 Container ServiceAWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
AWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
Amazon Web Services Japan
 
多要素認証による Amazon WorkSpaces の利用
多要素認証による Amazon WorkSpaces の利用多要素認証による Amazon WorkSpaces の利用
多要素認証による Amazon WorkSpaces の利用
Amazon Web Services Japan
 
OpenStack & Ansible で実現する自動化
OpenStack & Ansible で実現する自動化OpenStack & Ansible で実現する自動化
OpenStack & Ansible で実現する自動化
Hideki Saito
 
20200212 AWS Black Belt Online Seminar AWS Systems Manager
20200212 AWS Black Belt Online Seminar AWS Systems Manager20200212 AWS Black Belt Online Seminar AWS Systems Manager
20200212 AWS Black Belt Online Seminar AWS Systems Manager
Amazon Web Services Japan
 

What's hot (20)

Deploying PostgreSQL on Kubernetes
Deploying PostgreSQL on KubernetesDeploying PostgreSQL on Kubernetes
Deploying PostgreSQL on Kubernetes
 
AWS Black Belt Techシリーズ Amazon VPC
AWS Black Belt Techシリーズ Amazon VPCAWS Black Belt Techシリーズ Amazon VPC
AWS Black Belt Techシリーズ Amazon VPC
 
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
サーバーが完膚なきまでに死んでもMySQLのデータを失わないための表技
 
AWS X-Rayによるアプリケーションの分析とデバッグ
AWS X-Rayによるアプリケーションの分析とデバッグAWS X-Rayによるアプリケーションの分析とデバッグ
AWS X-Rayによるアプリケーションの分析とデバッグ
 
CDNの仕組み(JANOG36)
CDNの仕組み(JANOG36)CDNの仕組み(JANOG36)
CDNの仕組み(JANOG36)
 
Database Encryption and Key Management for PostgreSQL - Principles and Consid...
Database Encryption and Key Management for PostgreSQL - Principles and Consid...Database Encryption and Key Management for PostgreSQL - Principles and Consid...
Database Encryption and Key Management for PostgreSQL - Principles and Consid...
 
Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)
Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)
Kubernetesでの性能解析 ~なんとなく遅いからの脱却~(Kubernetes Meetup Tokyo #33 発表資料)
 
アーキテクチャから理解するPostgreSQLのレプリケーション
アーキテクチャから理解するPostgreSQLのレプリケーションアーキテクチャから理解するPostgreSQLのレプリケーション
アーキテクチャから理解するPostgreSQLのレプリケーション
 
Microsoft licensing on AWS
Microsoft licensing on AWSMicrosoft licensing on AWS
Microsoft licensing on AWS
 
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
20180704 AWS Black Belt Online Seminar Amazon Elastic File System (Amazon EFS...
 
AWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリAWSで実現するバックアップとディザスタリカバリ
AWSで実現するバックアップとディザスタリカバリ
 
ProxySQL on Kubernetes
ProxySQL on KubernetesProxySQL on Kubernetes
ProxySQL on Kubernetes
 
Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기Maria db 이중화구성_고민하기
Maria db 이중화구성_고민하기
 
PGEncryption_Tutorial
PGEncryption_TutorialPGEncryption_Tutorial
PGEncryption_Tutorial
 
ロードバランスへの長い道
ロードバランスへの長い道ロードバランスへの長い道
ロードバランスへの長い道
 
MySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software TestMySQL/MariaDB Proxy Software Test
MySQL/MariaDB Proxy Software Test
 
AWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
AWS Black Belt Online Seminar 2016 Amazon EC2 Container ServiceAWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
AWS Black Belt Online Seminar 2016 Amazon EC2 Container Service
 
多要素認証による Amazon WorkSpaces の利用
多要素認証による Amazon WorkSpaces の利用多要素認証による Amazon WorkSpaces の利用
多要素認証による Amazon WorkSpaces の利用
 
OpenStack & Ansible で実現する自動化
OpenStack & Ansible で実現する自動化OpenStack & Ansible で実現する自動化
OpenStack & Ansible で実現する自動化
 
20200212 AWS Black Belt Online Seminar AWS Systems Manager
20200212 AWS Black Belt Online Seminar AWS Systems Manager20200212 AWS Black Belt Online Seminar AWS Systems Manager
20200212 AWS Black Belt Online Seminar AWS Systems Manager
 

Viewers also liked

Database Security for PCI DSS
Database Security for PCI DSSDatabase Security for PCI DSS
Database Security for PCI DSS
Ohyama Masanori
 
Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-
Shingo Kitayama
 
FDW-based Sharding Update and Future
FDW-based Sharding Update and FutureFDW-based Sharding Update and Future
FDW-based Sharding Update and Future
Masahiko Sawada
 
PostgreSQLによるデータ分析ことはじめ
PostgreSQLによるデータ分析ことはじめPostgreSQLによるデータ分析ことはじめ
PostgreSQLによるデータ分析ことはじめ
Ohyama Masanori
 
GPGPU Accelerates PostgreSQL (English)
GPGPU Accelerates PostgreSQL (English)GPGPU Accelerates PostgreSQL (English)
GPGPU Accelerates PostgreSQL (English)
Kohei KaiGai
 
淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL
Yi-Feng Tzeng
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
Konstantin Gredeskoul
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
EDB
 
外部データラッパによる PostgreSQL の拡張
外部データラッパによる PostgreSQL の拡張外部データラッパによる PostgreSQL の拡張
外部データラッパによる PostgreSQL の拡張
Shigeru Hanada
 
PostgreSQL 9.5 新機能紹介
PostgreSQL 9.5 新機能紹介PostgreSQL 9.5 新機能紹介
PostgreSQL 9.5 新機能紹介
NTT DATA OSS Professional Services
 
Lessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’tLessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’t
PGConf APAC
 
What’s New in Amazon Aurora for MySQL and PostgreSQL
What’s New in Amazon Aurora for MySQL and PostgreSQLWhat’s New in Amazon Aurora for MySQL and PostgreSQL
What’s New in Amazon Aurora for MySQL and PostgreSQL
Amazon Web Services
 
(JP) GPGPUがPostgreSQLを加速する
(JP) GPGPUがPostgreSQLを加速する(JP) GPGPUがPostgreSQLを加速する
(JP) GPGPUがPostgreSQLを加速する
Kohei KaiGai
 
Security best practices
Security best practices Security best practices
Security best practices
Amazon Web Services
 
Full Text Search In PostgreSQL
Full Text Search In PostgreSQLFull Text Search In PostgreSQL
Full Text Search In PostgreSQL
Karwin Software Solutions LLC
 
Scott Chacon - Cuento de tres árboles
Scott Chacon - Cuento de tres árbolesScott Chacon - Cuento de tres árboles
Scott Chacon - Cuento de tres árbolesStarTech Conference
 
サービスデザインのエンジンとしての“わたしの体験“ワークショップ
サービスデザインのエンジンとしての“わたしの体験“ワークショップサービスデザインのエンジンとしての“わたしの体験“ワークショップ
サービスデザインのエンジンとしての“わたしの体験“ワークショップ
Masaya Ando
 
Vincit Dev Talk
Vincit Dev TalkVincit Dev Talk
Vincit Dev Talk
Audrey Crane
 
Dynamics PSA demo
Dynamics PSA demoDynamics PSA demo
Dynamics PSA demo
Martin Bloma
 

Viewers also liked (19)

Database Security for PCI DSS
Database Security for PCI DSSDatabase Security for PCI DSS
Database Security for PCI DSS
 
Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-
 
FDW-based Sharding Update and Future
FDW-based Sharding Update and FutureFDW-based Sharding Update and Future
FDW-based Sharding Update and Future
 
PostgreSQLによるデータ分析ことはじめ
PostgreSQLによるデータ分析ことはじめPostgreSQLによるデータ分析ことはじめ
PostgreSQLによるデータ分析ことはじめ
 
GPGPU Accelerates PostgreSQL (English)
GPGPU Accelerates PostgreSQL (English)GPGPU Accelerates PostgreSQL (English)
GPGPU Accelerates PostgreSQL (English)
 
淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL淺入淺出 MySQL & PostgreSQL
淺入淺出 MySQL & PostgreSQL
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
外部データラッパによる PostgreSQL の拡張
外部データラッパによる PostgreSQL の拡張外部データラッパによる PostgreSQL の拡張
外部データラッパによる PostgreSQL の拡張
 
PostgreSQL 9.5 新機能紹介
PostgreSQL 9.5 新機能紹介PostgreSQL 9.5 新機能紹介
PostgreSQL 9.5 新機能紹介
 
Lessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’tLessons PostgreSQL learned from commercial databases, and didn’t
Lessons PostgreSQL learned from commercial databases, and didn’t
 
What’s New in Amazon Aurora for MySQL and PostgreSQL
What’s New in Amazon Aurora for MySQL and PostgreSQLWhat’s New in Amazon Aurora for MySQL and PostgreSQL
What’s New in Amazon Aurora for MySQL and PostgreSQL
 
(JP) GPGPUがPostgreSQLを加速する
(JP) GPGPUがPostgreSQLを加速する(JP) GPGPUがPostgreSQLを加速する
(JP) GPGPUがPostgreSQLを加速する
 
Security best practices
Security best practices Security best practices
Security best practices
 
Full Text Search In PostgreSQL
Full Text Search In PostgreSQLFull Text Search In PostgreSQL
Full Text Search In PostgreSQL
 
Scott Chacon - Cuento de tres árboles
Scott Chacon - Cuento de tres árbolesScott Chacon - Cuento de tres árboles
Scott Chacon - Cuento de tres árboles
 
サービスデザインのエンジンとしての“わたしの体験“ワークショップ
サービスデザインのエンジンとしての“わたしの体験“ワークショップサービスデザインのエンジンとしての“わたしの体験“ワークショップ
サービスデザインのエンジンとしての“わたしの体験“ワークショップ
 
Vincit Dev Talk
Vincit Dev TalkVincit Dev Talk
Vincit Dev Talk
 
Dynamics PSA demo
Dynamics PSA demoDynamics PSA demo
Dynamics PSA demo
 

Similar to PostgreSQL Security. How Do We Think?

PostgreSQL Security. How Do We Think? at PGCon 2017
PostgreSQL Security. How Do We Think? at PGCon 2017PostgreSQL Security. How Do We Think? at PGCon 2017
PostgreSQL Security. How Do We Think? at PGCon 2017
Ohyama Masanori
 
Achieving Pci Compliace
Achieving Pci CompliaceAchieving Pci Compliace
Achieving Pci Compliace
Denish Patel
 
MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...
MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...
MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...
MongoDB
 
Multi Master PostgreSQL Cluster on Kubernetes
Multi Master PostgreSQL Cluster on KubernetesMulti Master PostgreSQL Cluster on Kubernetes
Multi Master PostgreSQL Cluster on Kubernetes
Ohyama Masanori
 
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
Cisco Connect Toronto 2018   an introduction to Cisco kineticCisco Connect Toronto 2018   an introduction to Cisco kinetic
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
Cisco Canada
 
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
Cisco Connect Toronto 2018   an introduction to Cisco kineticCisco Connect Toronto 2018   an introduction to Cisco kinetic
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
Cisco Canada
 
Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...
Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...
Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...
Severalnines
 
Hitachi ID Identity and Access Management Suite
Hitachi ID Identity and Access Management SuiteHitachi ID Identity and Access Management Suite
Hitachi ID Identity and Access Management Suite
Hitachi ID Systems, Inc.
 
Cisco connect montreal 2018 compute v final
Cisco connect montreal 2018   compute v finalCisco connect montreal 2018   compute v final
Cisco connect montreal 2018 compute v final
Cisco Canada
 
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_CloudKoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
Tobias Koprowski
 
Elastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ CiscoElastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ Cisco
Elasticsearch
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017
Werner Keil
 
5 Ways to Make Your Postgres GDPR-Ready
5 Ways to Make Your Postgres GDPR-Ready5 Ways to Make Your Postgres GDPR-Ready
5 Ways to Make Your Postgres GDPR-Ready
EDB
 
GDPR Webinar January 2018
GDPR Webinar January 2018GDPR Webinar January 2018
GDPR Webinar January 2018
EDB
 
Cisco Connect Toronto 2018 DNA assurance
Cisco Connect Toronto 2018  DNA assuranceCisco Connect Toronto 2018  DNA assurance
Cisco Connect Toronto 2018 DNA assurance
Cisco Canada
 
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Masahiko Sawada
 
Hitachi ID Password Manager
Hitachi ID Password ManagerHitachi ID Password Manager
Hitachi ID Password Manager
Hitachi ID Systems, Inc.
 
Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...
Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...
Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...
DataWorks Summit
 
Data Works Berlin 2018 - Worldpay - PCI Compliance
Data Works Berlin 2018 - Worldpay - PCI ComplianceData Works Berlin 2018 - Worldpay - PCI Compliance
Data Works Berlin 2018 - Worldpay - PCI Compliance
David Walker
 
Future Commerce 2019
Future Commerce 2019 Future Commerce 2019
Future Commerce 2019
PT Datacomm Diangraha
 

Similar to PostgreSQL Security. How Do We Think? (20)

PostgreSQL Security. How Do We Think? at PGCon 2017
PostgreSQL Security. How Do We Think? at PGCon 2017PostgreSQL Security. How Do We Think? at PGCon 2017
PostgreSQL Security. How Do We Think? at PGCon 2017
 
Achieving Pci Compliace
Achieving Pci CompliaceAchieving Pci Compliace
Achieving Pci Compliace
 
MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...
MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...
MongoDB World 2018: Managing a Mission Critical eCommerce Application on Mong...
 
Multi Master PostgreSQL Cluster on Kubernetes
Multi Master PostgreSQL Cluster on KubernetesMulti Master PostgreSQL Cluster on Kubernetes
Multi Master PostgreSQL Cluster on Kubernetes
 
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
Cisco Connect Toronto 2018   an introduction to Cisco kineticCisco Connect Toronto 2018   an introduction to Cisco kinetic
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
 
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
Cisco Connect Toronto 2018   an introduction to Cisco kineticCisco Connect Toronto 2018   an introduction to Cisco kinetic
Cisco Connect Toronto 2018 an introduction to Cisco kinetic
 
Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...
Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...
Webinar slides: How to Achieve PCI Compliance for MySQL & MariaDB with Cluste...
 
Hitachi ID Identity and Access Management Suite
Hitachi ID Identity and Access Management SuiteHitachi ID Identity and Access Management Suite
Hitachi ID Identity and Access Management Suite
 
Cisco connect montreal 2018 compute v final
Cisco connect montreal 2018   compute v finalCisco connect montreal 2018   compute v final
Cisco connect montreal 2018 compute v final
 
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_CloudKoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
KoprowskiT-Difinify2017-SQL_ServerBackup_In_The_Cloud
 
Elastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ CiscoElastic Cloud Enterprise @ Cisco
Elastic Cloud Enterprise @ Cisco
 
Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017Performance Monitoring for the Cloud - Java2Days 2017
Performance Monitoring for the Cloud - Java2Days 2017
 
5 Ways to Make Your Postgres GDPR-Ready
5 Ways to Make Your Postgres GDPR-Ready5 Ways to Make Your Postgres GDPR-Ready
5 Ways to Make Your Postgres GDPR-Ready
 
GDPR Webinar January 2018
GDPR Webinar January 2018GDPR Webinar January 2018
GDPR Webinar January 2018
 
Cisco Connect Toronto 2018 DNA assurance
Cisco Connect Toronto 2018  DNA assuranceCisco Connect Toronto 2018  DNA assurance
Cisco Connect Toronto 2018 DNA assurance
 
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
 
Hitachi ID Password Manager
Hitachi ID Password ManagerHitachi ID Password Manager
Hitachi ID Password Manager
 
Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...
Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...
Not Just a necessary evil, it’s good for business: implementing PCI DSS contr...
 
Data Works Berlin 2018 - Worldpay - PCI Compliance
Data Works Berlin 2018 - Worldpay - PCI ComplianceData Works Berlin 2018 - Worldpay - PCI Compliance
Data Works Berlin 2018 - Worldpay - PCI Compliance
 
Future Commerce 2019
Future Commerce 2019 Future Commerce 2019
Future Commerce 2019
 

Recently uploaded

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 

PostgreSQL Security. How Do We Think?

  • 1. Copyright©2017 NTT Corp. All Rights Reserved. PostgreSQL Security. How Do We Think? Masanori Oyama @ooyamams1987 NTT OSS Center
  • 2. 1Copyright©2017 NTT Corp. All Rights Reserved. Who am I? Masanori Oyama / 大山 真実 twitter @ooyamams1987 Work – PostgreSQL engineering support and consultation.  Recently focus to database security. – Extensive quality verification of PostgreSQL releases.  Latest work: Parallel query evaluation. pgconf.asia “What’s new in 9.6, by PostgreSQL contributor” by Masahiko Sawada https://www.slideshare.net/masahikosawada98/whats-new-in-96-by-postgresql-contributor Prev work – Hadoop engineering support and consultation at NTT DATA Inc.  I had managed a big Hadoop cluster (1000 node, 200PB!).
  • 3. 2Copyright©2017 NTT Corp. All Rights Reserved. About NTT • Who we are? – NTT(Nippon Telegraph and Telephone Corporation) – National flagship carrier in Japan • What NTT OSS Center is doing? – Promotes the adoption of OSS by the group companies • Total support – support desk, Introduction support, Product maintenance • R&D – developing OSS and related tools with the communities – Deals with about 60 OSS products. NTT group subsidiary about 900 companies NTT NTT OSS Center
  • 4. 3Copyright©2017 NTT Corp. All Rights Reserved. Agenda 1. Introduction 2. Database Security Requirements 3. How to Apply to PostgreSQL
  • 5. 4Copyright©2017 NTT Corp. All Rights Reserved. 1. Introduction
  • 6. 5Copyright©2017 NTT Corp. All Rights Reserved. The circumstances in Japan • Japanese government aims to implement an action plan for strengthening the security of credit card transactions by 2020.  Make business operators holding such information conform to the PCI DSS.  Multi-layered measures are introduced by retailers dealing with EC transactions. • Some our projects try to conform to PCI DSS. ref: http://www.meti.go.jp/english/press/2016/0223_02.html
  • 7. 6Copyright©2017 NTT Corp. All Rights Reserved. What is PCI DSS? • PCI DSS (Payment Card Industry Data Security Standard) is credit card industry security standard. ref: https://www.pcisecuritystandards.org/pci_security/
  • 8. 7Copyright©2017 NTT Corp. All Rights Reserved. What is PCI DSS? • PCI DSS (Payment Card Industry Data Security Standard) is credit card industry security standard. ref: https://www.pcisecuritystandards.org/documents/PCI_DSS_v3-2.pdf
  • 9. 8Copyright©2017 NTT Corp. All Rights Reserved. 2. Database Security Requirements
  • 10. 9Copyright©2017 NTT Corp. All Rights Reserved. The requirements of PCI DSS related to database Keep your Database Secure. Data Encryption and Key Management. User Identification, Authentication, Authorization, Identity management. Audit.
  • 11. 10Copyright©2017 NTT Corp. All Rights Reserved. The requirements of PCI DSS related to database Keep your Database Secure. Data Encryption and Key Management. User Identification, Authentication, Authorization, Identity management. Audit. Keep your Database Secure.
  • 12. 11Copyright©2017 NTT Corp. All Rights Reserved. i. Keep your Database Secure PCI DSS Requirements 2 & 6 say • Don’t use a default user account and password. • Don’t use unnecessary modules, functions, protocols. • Admin control accesses have to be encrypted. • Use a latest software version. These are not difficult. Traditional (or basic) security practices are important!
  • 13. 12Copyright©2017 NTT Corp. All Rights Reserved. The requirements of PCI DSS related to database Keep your Database Secure. Data Encryption and Key Management. User Identification, Authentication, Authorization, Identity management. Audit. Data Encryption and Key Management.
  • 14. 13Copyright©2017 NTT Corp. All Rights Reserved. ii. Encryption and Key Management PCI DSS Requirement 3 says • PAN (Primary account number) must be unreadable or encrypted. unreadable strong encryption • One-way hashes af1bcec2664906a9f587fb • Truncation XXXX XXXX XXXX 1234 • AES, TDES/TDEA, RSA (see PCI DSS Glossary “Strong Cryptography”) • With key-management • Only valid user can decrypt reversible irreversible PAN
  • 15. 14Copyright©2017 NTT Corp. All Rights Reserved. ii. Encryption and Key Management Encryption key-management Outline • Two-tier encryption  Data-encrypting key  Key-encrypting keys … … … … … … … … … encrypt decrypt encrypt decrypt Database Server Key-Store Server • Replace in a certain period • Store separately • Restricted access • Stored in the fewest locations • Accesses to key are Audited see Requirements 3.5, 3.6
  • 16. 15Copyright©2017 NTT Corp. All Rights Reserved. The requirements of PCI DSS related to database Keep your Database Secure. Data Encryption and Key Management. User Identification, Authentication, Authorization, Identity management. User Identification, Authentication, Authorization, Identity management.
  • 17. 16Copyright©2017 NTT Corp. All Rights Reserved. iii. Identification, Authentication, Authorization, Identity management PCI DSS requirements 7 & 8 say Authorization Provide just the minimum necessary authority for application user, database administrators, database operators and so on. Authentication Password (some password policy. See Requirement 8.2) Token device Biometrics Identification All users are identified by user ID. Identity management (User ID life cycle control) Delete, Lock out user ID, Disconnect idle connection (some management policy. See Requirement 8.1)
  • 18. 17Copyright©2017 NTT Corp. All Rights Reserved. The requirements of PCI DSS related to database Keep your Database Secure. Data Encryption and Key Management. User Identification, Authentication, Authorization, Identity management. Audit.
  • 19. 18Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit PCI DSS Requirement 10 says • These events must be audited. # Requirement 10.2.1 Access to PANs 10.2.2 All operations of administrators 10.2.3 Access to audit logs 10.2.4 Invalid access 10.2.5 Operation about Identification, Authentication (DCL) 10.2.6 Change audit log setting and Stop to audit 10.2.7 DDL
  • 20. 19Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit PCI DSS Requirement 10 says • Audit logs must output following information. # Requirement 10.3.1 User ID 10.3.2 Event category (ex. READ, WRITE) 10.3.3 Date and time 10.3.4 Success or Failure 10.3.5 Client information (ex. IP address) 10.3.6 Object name, Object id (ex. Table name, Column name) • 10.5 Audit logs also must be protected.
  • 21. 20Copyright©2017 NTT Corp. All Rights Reserved. 3. How to Apply to PostgreSQL i. Keep your Database Secure. ii. Data Encryption and Key Management. iii. User Identification, Authentication, Authorization, Identity management. iv. Audit.
  • 22. 21Copyright©2017 NTT Corp. All Rights Reserved. i. Keep your Database Secure • Don’t use postgres(default) account. • Change 5432(default) port. • Use openSSL connection with psql.  See manual. https://www.postgresql.org/docs/current/static/runtime-config- connection.html  See Bruce Momjian’s Blog. http://momjian.us/main/blogs/pgblog/2017.html#January_9_2017 • Restrict unnecessary access by pg_hba.conf  See manual. https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html • Update binaries to latest minor version. Again, Traditional security practices are important! To Do
  • 23. 22Copyright©2017 NTT Corp. All Rights Reserved. ii. Data Encryption and Key Management pgcrypto is a good encryption module. see manual. https://www.postgresql.org/docs/current/static/pgcrypto.html • Manage two-tier encryption key by yourself  An application development is hard! To Do • Use pgcrypto Difficulty to apply PCI DSS to PostgreSQL. PostgreSQL needs TDE (Transparent Data Encryption) with KMS (Key Management Service). Should we start discussion in PostgreSQL community? It seems to me that ... You should consult the PostgreSQL vendors.
  • 24. 23Copyright©2017 NTT Corp. All Rights Reserved. iii. User Identification, Authentication, Authorization, Identity management • Don’t use superuser! • Apply PCI DSS password policies. • Manage each user id. For details, next slides! To Do
  • 25. 24Copyright©2017 NTT Corp. All Rights Reserved. • Don’t use superuser! Superuser can do everything! All user id must be restricted to least privileges necessary to perform job responsibilities. see manual https://www.postgresql.org/docs/current/static/ddl-priv.html https://www.postgresql.org/docs/current/static/ddl-rowsecurity.html Superuser must be audited fully. iii. User Identification, Authentication, Authorization, Identity management To Do Difficulties to apply PCI DSS to PostgreSQL. Some useful SQLs and functions need superuser privilege. For example,  CREATE/ALTER EVENT TRIGGER  CREATE FOREIGN DATA WRAPPER  CREATE TABLESPACE  pg_reload_conf(), pg_rotate_logfile(), pg_switch_xlog() It seems to me that ...
  • 26. 25Copyright©2017 NTT Corp. All Rights Reserved. • Apply password policy  Use contrib/passwordchk.  A minimum length of 8 characters.  Not contain user/role name.  Mix of letter and non-letter. see https://www.postgresql.org/docs/current/static/passwordcheck.html  Use “CREATE ROLE ... WITH VALID UNTIL ...;”  The password is valid until the end of a specific date. see https://www.postgresql.org/docs/current/static/sql-createrole.html We should use a directory service. iii. User Identification, Authentication, Authorization, Identity management To Do Difficulties to apply PCI DSS to PostgreSQL. • These password policies cannot be implemented in PostgreSQL. • 8.2.5 Do not allow a new password that is the same as any of the last 4 passwords used. • 8.2.6 Set passwords for first-time use and change immediately after the first use. It seems to me that ...
  • 27. 26Copyright©2017 NTT Corp. All Rights Reserved. • Manage each user id.  Delete or Lockout user id according to PCI DSS requirements. Delete: DROP ROLE ...; see manual https://www.postgresql.org/docs/current/static/sql-droprole.html Lockout: ALTER ROLE ... WITH NOLOGIN; see manual https://www.postgresql.org/docs/current/static/sql-droprole.html iii. User Identification, Authentication, Authorization, Identity management To Do • Use LDAP authentication. see https://www.postgresql.org/docs/current/static/auth-methods.html Difficulties to apply PCI DSS to PostgreSQL. • To perform the following requirement is hard only in PostgreSQL.  8.1.4 Inactive user accounts within 90 days.  8.1.6 Repeated access attempts after not more than six attempts.  8.1.8 Require the user to re-authenticate If a session has been idle for more than 15 minutes. We should use a directory service. It seems to me that ...
  • 28. 27Copyright©2017 NTT Corp. All Rights Reserved. Apache DS and Apache Directory studio • Apache DS is directory service software. • Apache Directory studio is GUI console of directory service. https://directory.apache.org/studio/ http://directory.apache.org/apacheds/ iii. User Identification, Authentication, Authorization, Identity management
  • 29. 28Copyright©2017 NTT Corp. All Rights Reserved. Apache DS and Apache Directory studio • Rich password policy configuration. • Rich lock out policy configuration. • Authentication Log see official document. http://directory.apache.org/apacheds/ https://directory.apache.org/studio/ iii. User Identification, Authentication, Authorization, Identity management
  • 30. 29Copyright©2017 NTT Corp. All Rights Reserved. • Apache DS can not create user accounts in PostgreSQL  Create a PostgreSQL user accounts then register them to Apache DS. • Apache DS and Apache Directory studio can not control and edit authorization of PostgreSQL.  You need to login to PostgreSQL to edit authorization of PostgreSQL. iii. User Identification, Authentication, Authorization, Identity management Difficulties to apply PCI DSS to PostgreSQL with Apache DS.
  • 31. 30Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit • Use PostgreSQL server log. To Do PostgreSQL server log can output the following events. see manual https://www.postgresql.org/docs/current/static/runtime-config-logging.html # Requirement postgresql.conf parameters 10.2.1 Access to PANs log_statement = all 10.2.2 All operations of administrators log_statement = all 10.2.3 Access to audit logs #Use OS module (ex. auditd) 10.2.4 Invalid access log_connection, log_disconnection 10.2.5 Operation about Identification, Authentication (DCL) log_statement = all 10.2.6 Change audit log setting and Stop to audit log_statement = all #And use OS module 10.2.7 DDL log_statement = all see https://access.redhat. com/documentation/e n- US/Red_Hat_Enterpri se_Linux/7/html/Secu rity_Guide/chap- system_auditing.html
  • 32. 31Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit # Requirement postgresql.conf parameters 10.3.1 User ID log_line_prefix 10.3.2 Event category (ex. READ, WRITE) log_line_prefix 10.3.3 Date and time log_line_prefix 10.3.4 Success or Failure log_line_prefix 10.3.5 Client information (ex. IP address) log_line_prefix 10.3.6 Object name, Object id (ex. Table name) No such configuration params... • Use Syslog to send another server and use auditd. • Use PostgreSQL server log. To Do PostgreSQL server log can output the following information. see manual https://www.postgresql.org/docs/current/static/runtime-config-logging.html
  • 33. 32Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit • Object name do not output.  Some SQLs are difficult to audit. For example, “DO” testdb=# DO $$ BEGIN EXECUTE 'SELECT * FROM import' || 'ant_table'; END $$; server log output (log_statement=all) LOG: statement: DO $$ BEGIN EXECUTE 'SELECT * FROM import' || 'ant_table'; END $$; To search SQL accessing to "important_table" is hard. Difficulties to apply PCI DSS to PostgreSQL. • Log size is big.  It does not have useful log filters.
  • 34. 33Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit Difficulties to apply PCI DSS to PostgreSQL. • Superuser can change server log settings easily.  Hard to confirm to Requirement 10.2.2 Requirement 10.2.2 All operations of administrators must be audited • Can not divide a log for auditing into a log for operating.  Hard to confirm to Requirement 10.5 Requirement 10.5 Audit logs also must be protected. server log information for operating information for auditing auditeroperator
  • 35. 34Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit pgaudit is developed by 2ndquadrant and Crunchy Data. https://github.com/pgaudit/pgaudit Install pgaudit and set shared_preload_libraries = ‘pgaudit‘ in postgresql.conf. We should use pgaudit! It seems to me that ...
  • 36. 35Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit • pgaudit can reduce audit log size. Set class name to pgaudit.log parameter in postgresql.conf. pgaudit.log = class name, ... class name outputted SQL READ SELECT, VALUES, COPY etc. WRITE INSERT, UPDATE, DELETE, TRUNCATE, COPY etc. FUNCTION DO etc. ROLE CREATE|ALTER|DROP USER|ROLE|GROUP, GRANT, REVOKE etc. DDL CREATE ... , ALTER ... , DROP ... , REINDEX, SELECT INTO etc. MISC VACUUM, ANALYZE, BEGIN, COMMIT, ROLLBACK, SET, LOCK etc. ALL ALL SQLs pgaudit output only SQLs belonging to the class.
  • 37. 36Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit For example, postgresql.conf shared_preload_libraries = pgaudit pgaudit.log = 'WRITE, DDL, MISC’ testdb=# BEGIN; testdb=# SELECT * FROM pgbench_accounts LIMIT 1; testdb=# UPDATE pgbench_accounts SET bid = '4' WHERE aid = '1'; testdb=# COMMIT; LOG: AUDIT: SESSION,1,1,MISC,BEGIN,,,BEGIN;,<not logged> LOG: AUDIT: SESSION,2,1,WRITE,UPDATE,,, UPDATE pgbench_accounts SET bid = '4' WHERE aid = '1';,<not logged> LOG: AUDIT: SESSION,3,1,MISC,COMMIT,,,COMMIT;,<not logged> SQL Audit log -> “SELECT” does not output. The log size is suppressed to a minimum.
  • 38. 37Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit • pgaudit can output object name. postgresql.conf shared_preload_libraries = pgaudit pgaudit.log = 'READ' testdb=# DO $$ BEGIN EXECUTE 'SELECT * FROM import' || 'ant_table'; END $$; LOG: AUDIT: SESSION,2,1,READ,SELECT,TABLE, public.important_table, SELECT * FROM important_table,<none> SQL Audit log -> Table name is outputted with schema name. To search SQL accessing to "important_table" is easy!
  • 39. 38Copyright©2017 NTT Corp. All Rights Reserved. iv. Audit pgaudit is good tool! However, pgaudit can not cover the following two PCI DSS requirements yet. • Superuser can change pgaudit settings easily.  Hard to confirm to Requirement 10.2.2 • Can not divide a server log into a pgaudit log.  Hard to confirm to Requirement 10.5 Difficulties to apply PCI DSS to PostgreSQL with pgaudit. • Superuser must not be able to change pgaudit settings easily! • Divide a server log into a pgaudit log. It seems to me that ...
  • 40. 39Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit! Why not? So we forked the pgaudit and add some new features. NTT OSS Center pgaudit (called NTT pgaudit today) https://github.com/ossc-db/pgaudit/tree/refactored NTT pgaudit enhancement points. • Restarting PostgreSQL is needed to change audit settings.  NTT pgaudit config file is divided from postgresql.conf • Divide a server log into an audit log.  Audit logs is sent to log management server by Syslog. • Rich Log filter.  Minimum log size. ↑refactored branch is latest.
  • 41. 40Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit NTT pgaudit configuration file consists of three sections. [output] Logger settings you use server log or syslog. [option] Some misc. configurations. [rule] Filter rules. For description, please read the README!
  • 42. 41Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit • Restarting PostgreSQL is needed to change audit settings. $ vi $PGDATA/postgresql.conf shared_preload_libraries = 'pgaudit' pgaudit.config_file = '/path/to/pgaudit.conf' NTT pgaudit has only two parameters in postgresql.conf Other pgaduit parameters are in pgaudit.conf. # login by auditor $ vim /audit_conf/pgaudit.conf # some settings... [output] logger= 'serverlog‘ ... $ chmod +r /path/to/pgaudit.conf $ ll /path/to/pgaudit.conf -rw-rw-r--. 1 auditer auditer 384 11月 25 23:33 /path/to/pgaudit.conf Only the auditor had better be able to edit pgaudit.conf -> Superuser can not edit pgaudit.conf!
  • 43. 42Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit • Divide a server log into an audit log. NTT pgaudit can export to serverlog or syslog. Parameters in [output] section Parameter Description Remarks logger Logger you use; serverlog or syslog - pathlog Specifies the socket to which syslog listens Parameter for syslog facility See man 3 syslog for value Parameter for syslog priority See man 3 syslog for value Parameter for syslog ident See man 3 syslog for value Parameter for syslog option See man 3 syslog for value Parameter for syslog server log information for operating information for auditing auditer operator NTT pgaudit log
  • 44. 43Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit • Rich Log filter. NTT pgaudit has these filters. Parameters in [rule] section. NTT pgaudit can have several [rule] sections. Field name Description Sample setting timestamp Timestamp range timestamp = '09:00:00 - 10:00:00, 18:00:00 - 18:30:00 database Database name datebase = 'prodcut_db' audit_role Role name audit_role ='superuser1' class Type of operation. Possible values are, BACKUP, CONNECT, DDL, ERROR, FUNCTION, MISC, READ, ROLE, WRITE, SYSTEM class = 'READ, WRITE' command_tag command_tag = 'CREATE, SELECT' object_type Type of object. Possible values are, TABLE, INDEX, SEQUENCE, TOAST_VALUE, VIEW, MATERIALIZED_VIEW, COMPOSITE_TYPE, FOREIGN_TABLE, FUNCTION object_type = 'TABLE, INDEX' object_name Qualified object name object_name = 'myschema.hoge_table' application_name Connecting application name application_name = 'myapp' remote_host Host name remote_host = 'ap_server'
  • 45. 44Copyright©2017 NTT Corp. All Rights Reserved. Example use case AP user Auditor OLTP AP PostgreSQL primary BI User Analysis AP PostgreSQL secondary Audit log management server Administration Task Audit task Replication Audit All SQL DB admin Operation Task DB ops pgaudit syslog pgaudit syslog Fluentd Fluentd • Each audit logs are also audited by auditdAudit READ and WRITE SQL to important table Audit all READ SQL to ALL table https://access.redhat.com/doc umentation/en- US/Red_Hat_Enterprise_Linux/ 7/html/Security_Guide/chap- system_auditing.html Audit All SQL
  • 46. 45Copyright©2017 NTT Corp. All Rights Reserved. Wrap up. PostgreSQL can conform to PCI DSS by the following things. • Set basic configurations. • Use pgcrypto. • Use a directory service. • Use NTT pgaudit. Should be better. • TDE (Transparent Data Encryption). • KMS (Key Management Service). • Operation without superuser privilege.
  • 47. 46Copyright©2017 NTT Corp. All Rights Reserved. END
  • 48. 47Copyright©2017 NTT Corp. All Rights Reserved. 0 10000 20000 30000 40000 50000 60000 70000 80000 90000 log_statement=none log_statement=all (log size 14MB/s) ntt_puaudit (no output) pgbench(read only, scale 100) TPS NTT pgaudit Performance evaluation. 13%down 6%down TPS If you define targets of the audit event, the performance degradation is suppressed to a minimum. Please try it! And provide us the feedback!
  • 49. 48Copyright©2017 NTT Corp. All Rights Reserved. Disk encryption • Disk encryption is allowed by PCI DSS, But how to apply to PostgreSQL? Requirement 3.4.1 If disk encryption is used (rather than file- or column-level database encryption), logical access must be managed separately and independently of native operating system authentication and access control mechanisms (for example, by not using local user account databases or general network login credentials). Decryption keys must not be associated with user accounts. Note: This requirement applies in addition to all other PCI DSS encryption and key-management requirements.
  • 50. 49Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit Get Started! • Install PostgreSQL $ # sudo yum install readline readline-devel zlib zlib-devel bison bison-devel flex flex-devel $ git cloene https://github.com/postgres/postgres.git $ cd postgres $ ./configure --enable-debug --prefix=/usr/local/pgsql_latest/ --with-pgport=5555 $ make -j 4 $ sudo make install $ cd postgres/contrib $ git clone https://github.com/ossc-db/pgaudit.git $ cd pgaudit/ $ git checkout -b refactored remotes/origin/refactored $ make $ sudo make install • Install NTT pgaudit
  • 51. 50Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit Get Started! • Configuration postgresql.conf $ vim /home/masanori/data/postgresql.conf shared_preload_libraries = 'pgaudit' log_connections = on log_disconnections = on log_replication_commands = on pgaudit.config_file = '/audit_conf/pgaudit.conf' DB admin creates and edits postgresql.conf
  • 52. 51Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit Get Started! • Configuration pgaudit.conf $ vim /audit_conf/pgaudit.conf # Where to log (e.g. log to serverlog). [output] logger= 'serverlog' # Behavior of the PGAUDIT (e.g. setting log_catalog) [option] log_catalog = true # Selection conditions of the Session-Audit-Logging. [rule] format = 'CONNECTION: %d,%u,"%connection_message"' class = 'CONNECT' [rule] format = 'DML: %d,%u,%class,%command_tag,"%object_name","%command_text"' class = 'READ,WRITE‘ $ chmod +r /audit_conf/pgaudit.conf $ ll /audit_conf/pgaudit.conf -rw-rw-r--. 1 auditer auditer 384 11月 25 23:33 /audit_conf/pgaudit.conf Auditor creates and edits pgaudit.conf -> DB admin can not edit pgaudit.conf!
  • 53. 52Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit Get Started! • Start PostgreSQL $ /usr/local/pgsql_latest/bin/pg_ctl start -D /home/masanori/data waiting for server to start....2016-11-25 23:36:53.469 JST [21880] LOG: log_catalog = 1 2016-11-25 23:36:53.469 JST [21880] LOG: log_level_string = (null) 2016-11-25 23:36:53.469 JST [21880] LOG: log_level = 15 2016-11-25 23:36:53.469 JST [21880] LOG: log_parameter = 0 2016-11-25 23:36:53.469 JST [21880] LOG: log_statement_once = 0 2016-11-25 23:36:53.469 JST [21880] LOG: log_for_test = 0 2016-11-25 23:36:53.469 JST [21880] LOG: role = ... skip ... 2016-11-25 23:36:53.469 JST [21880] LOG: Rule 0 2016-11-25 23:36:53.469 JST [21880] LOG: BMP class = 2 2016-11-25 23:36:53.469 JST [21880] LOG: Rule 1 2016-11-25 23:36:53.469 JST [21880] LOG: BMP class = 320 2016-11-25 23:36:53.469 JST [21880] LOG: pgaudit extension initialized 2016-11-25 23:36:53.489 JST [21881] LOG: database system was shut down at 2016-11-25 23:11:15 JST 2016-11-25 23:36:53.489 JST [21881] LOG: MultiXact member wraparound protections are now enabled 2016-11-25 23:36:53.492 JST [21880] LOG: database system is ready to accept connections 2016-11-25 23:36:53.493 JST [21887] LOG: logical replication launcher started 2016-11-25 23:36:53.493 JST [21885] LOG: autovacuum launcher started After starting PostgreSQL, the audit setting is logged.
  • 54. 53Copyright©2017 NTT Corp. All Rights Reserved. NTT pgaudit Get Started! • Access to PostgreSQL $ /usr/local/pgsql_latest/bin/psql -p 5555 -d postgres 2016-11-25 23:40:24.276 JST [21909] LOG: AUDIT: SESSION,,,CONNECT,2016-11-25 23:40:24 JST,,,[local],[unknown],,0,00000,connection received: host=[local],,,,, 2016-11-25 23:40:24.276 JST [21909] LOG: connection received: host=[local] 2016-11-25 23:40:24.277 JST [21909] LOG: AUDIT: SESSION,,,CONNECT,2016-11-25 23:40:24 JST,postgres,Masanori,[local],[unknown],3/10,0,00000,connection authorized: user=Masanori database=postgres,,,,, 2016-11-25 23:40:24.277 JST [21909] LOG: connection authorized: user=Masanori database=postgres connection logs is exported.