L'integrazione di Active Directory con AlloyDB Omni non riesce
Quando Active Directory non funziona, segui questi passaggi per risolvere il problema:
Verifica il file keytab. Assicurati di poter connetterti al server Active Directory utilizzando il file keytab che hai ottenuto:
kinit -kt PATH_TO_KEYTAB_FILE postgres/DBCLUSTER_HOST@REALM
Verifica l'host.
Assicurati che l'host utilizzato per generare il file keytab sia lo stesso host nel comando psql, come mostrato nell'esempio seguente:
KTPass /princ postgres/DBCLUSTER_HOST@REALM /Pass PASSWORD /mapuser postgres /crypto ALL /ptype KRB5_NT_Principal /out OUTPUT_PATH psql -h DBCLUSTER_HOST -d DB_NAME -U USERNAME@REALM
Assicurati che
DBCLUSTER_HOST
sia lo stesso in entrambi i comandi.Verifica il file
krb5.conf
.Verifica i contenuti del file
krb5.conf
sul client. Assicurati che i contenuti del filekrb5.conf
siano corretti per la tua configurazione.cat /etc/krb5.conf
Di seguito è riportato l'output previsto:
[libdefaults] default_realm = REALM [realms] REALM = { kdc = KDC_HOST admin_server = ADMIN_SERVER } [domain_realm] HOST_DOMAIN_1 = REALM HOST_DOMAIN_2 = REALM
Verifica le voci e lo stato dell'HBA.
Esegui i seguenti comandi e invia i log al team di prodotto AlloyDB Omni.
psql -h DBCLUSTER_HOST -U postgres -d postgres
psql
ti chiede la password dell'utentepostgres
:Password for user postgres:
psql
restituisce il seguente output:psql (17.5 (Ubuntu 17.5-0ubuntu0.25.04.1), server 16.3) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: none) Type "help" for help.
Esegui questo comando nel prompt
psql
:postgres=# table pg_hba_file_rules ;
Viene restituito un output simile al seguente esempio.
rule_number | file_name | line_number | type | database | user_name | address | netmask | auth_method | options | error -------------+--------------------------------------+-------------+---------+----------+--------------------+-----------+-----------------------------------------+-------------+--------------------------+----------------------------------------------------- 1 | /var/lib/postgresql/data/pg_hba.conf | 1 | host | {all} | {alloydbadmin} | 127.0.0.1 | 255.255.255.255 | trust | | | /var/lib/postgresql/data/pg_hba.conf | 2 | hostssl | {all} | {alloydbadmin} | ::1 | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | trust | | hostssl record cannot match because SSL is disabled | /var/lib/postgresql/data/pg_hba.conf | 3 | hostssl | {all} | {alloydbpgbouncer} | 0.0.0.0 | 0.0.0.0 | cert | {clientcert=verify-full} | hostssl record cannot match because SSL is disabled | /var/lib/postgresql/data/pg_hba.conf | 4 | hostssl | {all} | {alloydbpgbouncer} | ::1 | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | cert | {clientcert=verify-full} | hostssl record cannot match because SSL is disabled | /var/lib/postgresql/data/pg_hba.conf | 5 | hostssl | {all} | {alloydbadmin} | all | | reject | | hostssl record cannot match because SSL is disabled | /var/lib/postgresql/data/pg_hba.conf | 6 | | | | | | | | invalid CIDR mask in address "0.0.0.0/1000" 2 | /var/lib/postgresql/data/pg_hba.conf | 7 | local | {all} | {all} | | | trust | |
Esamina i messaggi di errore nella colonna
error
, che possono aiutarti a identificare i problemi di configurazione.Stampa i log del livello di debug
krb5
.export KRB5_TRACE=/dev/stderr kinit AD_USER@REALM psql -h DBCLUSTER_HOST -d DB_NAME -U USERNAME@REALM
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: role "user2" does not exist
Descrizione
Questo errore si verifica quando un utente di sistema che tenta di connettersi non ha un utente PostgreSQL creato o non ha un ruolo mappato.
Correzione consigliata
Crea un ruolo in PostgreSQL con il nome utente richiesto o aggiungi una voce per questo utente al file pg_ident.conf
.
psql (16.3)
Type "help" for help.
postgres=# CREATE ROLE user2 WITH LOGIN;
CREATE ROLE
Il riavvio del server non riesce e viene visualizzato l'errore: "could not load /var/lib/postgresql/data/pg_hba.conf"
Descrizione
Il riavvio del server non è riuscito perché pg_hba.conf
contiene voci non valide.
Correzione consigliata
Controlla il file pg_hba.conf
per rilevare voci non valide.
FATAL: LDAP group synchronization failed
Descrizione
La sincronizzazione LDAP non riesce quando l'utente tenta di accedere.
Correzione consigliata
Accedi come utente
postgres
ed esegui il seguente comando:CREATE EXTENSION google_pg_auth;
Controlla il file
postgresql.log
per informazioni sul motivo per cui l'accesso LDAP non è riuscito.cat /obs/diagnostic/postgresql.log | grep google_pg_auth