Memecahkan masalah integrasi Active Directory di AlloyDB Omni

Pilih versi dokumentasi:

Dokumen ini menjelaskan error yang mungkin Anda alami saat mengintegrasikan Active Directory di AlloyDB Omni. Contoh error dan perbaikan yang direkomendasikan juga diberikan.

Integrasi Active Directory dengan AlloyDB Omni gagal

Jika Active Directory tidak berfungsi, ikuti langkah-langkah berikut untuk menyelesaikan masalah:

  1. Verifikasi file keytab. Pastikan Anda dapat terhubung ke server Active Directory menggunakan keytab yang Anda peroleh:

    kinit -kt PATH_TO_KEYTAB_FILE postgres/DBCLUSTER_HOST@REALM
    
  2. Verifikasi host.

    Pastikan host yang Anda gunakan saat membuat file keytab adalah host yang sama dalam perintah psql, seperti yang ditunjukkan dalam contoh berikut:

    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
    

    Pastikan DBCLUSTER_HOST sama di kedua perintah.

  3. Verifikasi file krb5.conf.

    Verifikasi konten file krb5.conf di klien. Pastikan konten file krb5.conf sudah benar untuk konfigurasi Anda.

    cat /etc/krb5.conf
    

    Berikut adalah output yang diharapkan:

    [libdefaults]
      default_realm = REALM
    [realms]
      REALM = {
          kdc = KDC_HOST
          admin_server = ADMIN_SERVER
      }
    [domain_realm]
      HOST_DOMAIN_1 = REALM
      HOST_DOMAIN_2 = REALM
    
  4. Verifikasi entri dan status HBA.

    1. Jalankan perintah berikut dan kirim log ke tim produk AlloyDB Omni.

      psql -h DBCLUSTER_HOST -U postgres -d postgres
      

      psql akan meminta sandi pengguna postgres:

      Password for user postgres:
      

      psql menampilkan output berikut:

      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.
      
    2. Jalankan perintah berikut di prompt psql:

      postgres=# table pg_hba_file_rules ;
      

      Output yang mirip dengan contoh berikut akan ditampilkan.

      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       |                          |
      
  5. Tinjau pesan error di kolom error, yang dapat membantu Anda mengidentifikasi masalah konfigurasi.

  6. Cetak log tingkat 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

Deskripsi

Error ini terjadi saat pengguna sistem, yang mencoba terhubung, tidak memiliki pengguna PostgreSQL yang dibuat, atau tidak memiliki peran yang dipetakan.

Perbaikan yang direkomendasikan

Buat peran di PostgreSQL dengan nama pengguna yang diperlukan, atau tambahkan entri untuk pengguna ini ke file pg_ident.conf.

psql (16.3)
Type "help" for help.

postgres=# CREATE ROLE user2 WITH LOGIN;
CREATE ROLE

Mulai ulang server gagal dengan error: "could not load /var/lib/postgresql/data/pg_hba.conf" (tidak dapat memuat /var/lib/postgresql/data/pg_hba.conf)

Deskripsi

Mulai ulang server gagal karena pg_hba.conf berisi entri yang tidak valid.

Perbaikan yang direkomendasikan

Periksa file pg_hba.conf untuk mengetahui apakah ada entri yang tidak valid.

FATAL: Sinkronisasi grup LDAP gagal

Deskripsi

Sinkronisasi LDAP gagal saat pengguna mencoba login.

Perbaikan yang direkomendasikan

  1. Login sebagai pengguna postgres dan jalankan perintah berikut:

    CREATE EXTENSION google_pg_auth;
    
  2. Periksa file postgresql.log untuk mengetahui informasi tentang alasan kegagalan login LDAP.

    cat /obs/diagnostic/postgresql.log | grep google_pg_auth
    

Langkah berikutnya