Re: GSS Auth issue when user member of lots of AD groups

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris Gooch <cgooch(at)bamfunds(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: GSS Auth issue when user member of lots of AD groups
Date: 2025-05-22 15:46:46
Message-ID: 1529314.1747928806@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-committers

[ pgsql-committers is completely inappropriate, redirecting to -bugs ]

Chris Gooch <cgooch(at)bamfunds(dot)com> writes:
> GSS authentication is working for users with small number of AD
> groups but getting below error when a user has larger number of
> groups. I believe it might to token size related, but they don't
> have issues when authenticating with Kerberos/GSS to other
> applications, only with Postgres.

> failed: GSSAPI context establishment error: The routine must be called again to complete its function: Unknown error

Hmm. That must be coming from this bit in libpq:

/* Must have output.length > 0 */
if (output.length > PQ_GSS_SEND_BUFFER_SIZE - sizeof(uint32))
{
pg_GSS_error(libpq_gettext("GSSAPI context establishment error"),
conn, major, minor);
gss_release_buffer(&minor, &output);
return PGRES_POLLING_FAILED;
}

which makes it look like gss_init_sec_context wants us to send a
packet larger than PQ_GSS_SEND_BUFFER_SIZE, which perhaps is a
plausible thing to happen if the user belongs to enough groups.

Unfortunately, elsewhere in the same file:

* NOTE: The client and server have to agree on the max packet size,
* because we have to pass an entire packet to GSSAPI at a time and we
* don't want the other side to send arbitrarily huge packets as we
* would have to allocate memory for them to then pass them to GSSAPI.
*
* Therefore, these two #define's are effectively part of the protocol
* spec and can't ever be changed.
*/
#define PQ_GSS_SEND_BUFFER_SIZE 16384
#define PQ_GSS_RECV_BUFFER_SIZE 16384

Not sure where to go from here. Unfortunately the person who
was mostly responsible for this code has left the project...

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jacob Champion 2025-05-22 16:19:14 Re: GSS Auth issue when user member of lots of AD groups
Previous Message Bertrand Drouvot 2025-05-22 15:31:40 Re: Standby server with cascade logical replication could not be properly stopped under load

Browse pgsql-committers by date

  From Date Subject
Next Message Jacob Champion 2025-05-22 16:19:14 Re: GSS Auth issue when user member of lots of AD groups
Previous Message Nathan Bossart 2025-05-22 15:23:36 pgsql: pg_dump: Adjust reltuples from 0 to -1 for dumps of older versio