פתרון בעיות בשילוב של Active Directory ב-AlloyDB Omni

בחירת גרסה של מאמר העזרה:

במסמך הזה מתוארות שגיאות שיכולות להתרחש כשמשלבים Active Directory ב-AlloyDB Omni. יש גם דוגמאות לשגיאות ולהמלצות לתיקון.

‫Active Directory לא פועל

תיאור

‫Active Directory לא פועל ב-AlloyDB Omni בגלל רשומות pg_hba.conf שגויות. אם הרשומות שהוספתם לקובץ pg_hba.conf לא תקינות, המערכת AlloyDB ל-PostgreSQL מתעלמת מהן. כתוצאה מכך, מנגנון האימות שצוין לא יפעל.

תיקון מומלץ

כדי לראות את הודעת השגיאה, כולל מידע על פתרון הבעיה, צריך להיכנס אל psql ולהריץ את הפקודה הבאה:

docker exec -it alloydb_docs psql -h localhost -U postgres
psql (16.3)
Type "help" for help.
postgres=# table pg_hba_file_rules ;
 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       |                          |

‪psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: FATAL: role "user2" does not exist

תיאור

השגיאה הזו מתרחשת כשמשתמש במערכת שמנסה להתחבר לא יצר משתמש PostgreSQL או לא מיפה תפקיד.

תיקון מומלץ

יוצרים תפקיד ב-PostgreSQL עם שם המשתמש הנדרש, או מוסיפים רשומה למשתמש הזה לקובץ pg_ident.conf.

psql (16.3)
Type "help" for help.

postgres=# CREATE ROLE user2 WITH LOGIN;
CREATE ROLE

ההפעלה מחדש של השרת נכשלת עם השגיאה: "לא ניתן לטעון את ‎ /var/lib/postgresql/data/pg_hba.conf"

תיאור

ההפעלה מחדש של השרת נכשלה כי הקובץ pg_hba.conf מכיל רשומות לא תקינות.

תיקון מומלץ

בודקים אם יש רשומות לא תקינות בקובץ pg_hba.conf.

המאמרים הבאים