2017-07-11 7 views
1

私はWindowsベースのローカルネットワーク上で作業しています。ネットワークのアカウントシステムを使用して、ユーザが自分のDBに接続できるようにしたいと考えています。PostgreSQL 9.5 pg_hbaでidentを使用する

私は適切な方法は以下のような「IDENT」のpg_hba方法を設定することであることを理解したよう:

host all all 10.0.0.0/8  ident 

しかし、私はそうするとき、私は限り

"Error connecting to the server: FATAL: ident authentication failed for user <user>" 

を言ってメッセージを取得します私はそれを考えることができます、私の推測は、2つの問題がある可能性があるということです: - 私は正しくpg_hbaを設定しません。 - 私が作成した役割は、サーバーが見つけたIDと一致しません。

最初のケースでは、構文が正しいかどうかを知ることができますか?私はidentの後に "sameuser"を追加しようとしましたが、pg_hbaが壊れてしまい、map = sameuserとなってしまいましたが、同じエラーが表示されました。第2のケースで

は、私は同じ結果を生成

find /c "%username%" 

またはPython3.6機能os.getlogin()、のようなユーザー名を取得するために、すべてのセッションでバッチ実行を使用しています。

PostgreSQLはどのようにして "ident"を取得しますか?さらに重要なことに、このプロセスを再現して、PostgreSQLが認識するセッションのIDを知ることができますか?

ありがとうございました。

答えて

1

ident.conf manualを読み取り、hba_file manualからの例を使用した後、私はこれを設定:

[email protected]:~$ psql -h 192.168.8.107 -U ident_user_db 
psql: FATAL: Ident authentication failed for user "ident_user_db" 
FATAL: Ident authentication failed for user "ident_user_db" 

postgres=# create user ident_user_db; 
CREATE ROLE 
[email protected]:~$ sudo tail -n 1 /etc/postgresql/9.6/main/pg_hba.conf 
host all    all    192.168.8.0/24   ident map=vao_ident 
[email protected]:~$ sudo tail -n 1 /etc/postgresql/9.6/main/pg_ident.conf 
vao_ident   vao   ident_user_db 

は今、私はその外部IPに同じマシンから接続しています

おなじみです。私はマニュアルに従ったが。最後に確認する:

[email protected]:~$ telnet localhost 113 
Trying 127.0.0.1... 
telnet: Unable to connect to remote host: Connection refused 

私のアイデンティティは何もありません。 here

[email protected]:~$ sudo apt-get install oidentd 
... 
[email protected]:~$ telnet localhost 113 
Trying 127.0.0.1... 
Connected to localhost. 
Escape character is '^]'. 
^] 
telnet> quit 
Connection closed. 

を助言して今試してみてください。

[email protected]:~$ psql -h 192.168.8.107 -U ident_user_db -d vao 
psql (9.6.3) 
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off) 
Type "help" for help. 

はそれが

+0

ホープあなたの広範囲の答えをいただき、ありがとうございます。残念ながら、あなたのコードで "sudo"が正しく認識されていれば、これはLinux環境で動作します。私の場合、私は完全なWindowsで作業しているので、私はあなたの答えを使用することができないようです...(そして、私はidentプロトコルがWindowsで利用できないかもしれないということを私の検索で読んだのです...) –

+0

https ://www.google.lt/search?espv = 2&q = Windows + Ident +サーバー&oq = Windows + Ident +サーバー&gs_l = serp.3..0j0i22i30k1l3.787.787.0.1678.1.1.0.0.0.0.98.98.1.1.0。 ... 0 ... 1.1.64.serp..0.1.97.beVICgkCXkw Google検索の一部 –

関連する問題