postgresqlHow do I configure PostgreSQL to use Kerberos authentication?
- Install the Kerberos client packages on the host running PostgreSQL:
$ sudo apt-get install krb5-user
- Create a Kerberos principal for the PostgreSQL user:
$ kadmin.local
kadmin.local: addprinc postgres/<hostname>
kadmin.local: exit
- Create a keytab file for the PostgreSQL user:
$ kadmin.local
kadmin.local: ktadd -k /etc/postgresql.keytab postgres/<hostname>
kadmin.local: exit
- Configure the PostgreSQL server to use Kerberos authentication:
Edit the file
/etc/postgresql/9.6/main/pg_hba.conf
and add the following line:
host all all 0.0.0.0/0 gss include_realm=0
- Restart the PostgreSQL server:
$ sudo service postgresql restart
- Configure the Kerberos client on the PostgreSQL host:
Edit the file
/etc/krb5.conf
and add the following lines:
[libdefaults]
default_realm = <YOUR_REALM>
[realms]
<YOUR_REALM> = {
kdc = <KDC_SERVER_IP_ADDRESS>
}
- Test the Kerberos authentication:
$ psql -U postgres -h localhost
Password for user postgres:
psql (9.6.11)
Type "help" for help.
postgres=#
Helpful links
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I use PostgreSQL with YAML?
- How can I use PostgreSQL XOR to compare two values?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How do I parse XML data using PostgreSQL?
- How do I set the PostgreSQL work_mem parameter?
- How do I use a PostgreSQL XML parser in an example?
- How can I convert XML data to a PostgreSQL table?
- How do I set up a web interface for PostgreSQL?
See more codes...