PostgreSQL check fails with "GSSAPI authentication not supported" after Agent upgrade (psycopg2 → psycopg3)
team/database-monitoring-agent
**Agent version:** 7.72.1 (broken), 7.54 (working)
**OS:** Debian Linux x86_64
**Integration:** PostgreSQL (`datadog_checks/postgres`)
#### Problem
After upgrading to Agent 7.72.1, the PostgreSQL check fails on all instances using GSSAPI (Kerberos) authentication:
```
psycopg.OperationalError: connection failed: connection to server at "172.23.3.93", port 5445 failed:
GSSAPI authentication not supported
```
#### Root Cause
The `libpq` built in `.builders/images/linux-x86_64/Dockerfile` (and `linux-aarch64`, `macos`) is compiled without `--with-gssapi`:
```dockerfile
bash install-from-source.sh --without-readline --with-openssl --without-icu
```
This libpq gets bundled into the `psycopg_c` wheel. Since it lacks GSSAPI support, Kerberos authentication is impossible.
The previous agent used `psycopg2-binary`, which bundled its own libpq **with** GSSAPI and Kerberos libraries (`libgssapi_krb5`, `libkrb5`, `libsasl2`, etc.). The psycopg3 migration (PR #21173, v22.18.0) lost this.
**Verified via `ldd` on deployed agents:**
- Agent 7.54: `psycopg2_binary.libs/libpq` links to `libgssapi_krb5`, `libkrb5`, `libsasl2` — GSSAPI works
- Agent 7.72: `psycopg_c.libs/libpq` has no GSSAPI linkage — GSSAPI fails
#### Proposed Fix
Add `--with-gssapi` to the PostgreSQL configure step. krb5 1.20.1 is already built in the builder images, so this is a one-line change per platform:
```diff
# .builders/images/linux-x86_64/Dockerfile
- bash install-from-source.sh --without-readline --with-openssl --without-icu
+ bash install-from-source.sh --without-readline --with-openssl --without-icu --with-gssapi
# .builders/images/linux-aarch64/Dockerfile
- bash install-from-source.sh --without-readline --with-openssl --without-icu
+ bash install-from-source.sh --without-readline --with-openssl --without-icu --with-gssapi
# .builders/images/macos/builder_setup.sh
- install-from-source --without-readline --with-openssl --without-icu
+ install-from-source --without-readline --with-openssl --without-icu --with-gssapi="${DD_PREFIX_PATH}"
```
3 条评论