Reputation: 11228
I have Postgres DB that uses kerberos authentication. So I configured my /etc/krb5.conf
file, run kinit
and now can use it, for example in python code:
import psycopg2
conn = psycopg2.connect(
host="database.address.com",
database="tested",
user="username",
port=5472
)
# Get version
cursor = conn.cursor()
cursor.execute('SELECT VERSION()')
row = cursor.fetchone()
print(row)
It works perfectly, but sometime it is very useful to have ability to watch data in tables. I want to use DataGrip, but I can't figured out how to connect it to DB.
I found some old question about it: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000757404-DataGrip-Mac-Kerberos-Authentication-with-PostgreSQL
-Djava.security.krb5.realm=realm -Djava.security.krb5.kdc=kdc
but can't understand how to get correct values for realm
and kdc
Upvotes: 0
Views: 3296
Reputation: 1458
pgjdbc { com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true debug=true renewTGT=true doNotPrompt=true; };
Open up data source properties, go to Advanced tab and add this to VM options field: -Djava.security.auth.login.config=<path_to>/jaas.conf
If it does not help and you have working krb5.conf also add this -Djava.security.krb5.conf=/etc/krb5.conf
to the VM options
If it still does not work, please ask your DBA for kdc
and realm
names.
Upvotes: 1