Sample Exam Questions

From the objective of OSS-DB Exam Silver
- Operation and Management - configuration file (pg_hba.conf)

Sample Question

1.18

The user test 1 on the client dbclient (192.168.1.12) connects to the database running on the host dbserver (192.168.1.11) using psql. Given the contents of pg_hba.conf as follows, choose two appropriate answer from the following description.
local all all peer
host test all 192.168.1.12/32 trust
host all all 192.168.1.0/24 md5

  1. When connecting with the user named test 1 to the database named test 1, it is authenticated without a password. 
  2. When connecting with the user named test 1 to the database named test1, it is authenticated without a password. 
  3. When connecting with the user named test to the database named test 1, it is authenticated with the password. 
  4. When connecting with the user named test to the database named test, it is authenticated with a password.
  5. When connecting with the user named test 1 to the database named test 2, the connection is rejected.

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2019/03/04

Answer and Explanation

pg_hba.conf is a file describing the method of client authentication. 

It searches from the top one that matches with the combination of the client of the connection source, the database name of the connection destination, and the user name at the time of connection, and the authentication method described on the first line found is used. 

The first column is often local corresponding to a connection using Unix domain socket or host corresponding to TCP / IP connection. 

The second column is the name of the database to connect to and the third column is the name of the database user at the time of connection, but all represents wildcards, representing all databases or all users respectively. 

When it is host, the fourth column represents the originating client. 

The fourth column of local and the fifth column of host are the authentication method and there are peer and ident to check whether the user name of the OS matches the user name of the DB and there are md 5 of password authentication and unconditionally. There are trust which allow connection, reject which unconditionally refuse connection.

The first line of the example of the pg_hba.conf is specified that the peer authenticate with the local, but because in the example of the scenario of TCP / IP connection, it is ignored. 

On the second line, when connecting to the database called test from the IP address of 192.168.1.12, regardless of the name of the database user at the time of connection, it is allowed unconditional connection

The third line connection from the host on the network of 192.168.1.0/24 is, any database, regardless of user is performed the password authentication.

Choices of B and D is the second line of the system, A, C, and E are authenticated in the manner of a third row 

Therefore, the correct answer is B and C.