Skip to content

Commit e7751f5

Browse files
authored
Merge pull request #990 from lib/krbsrvname
use krbsrvname for GSS auth; improve GSS docs
2 parents 984a6aa + bb1e32b commit e7751f5

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
* Unix socket support
2020
* Notifications: `LISTEN`/`NOTIFY`
2121
* pgpass support
22-
23-
## Optional Features
24-
25-
* GSS (Kerberos) auth (to use, see GoDoc)
22+
* GSS (Kerberos) auth
2623

2724
## Tests
2825

conn.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1074,9 +1074,9 @@ func isDriverSetting(key string) bool {
10741074
return true
10751075
case "binary_parameters":
10761076
return true
1077-
case "service":
1077+
case "krbsrvname":
10781078
return true
1079-
case "spn":
1079+
case "krbspn":
10801080
return true
10811081
default:
10821082
return false
@@ -1168,13 +1168,13 @@ func (cn *conn) auth(r *readBuf, o values) {
11681168

11691169
var token []byte
11701170

1171-
if spn, ok := o["spn"]; ok {
1171+
if spn, ok := o["krbspn"]; ok {
11721172
// Use the supplied SPN if provided..
11731173
token, err = cli.GetInitTokenFromSpn(spn)
11741174
} else {
11751175
// Allow the kerberos service name to be overridden
11761176
service := "postgres"
1177-
if val, ok := o["service"]; ok {
1177+
if val, ok := o["krbsrvname"]; ok {
11781178
service = val
11791179
}
11801180

doc.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ supported:
5757
* sslkey - Key file location. The file must contain PEM encoded data.
5858
* sslrootcert - The location of the root certificate file. The file
5959
must contain PEM encoded data.
60-
* spn - Configures GSS (Kerberos) SPN.
61-
* service - GSS (Kerberos) service name to use when constructing the SPN (default is `postgres`).
6260
6361
Valid values for sslmode are:
6462
@@ -259,5 +257,12 @@ package:
259257
This package is in a separate module so that users who don't need Kerberos
260258
don't have to download unnecessary dependencies.
261259
260+
When imported, additional connection string parameters are supported:
261+
262+
* krbsrvname - GSS (Kerberos) service name when constructing the
263+
SPN (default is `postgres`). This will be combined with the host
264+
to form the full SPN: `krbsrvname/host`.
265+
* krbspn - GSS (Kerberos) SPN. This takes priority over
266+
`krbsrvname` if present.
262267
*/
263268
package pq

0 commit comments

Comments
 (0)