Movatterモバイル変換


[0]ホーム

URL:



Facebook
Postgres Pro
Facebook
Downloads
32.18. LDAP Lookup of Connection Parameters
Prev UpChapter 32. libpq — C LibraryHome Next

32.18. LDAP Lookup of Connection Parameters#

Iflibpq has been compiled with LDAP support (option--with-ldap forconfigure) it is possible to retrieve connection options likehost ordbname via LDAP from a central server. The advantage is that if the connection parameters for a database change, the connection information doesn't have to be updated on all client machines.

LDAP connection parameter lookup uses the connection service filepg_service.conf (seeSection 32.17). A line in apg_service.conf stanza that starts withldap:// will be recognized as an LDAP URL and an LDAP query will be performed. The result must be a list ofkeyword = value pairs which will be used to set connection options. The URL must conform toRFC 1959 and be of the form

ldap://[hostname[:port]]/search_base?attribute?search_scope?filter

wherehostname defaults tolocalhost andport defaults to 389.

Processing ofpg_service.conf is terminated after a successful LDAP lookup, but is continued if the LDAP server cannot be contacted. This is to provide a fallback with further LDAP URL lines that point to different LDAP servers, classicalkeyword = value pairs, or default connection options. If you would rather get an error message in this case, add a syntactically incorrect line after the LDAP URL.

A sample LDAP entry that has been created with the LDIF file

version:1dn:cn=mydatabase,dc=mycompany,dc=comchangetype:addobjectclass:topobjectclass:devicecn:mydatabasedescription:host=dbserver.mycompany.comdescription:port=5439description:dbname=mydbdescription:user=mydb_userdescription:sslmode=require

might be queried with the following LDAP URL:

ldap://ldap.mycompany.com/dc=mycompany,dc=com?description?one?(cn=mydatabase)

You can also mix regular service file entries with LDAP lookups. A complete example for a stanza inpg_service.conf would be:

# only host and port are stored in LDAP, specify dbname and user explicitly[customerdb]dbname=customeruser=appuserldap://ldap.acme.com/cn=dbserver,cn=hosts?pgconnectinfo?base?(objectclass=*)


Prev Up Next
32.17. The Connection Service File Home 32.19. SSL Support
pdfepub
Go to Postgres Pro Standard 17
By continuing to browse this website, you agree to the use of cookies. Go toPrivacy Policy.

[8]ページ先頭

©2009-2025 Movatter.jp