質問:

質問:

私は最近、小規模オフィスネットワークの集中認証を処理するために新しいSamba4 Active Directoryを設定しました。サーバーにpostgresql-9.5インスタンスがあり、ADに対して認証を取得しようとしています。違いを認識してください。確認する(それが私に必要なものです)承認する(ユーザーが認証されると、これはpostgresqlで完全に処理されると思います。)問題が発生しました。

ADは現在かなりの平均レベルです。ギリギリの秒です。このガイド。一部のユーザーを設定しましたが、デフォルトのKerberos認証が機能しているようです(完了使用、認証使用)。繰り返しますが、有効です。kinit [email protected]klistsmbclient //myhost.samdom.mydomain.tld/netlogon -U 'myusername'

ローカルホストがSamba ADをチェックしており、DNS転送がアップストリームで正しく発生しています。これらのタスクは次のとおりです。

$ host -t SRV _ldap._tcp.samdom.mydomain.tld
$ host -t SRV _kerberos._udp.samdom.mydomain.tld
$ host -t A myhost.samdom.mydomain.tld

現在:ubuntu-16.04サーバー、postgresql-9.5、samba-4.3.9

質問:

ADの認証を有効にするためのSambaおよび/またはPostgres設定で何が失われましたか?

データベース設定

postgresqlへのデフォルトの接続は問題ないようです。現在、適切なインターフェイスを受信して​​おり、ユーザーはpostgres問題なくローカルでコンテンツにアクセスできます。単純なデータベースを設定しましたが、出力は次のとおりです\list

   Name    |   Owner    | Encoding |   Collate   |    Ctype    |   Access privileges
-----------+------------+----------+-------------+-------------+-----------------------
 pgtest2   | myusername | UTF8     | en_US.UTF-8 | en_US.UTF-8 |

リストされたユーザー(党このクエリ):

 User name  | User ID |    Attributes
------------+---------+-------------------
 myusername |   16384 | create database
 postgres   |      10 | superuser, create+
            |         | database

確認に失敗しました

しかし、コンソールで試してみると、次のようになります。

$ psql -h myhost.samdom.mydomain.tld -U [email protected] -d pgtest2
psql: GSSAPI continuation error: Unspecified GSS failure.  Minor code may provide more information
GSSAPI continuation error: No Kerberos credentials available

から/var/log/postgresql/postgresql-9.5-main.log

[email protected]@pgtest2 LOG:  could not receive data from client: Connection reset by peer
[email protected]@pgtest2 FATAL:  GSSAPI authentication failed for user "[email protected]"
[email protected]@pgtest2 DETAIL:  Connection matched pg_hba.conf line 92: "host all all 0.0.0.0/0 gss krb_realm=SAMDOM.MYDOMAIN.TLD include_realm=1 map=krb"

構成ファイル

適切で必要と思われる構成ファイル(部分):

  • /etc/postgresql/9.5/main/pg_hba.conf:

    local   all             postgres                                peer
    local   all             all                                     peer
    host all all 0.0.0.0/0 gss krb_realm=SAMDOM.MYDOMAIN.TLD include_realm=1 map=krb
    host    all             all             127.0.0.1/32            md5
    host    all             all             ::1/128                 md5
    
  • /etc/postgresql/9.5/main/postgres.conf:

    krb_server_keyfile = '/var/lib/postgresql/9.5/main/postgres.keytab'
    

    (キータブはモード400で作成されており、所有しています。)samba-tool domain exportkeytab postgres.keytab -U postgres/[email protected]postgres:postgres

  • /etc/samba/smb.conf:

    # Global parameters
    [global]
            workgroup = SAMDOM
            realm = SAMDOM.MYDOMAIN.TLD
            netbios name = MYHOST
            interfaces = lo eno1
            bind interfaces only = Yes
            server role = active directory domain controller
            dns forwarder = 11.22.33.254
            idmap_ldb:use rfc2307 = yes
            tls enabled =  yes
            tls keyfile = tls/key.pem
            tls certfile = tls/cert.pem
            tls cafile = tls/ca.pem
    [netlogon]
            path = /var/lib/samba/sysvol/samdom.mydomain.tld/scripts
            read only = No
    [sysvol]
            path = /var/lib/samba/sysvol
            read only = No
    

ベストアンサー1

最近、私はsamba4 ADドメインコントローラに対してpostgressユーザーを認証することに直面し、解決策を見つけました。このページから。ご覧のとおり、pg_hba.confのエントリは次のとおりです。

host all all 0.0.0.0/0 ldap ldapserver=localhost ldapprefix="" ldapsuffix="@SAMDOM.MYDOMAIN.TLD"

または、ユーザーを DOMAIN\username で認証する場合:

host all all 0.0.0.0/0 ldap ldapserver=localhost ldapprefix="SANDOM\" ldapsuffix=""

ADに加えて、前述のように、承認メカニズムはpostgresによって内部的に実行されるため、データベースにロールを作成する必要があります。その後、postgresqlを再起動して接続を試みます。

欠点は、「というエラーが発生することです。強力な認証が必要postgresログにあるので、samba confファイルで強力なLDAP認証を無効にし、グローバル設定に以下を追加する必要があります。

ldap server require strong auth = No

おすすめ記事