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

21.6. GSSAPI認証 #

<title>GSSAPI Authentication</title>

<productname>GSSAPI</productname> is an industry-standard protocol for secure authentication defined in <ulink url="https://tools.ietf.org/html/rfc2743">RFC 2743</ulink>. <productname>PostgreSQL</productname> supports <productname>GSSAPI</productname> for authentication, communications encryption, or both. <productname>GSSAPI</productname> provides automatic authentication (single sign-on) for systems that support it. The authentication itself is secure. If <productname>GSSAPI</productname> encryption or <acronym>SSL</acronym> encryption is used, the data sent along the database connection will be encrypted; otherwise, it will not. GSSAPIは、RFC 2743で定義されている安全な認証のための業界標準のプロトコルです。 PostgreSQLは、GSSAPIを認証、通信の暗号化、あるいはその両方のためにサポートしています。 GSSAPIは、GSSAPIをサポートするシステムに自動認証(シングルサインオン)を提供します。 認証自体は安全です。 GSSAPI暗号化、またはSSL暗号化を使用すると、データベース接続に沿って送信されるデータは暗号化されますが、それ以外の場合は暗号化されません。

GSSAPI support has to be enabled when <productname>PostgreSQL</productname> is built; see <xref linkend="installation"/> for more information. GSSAPIサポートは、PostgreSQLを構築する時に有効にしなければなりません。詳細は、第17章を参照してください。

When <productname>GSSAPI</productname> uses <productname>Kerberos</productname>, it uses a standard service principal (authentication identity) name in the format <literal><replaceable>servicename</replaceable>/<replaceable>hostname</replaceable>@<replaceable>realm</replaceable></literal>. The principal name used by a particular installation is not encoded in the <productname>PostgreSQL</productname> server in any way; rather it is specified in the <firstterm>keytab</firstterm> file that the server reads to determine its identity. If multiple principals are listed in the keytab file, the server will accept any one of them. The server's realm name is the preferred realm specified in the Kerberos configuration file(s) accessible to the server. GSSAPIKerberosを使用しているとき、GSSAPIは、servicename/hostname@realmという書式の標準のサービスプリンシパル名を使用します。 [訳注:プリンシパルとは大雑把に2つのものを指します。1つはサービスを受けるクライアントで、もう1つはサービスを提供するサーバアプリケーションです。どちらも、認証に関してはKerberosのKDCから見るとクライアントになります] 特定のインストールによって使用されるプリンシパル名はPostgreSQLサーバでは決してエンコードされません。 そうではなくて、サーバが自身の識別を決定するために読み込むkeytabファイルで指定されます。 そのkeytabファイルに複数のプリンシパルが列挙されている場合は、サーバはそのうちのどれか一つを受け付けます。 サーバのrealm名は、サーバがアクセスできるKerberos設定ファイルで指定されたものが優先的に採用されます。

When connecting, the client must know the principal name of the server it intends to connect to. The <replaceable>servicename</replaceable> part of the principal is ordinarily <literal>postgres</literal>, but another value can be selected via <application>libpq</application>'s <xref linkend="libpq-connect-krbsrvname"/> connection parameter. The <replaceable>hostname</replaceable> part is the fully qualified host name that <application>libpq</application> is told to connect to. The realm name is the preferred realm specified in the Kerberos configuration file(s) accessible to the client. 接続する際には、クライアントは接続しようとしているサーバのプリンシパル名を知っておかなければなりません。 プリンシパルのservicename部は通常postgresですが、libpqkrbsrvname接続パラメータで選択できます。 hostname部はlibpqが接続要求されている完全修飾ホスト名です。 realm名はクライアントがアクセスできるKerberos設定ファイルで指定されているrealmです。

The client will also have a principal name for its own identity (and it must have a valid ticket for this principal). To use <productname>GSSAPI</productname> for authentication, the client principal must be associated with a <productname>PostgreSQL</productname> database user name. The <filename>pg_ident.conf</filename> configuration file can be used to map principals to user names; for example, <literal>pgusername@realm</literal> could be mapped to just <literal>pgusername</literal>. Alternatively, you can use the full <literal>username@realm</literal> principal as the role name in <productname>PostgreSQL</productname> without any mapping. クライアントは、自身の識別目的でプリンシパル名も持ちます(このプリンシパルの有効なチケットも持っていなければなりません)。 認証にGSSAPIを使うためには、クライアントプリンシパルはPostgreSQLデータベースユーザ名に紐付いていなければなりません。 pg_ident.conf設定ファイルを使ってプリンシパルをユーザ名にマップできます。 例えば、pgusername@realmを単なるpgusernameにマップできます。 もう1つの方法として、プリンシパル名全体username@realmPostgreSQLのロール名としてマッピングなしに使うこともできます。

<productname>PostgreSQL</productname> also supports mapping client principals to user names by just stripping the realm from the principal. This method is supported for backwards compatibility and is strongly discouraged as it is then impossible to distinguish different users with the same user name but coming from different realms. To enable this, set <literal>include_realm</literal> to 0. For simple single-realm installations, doing that combined with setting the <literal>krb_realm</literal> parameter (which checks that the principal's realm matches exactly what is in the <literal>krb_realm</literal> parameter) is still secure; but this is a less capable approach compared to specifying an explicit mapping in <filename>pg_ident.conf</filename>. PostgreSQLはまたプリンシパルから単にrealmを外すことにより、クライアントプリンシパルをユーザ名にマップする方法をサポートしています。 この方法は後方互換のためにサポートされているものであり、異なるrealmから来た同じユーザ名の異なるユーザを区別することができませんので、使用しないことを強く薦めます。 この方法を有効にするにはinclude_realmを0に設定してください。 単純な単一realmの設定では、(プリンシパルのrealmがkrb_realmパラメータ内のものと正確に一致するか確認する)krb_realmパラメータと組み合わせることが安全です。 しかし、これはpg_ident.confで明示的なマッピングを指定するのに比べてあまり適切でない選択でしょう。

The location of the server's keytab file is specified by the <xref linkend="guc-krb-server-keyfile"/> configuration parameter. For security reasons, it is recommended to use a separate keytab just for the <productname>PostgreSQL</productname> server rather than allowing the server to read the system keytab file. Make sure that your server keytab file is readable (and preferably only readable, not writable) by the <productname>PostgreSQL</productname> server account. (See also <xref linkend="postgres-user"/>.) サーバのkeytabファイルの場所はkrb_server_keyfile設定パラメータで指定されます。 セキュリティ上の理由から、サーバがシステムkeytabファイルの読み込むことを許可するよりも、PostgreSQLサーバ用に別のkeytabファイルを使うことをお薦めします。 サーバ鍵ファイルがPostgreSQLサーバアカウントによって読み込み可能(そしてできれば読み込み専用で書き込み不可)であることを確認してください。 (19.1を参照してください。)

The keytab file is generated using the Kerberos software; see the Kerberos documentation for details. The following example shows doing this using the <application>kadmin</application> tool of MIT Kerberos: keytabファイルはKerberosのソフトウェアを使って作成されます。詳細はKerberosのドキュメントを参照してください。 MIT Kerberosのkadminツールを使って行う例を以下に示します。

kadmin% addprinc -randkey postgres/server.my.domain.org
kadmin% ktadd -k krb5.keytab postgres/server.my.domain.org

The following authentication options are supported for the <productname>GSSAPI</productname> authentication method: 次の認証オプションはGSSAPIのためにサポートされています。

include_realm

If set to 0, the realm name from the authenticated user principal is stripped off before being passed through the user name mapping (<xref linkend="auth-username-maps"/>). This is discouraged and is primarily available for backwards compatibility, as it is not secure in multi-realm environments unless <literal>krb_realm</literal> is also used. It is recommended to leave <literal>include_realm</literal> set to the default (1) and to provide an explicit mapping in <filename>pg_ident.conf</filename> to convert principal names to <productname>PostgreSQL</productname> user names. 0に設定されている場合は、認証されたユーザプリンシパルからのrealm名が、ユーザ名マッピング(21.2)で渡されるシステムユーザ名から外されています。 krb_realmも一緒に使われていない限り、これは複数realm環境で安全ではありませんので、非推奨であり、主に後方互換性のために利用できます。 include_realmをデフォルト(1)にしたまま、プリンシパル名をPostgreSQLユーザ名に変換するためにpg_ident.confで明示的なマッピングを指定することをお薦めします。

map

Allows mapping from client principals to database user names. See <xref linkend="auth-username-maps"/> for details. For a GSSAPI/Kerberos principal, such as <literal>username@EXAMPLE.COM</literal> (or, less commonly, <literal>username/hostbased@EXAMPLE.COM</literal>), the user name used for mapping is <literal>username@EXAMPLE.COM</literal> (or <literal>username/hostbased@EXAMPLE.COM</literal>, respectively), unless <literal>include_realm</literal> has been set to 0, in which case <literal>username</literal> (or <literal>username/hostbased</literal>) is what is seen as the system user name when mapping. クライアントプリンシパルからデータベースユーザ名へのマッピングを許可します。 詳細は21.2を参照してください。 GSSAPI/Kerberosプリンシパルusername@EXAMPLE.COM(もしくは、あまり一般的ではありませんがusername/hostbased@EXAMPLE.COM)に対しては、もしinclude_realmが0に設定されていない限り、マッピングに使われるユーザ名はusername@EXAMPLE.COM(もしくはusername/hostbased@EXAMPLE.COM)です。 0に設定されている場合には、username(もしくはusername/hostbased)がマッピング時のシステムユーザ名です。

krb_realm

Sets the realm to match user principal names against. If this parameter is set, only users of that realm will be accepted. If it is not set, users of any realm can connect, subject to whatever user name mapping is done. realmをユーザプリンシパル名に一致するように設定します。 もしこのパラメータが設定されている場合はそのrealmのユーザのみが受け付けられます。 もしこれが設定されていない場合は、どのようなrealmのユーザも接続可能で、ユーザ名マッピングが設定されていれば、どれでも影響を受けます。

In addition to these settings, which can be different for different <filename>pg_hba.conf</filename> entries, there is the server-wide <xref linkend="guc-krb-caseins-users"/> configuration parameter. If that is set to true, client principals are matched to user map entries case-insensitively. <literal>krb_realm</literal>, if set, is also matched case-insensitively. pg_hba.confのエントリによって異なるこれらの設定に加え、サーバ全体のkrb_caseins_users設定パラメータがあります。 これが真に設定されていれば、クライアントプリンシパルは大文字小文字を区別せずにユーザマップを照合します。 krb_realmが設定されている場合も、大文字小文字を区別せずに照合します。