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 do I show tables in PostgreSQL?
- How can I set a PostgreSQL interval to zero?
- How can I monitor PostgreSQL performance using Zabbix?
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How do I parse XML data using PostgreSQL?
- How can I convert a PostgreSQL timestamp to a date?
- How do I store binary data in a Postgresql database using the bytea data type?
- How can Zalando use PostgreSQL to improve its software development?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How do I install and configure PostgreSQL on a Windows machine?
See more codes...