バージョンごとのドキュメント一覧

21.4. Trust認証 #

<title>Trust Authentication</title>

When <literal>trust</literal> authentication is specified, <productname>PostgreSQL</productname> assumes that anyone who can connect to the server is authorized to access the database with whatever database user name they specify (even superuser names). Of course, restrictions made in the <literal>database</literal> and <literal>user</literal> columns still apply. This method should only be used when there is adequate operating-system-level protection on connections to the server. trust認証が指定されるとPostgreSQLは、サーバに接続できる全ての人に対して (データベーススーパーユーザさえも)その人が指定する任意のデータベースユーザ名としてのアクセス権限が付与されていると想定します。 当然ながらdatabaseuser列にある制限は適用されます。 この方式はサーバに接続する際に適切なオペレーティングシステムレベルの保護が掛けられている場合にのみ使用すべきです。

<literal>trust</literal> authentication is appropriate and very convenient for local connections on a single-user workstation. It is usually <emphasis>not</emphasis> appropriate by itself on a multiuser machine. However, you might be able to use <literal>trust</literal> even on a multiuser machine, if you restrict access to the server's Unix-domain socket file using file-system permissions. To do this, set the <varname>unix_socket_permissions</varname> (and possibly <varname>unix_socket_group</varname>) configuration parameters as described in <xref linkend="runtime-config-connection"/>. Or you could set the <varname>unix_socket_directories</varname> configuration parameter to place the socket file in a suitably restricted directory. trust認証はユーザが1人のみのワークステーション上でローカル接続を行う場合に適切で非常に便利です。 複数ユーザが存在するマシン上では一般的に適切ではありません。 とは言っても、ファイルシステムの許可属性を使ってサーバのUnixドメインソケットファイルへのアクセスを制限すればtrust認証を複数ユーザのマシン上で使用することも可能です。 その方法は、20.3に記載されているようにunix_socket_permissions(およびunix_socket_groupパラメータの可能性もあります)パラメータを設定します。 もしくは、unix_socket_directories設定パラメータでソケットファイルをそれに相応しく制限されているディレクトリにします。

Setting file-system permissions only helps for Unix-socket connections. Local TCP/IP connections are not restricted by file-system permissions. Therefore, if you want to use file-system permissions for local security, remove the <literal>host ... 127.0.0.1 ...</literal> line from <filename>pg_hba.conf</filename>, or change it to a non-<literal>trust</literal> authentication method. ファイルシステムの許可を設定することが役に立つのはUnixソケット接続だけです。 ローカルのTCP/IP接続は、ファイルシステムにより制限はされていません。 よってローカルでファイルシステムの許可を使用したい場合はpg_hba.confから host ... 127.0.0.1 ...の行を削除するか、trust認証とは異なる方法に変更する必要があります。

<literal>trust</literal> authentication is only suitable for TCP/IP connections if you trust every user on every machine that is allowed to connect to the server by the <filename>pg_hba.conf</filename> lines that specify <literal>trust</literal>. It is seldom reasonable to use <literal>trust</literal> for any TCP/IP connections other than those from <systemitem>localhost</systemitem> (127.0.0.1). TCP/IP接続におけるtrust認証は、trustを指定するpg_hba.confの行によってサーバに接続を許可される全てのマシン上の全てのユーザを信用(trust)できる場合にのみ相応しいものです。 localhost(127.0.0.1)以外からのTCP/IP接続にtrust認証を用いる理由はほとんど見当たりません。