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

20.3. 接続と認証 #

<title>Connections and Authentication</title>

20.3.1. 接続設定 #

<title>Connection Settings</title>
listen_addresses (string) #

Specifies the TCP/IP address(es) on which the server is to listen for connections from client applications. The value takes the form of a comma-separated list of host names and/or numeric IP addresses. The special entry <literal>*</literal> corresponds to all available IP interfaces. The entry <literal>0.0.0.0</literal> allows listening for all IPv4 addresses and <literal>::</literal> allows listening for all IPv6 addresses. If the list is empty, the server does not listen on any IP interface at all, in which case only Unix-domain sockets can be used to connect to it. The default value is <systemitem class="systemname">localhost</systemitem>, which allows only local TCP/IP <quote>loopback</quote> connections to be made. While client authentication (<xref linkend="client-authentication"/>) allows fine-grained control over who can access the server, <varname>listen_addresses</varname> controls which interfaces accept connection attempts, which can help prevent repeated malicious connection requests on insecure network interfaces. This parameter can only be set at server start. クライアントアプリケーションからの接続をサーバが監視する TCP/IP アドレスを指定します。 この値は、ホスト名をコンマで区切ったリスト、そして/もしくは、数値によるIPアドレスです。 *という特別なエントリは利用可能な全てのIPインタフェースに対応します。 エントリ0.0.0.0は全てのIPv4アドレスの監視を、そしてエントリ::は全てのIPv6アドレスの監視を許容します。 リストが空の場合、サーバはいかなるIPインタフェースも全く監視しないで、Unixドメインソケットのみを使用して接続が行われます。 デフォルトの値はlocalhostで、ローカルなTCP/IP loopback接続のみ許可します。 クライアント認証 (第21章)は誰がサーバにアクセス可能かをきめ細かく制御するのに対し、listen_addressesはどのインタフェースが接続を試みるかを制御します。 これにより、安全でないネットワークインタフェース上において繰り返して行われる悪意のある接続要求の防止に役立ちます。 このパラメータはサーバ起動時のみ設定可能です。

port (integer) #

The TCP port the server listens on; 5432 by default. Note that the same port number is used for all IP addresses the server listens on. This parameter can only be set at server start. サーバが監視するTCPポートで、デフォルトは 5432です。 サーバが監視する全てのIPアドレスに対し、同じポート番号が使用されることを覚えておいてください。 このパラメータはサーバ起動時のみ設定可能です。

max_connections (integer) #

Determines the maximum number of concurrent connections to the database server. The default is typically 100 connections, but might be less if your kernel settings will not support it (as determined during <application>initdb</application>). This parameter can only be set at server start. データベースサーバに同時接続する最大数を決定します。 デフォルトは典型的に100接続ですが、カーネルの設定が(initdbの過程で)それをサポートしていない場合、もっと少なくなることがあります。 このパラメータはサーバ起動時のみに設定可能です。

When running a standby server, you must set this parameter to the same or higher value than on the primary server. Otherwise, queries will not be allowed in the standby server. スタンバイサーバを運用している場合、このパラメータはプライマリサーバでの設定と同じ、もしくはより高い値に設定しなければなりません。そうしないと問い合わせがスタンバイサーバ内で受け入れられません。

reserved_connections (integer) #

Determines the number of connection <quote>slots</quote> that are reserved for connections by roles with privileges of the <link linkend="predefined-roles-table"><literal>pg_use_reserved_connections</literal></link> role. Whenever the number of free connection slots is greater than <xref linkend="guc-superuser-reserved-connections"/> but less than or equal to the sum of <varname>superuser_reserved_connections</varname> and <varname>reserved_connections</varname>, new connections will be accepted only for superusers and roles with privileges of <literal>pg_use_reserved_connections</literal>. If <varname>superuser_reserved_connections</varname> or fewer connection slots are available, new connections will be accepted only for superusers. pg_use_reserved_connections権限を持つロールによる接続のために予約される接続スロットの数を決定します。 空き接続スロットの数がsuperuser_reserved_connectionsより大きく、かつsuperuser_reserved_connectionsreserved_connectionsの合計以下の場合は常に、新しい接続はスーパーユーザあるいはpg_use_reserved_connections権限を持つロールに対してのみ受け入れられます。 superuser_reserved_connections以下の接続スロットが利用可能な場合、新しい接続はスーパーユーザに対してのみ受け入れられます。

The default value is zero connections. The value must be less than <varname>max_connections</varname> minus <varname>superuser_reserved_connections</varname>. This parameter can only be set at server start. デフォルトの値は0接続です。 この値は max_connections - superuser_reserved_connectionsより小さくなくてはなりません。 このパラメータはサーバ起動時のみ設定可能です。

superuser_reserved_connections (integer) #

Determines the number of connection <quote>slots</quote> that are reserved for connections by <productname>PostgreSQL</productname> superusers. At most <xref linkend="guc-max-connections"/> connections can ever be active simultaneously. Whenever the number of active concurrent connections is at least <varname>max_connections</varname> minus <varname>superuser_reserved_connections</varname>, new connections will be accepted only for superusers. The connection slots reserved by this parameter are intended as final reserve for emergency use after the slots reserved by <xref linkend="guc-reserved-connections"/> have been exhausted. PostgreSQLのスーパーユーザによる接続のために予約されている接続スロットの数を決定します。 最大、max_connectionsの数までの接続を同時に有効にすることができます。 有効な同時接続数がmax_connectionsからsuperuser_reserved_connectionsを差し引いた数以上のときは、新規接続はスーパーユーザのみが許可されます。 このパラメータによる接続スロット予約は、reserved_connectionsによるスロット予約が使い果たされた後の緊急使用のための最終的な予備を意図しています。

The default value is three connections. The value must be less than <varname>max_connections</varname> minus <varname>reserved_connections</varname>. This parameter can only be set at server start. デフォルトの値は3接続です。 この値は max_connectionsからreserved_connectionsを引いたものより小さくなくてはなりません。 このパラメータはサーバ起動時のみ設定可能です。

unix_socket_directories (string) #

Specifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications. Multiple sockets can be created by listing multiple directories separated by commas. Whitespace between entries is ignored; surround a directory name with double quotes if you need to include whitespace or commas in the name. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. クライアントアプリケーションからの接続をlistenするサーバ上のUnixドメインソケットのディレクトリを指定します。 複数のディレクトリをカンマで区切って指定することにより、複数のソケットを作ることができます。 項目の間の空白は無視されます。 名前の中に空白かカンマが必要なら、ディレクトリ名を二重引用符で囲ってください。 空の値はUnixドメインソケットをlistenしないことを意味します。 この場合、TCP/IPソケットを使ってサーバに接続することだけが可能になります。

A value that starts with <literal>@</literal> specifies that a Unix-domain socket in the abstract namespace should be created (currently supported on Linux only). In that case, this value does not specify a <quote>directory</quote> but a prefix from which the actual socket name is computed in the same manner as for the file-system namespace. While the abstract socket name prefix can be chosen freely, since it is not a file-system location, the convention is to nonetheless use file-system-like values such as <literal>@/tmp</literal>. @で始まる値は、抽象名前空間にUnixドメインソケットを作ることを指定します(今の所これはLinuxでのみサポートされています)。 この場合、この値はディレクトリではなくファイルシステムの名前空間と同様の方法で、実際のソケット名の接頭辞が求められます。 ファイルシステムの位置ではないため、抽象ソケット名接頭辞は自由に選択できますが、それにもかかわらず@/tmpのようなファイルシステム的な値を使うのが慣例です。

The default value is normally <filename>/tmp</filename>, but that can be changed at build time. On Windows, the default is empty, which means no Unix-domain socket is created by default. This parameter can only be set at server start. デフォルト値は通常/tmpですが、ビルド時に変更できます。 Windowsではデフォルトは空文字で、これはつまりUnixドメインソケットがデフォルトでは作成されないことを意味します。 このパラメータはサーバ起動時のみ設定可能です。

In addition to the socket file itself, which is named <literal>.s.PGSQL.<replaceable>nnnn</replaceable></literal> where <replaceable>nnnn</replaceable> is the server's port number, an ordinary file named <literal>.s.PGSQL.<replaceable>nnnn</replaceable>.lock</literal> will be created in each of the <varname>unix_socket_directories</varname> directories. Neither file should ever be removed manually. For sockets in the abstract namespace, no lock file is created. .s.PGSQL.nnnnという名前のソケットファイル(nnnnはポート番号)のほかに、.s.PGSQL.nnnn.lockという通常ファイルがそれぞれのunix_socket_directoriesディレクトリの中に作成されます。 いずれのファイルも手作業で削除してはいけません。 抽象名前空間にあるソケットにはロックファイルは作成されません。

unix_socket_group (string) #

Sets the owning group of the Unix-domain socket(s). (The owning user of the sockets is always the user that starts the server.) In combination with the parameter <varname>unix_socket_permissions</varname> this can be used as an additional access control mechanism for Unix-domain connections. By default this is the empty string, which uses the default group of the server user. This parameter can only be set at server start. Unixドメインソケット(複数も)を所有するグループを設定します(ソケットを所有するユーザは常にサーバを起動するユーザです)。 unix_socket_permissionsパラメータとの組合せで、Unixドメインソケット接続の追加的アクセス管理機構として使うことができます。 デフォルトでは空文字列で、サーバユーザのデフォルトグループを使用します。 このパラメータはサーバ起動時のみ設定可能です。

This parameter is not supported on Windows. Any setting will be ignored. Also, sockets in the abstract namespace have no file owner, so this setting is also ignored in that case. このパラメータはWindowsではサポートされていません。 すべての設定は無視されます。 また、抽象名前空間にあるソケットはファイル所有者を持たないので、この場合も設定は無視されます。

unix_socket_permissions (integer) #

Sets the access permissions of the Unix-domain socket(s). Unix-domain sockets use the usual Unix file system permission set. The parameter value is expected to be a numeric mode specified in the format accepted by the <function>chmod</function> and <function>umask</function> system calls. (To use the customary octal format the number must start with a <literal>0</literal> (zero).) Unixドメインソケット(複数も)のアクセスパーミッションを設定します。 Unixドメインソケットは通常のUnixファイルシステムパーミッション設定の一式を使用します。 パラメータ値は、chmodおよびumaskシステムコールが受け付ける数値形式での指定を想定しています。 (通常使われる8進数形式を使用するのであれば、0(ゼロ)で始まらなければなりません。)

The default permissions are <literal>0777</literal>, meaning anyone can connect. Reasonable alternatives are <literal>0770</literal> (only user and group, see also <varname>unix_socket_group</varname>) and <literal>0700</literal> (only user). (Note that for a Unix-domain socket, only write permission matters, so there is no point in setting or revoking read or execute permissions.) デフォルトのパーミッションは、誰でも接続できる0777になっています。 変更するならば0770(ユーザとグループのみです。unix_socket_groupも参照してください)や0700(ユーザのみ)が適切です。 (Unixドメインソケットでは書き込み権限だけが問題になるため、読み込みや実行のパーミッションを設定または解除する意味はありません。)

This access control mechanism is independent of the one described in <xref linkend="client-authentication"/>. このアクセス制御機構は 第21章で記述されたものとは別個のものです。

This parameter can only be set at server start. このパラメータはサーバ起動時のみ設定可能です。

This parameter is irrelevant on systems, notably Solaris as of Solaris 10, that ignore socket permissions entirely. There, one can achieve a similar effect by pointing <varname>unix_socket_directories</varname> to a directory having search permission limited to the desired audience. このパラメータはSolaris 10の時点でのSolarisなど、ソケットのパーミッションを完全に無視するシステムでは無関係です。 こうしたシステムでは、許可したいユーザだけが検索パーミッションを持つディレクトリをunix_socket_directoriesで指すようにすることによって同じような効果を得ることができます。

Sockets in the abstract namespace have no file permissions, so this setting is also ignored in that case. 抽象名前空間にあるソケットはパーミッションを持たないので、この設定も無視されます。

bonjour (boolean) #

Enables advertising the server's existence via <productname>Bonjour</productname>. The default is off. This parameter can only be set at server start. Bonjourによりサーバの存在を公表することを可能にします。デフォルトはoffです。このパラメータはサーバ起動時のみ設定可能です。

bonjour_name (string) #

Specifies the <productname>Bonjour</productname> service name. The computer name is used if this parameter is set to the empty string <literal>''</literal> (which is the default). This parameter is ignored if the server was not compiled with <productname>Bonjour</productname> support. This parameter can only be set at server start. Bonjourサービス名を指定します。 このパラメータが空文字列''(デフォルトです)に設定されていると、コンピュータ名が使用されます。 サーバがBonjourサポート付でコンパイルでされていない場合は無視されます。 このオプションはサーバ起動時のみに設定可能です。

20.3.2. TCP Settings #

tcp_keepalives_idle (integer) #

Specifies the amount of time with no network activity after which the operating system should send a TCP keepalive message to the client. If this value is specified without units, it is taken as seconds. A value of 0 (the default) selects the operating system's default. On Windows, setting a value of 0 will set this parameter to 2 hours, since Windows does not provide a way to read the system default value. This parameter is supported only on systems that support <symbol>TCP_KEEPIDLE</symbol> or an equivalent socket option, and on Windows; on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero. クライアントとのやり取りがなくなった後、オペレーティングシステムがTCPのkeepaliveパケットをクライアントに送信するまでの時間を指定します。 この値が単位なしで指定された場合は、秒単位であるとみなします。 0(デフォルトです)の場合はオペレーティングシステムのデフォルト値を使用します。 Windowsでは、システムのデフォルト値を読み取る方法がないため、値0を設定すると、このパラメータは2時間に設定されます。 このパラメータはTCP_KEEPIDLEまたは同等のソケットオプションをサポートするシステムと、Windowsでのみサポートされます。 その他のシステムではゼロでなければなりません。 Unixドメインソケット経由で接続されたセッションでは、このパラメータは無視され、常にゼロとして読み取られます。

tcp_keepalives_interval (integer) #

Specifies the amount of time after which a TCP keepalive message that has not been acknowledged by the client should be retransmitted. If this value is specified without units, it is taken as seconds. A value of 0 (the default) selects the operating system's default. On Windows, setting a value of 0 will set this parameter to 1 second, since Windows does not provide a way to read the system default value. This parameter is supported only on systems that support <symbol>TCP_KEEPINTVL</symbol> or an equivalent socket option, and on Windows; on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero. TCPのkeepaliveメッセージに対してクライアントから応答がない場合に、再送を行うまでの時間を指定します。 この値が単位なしで指定された場合は、秒単位であるとみなします。 0(デフォルトです)の場合はシステムのデフォルト値を使用します。 Windowsでは、システムのデフォルト値を読み取る方法がないため、値0を設定すると、このパラメータが1秒に設定されます。 このパラメータはTCP_KEEPINTVLまたは同等のソケットオプションをサポートするシステムと、Windowsでのみサポートされます。 その他のシステムではゼロでなければなりません。 Unixドメインソケット経由で接続されたセッションでは、このパラメータは無視され、常にゼロとして読み取られます。

tcp_keepalives_count (integer) #

Specifies the number of TCP keepalive messages that can be lost before the server's connection to the client is considered dead. A value of 0 (the default) selects the operating system's default. This parameter is supported only on systems that support <symbol>TCP_KEEPCNT</symbol> or an equivalent socket option (which does not include Windows); on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero. サーバのクライアントへの接続が切れたと判断されるまでのTCP keepaliveメッセージの数を指定します。 0(デフォルトです)の場合はオペレーティングシステムのデフォルト値を使用します。 このパラメータはTCP_KEEPCNTまたは同等のソケットオプションをサポートするシステムでのみサポートされます(Windowsは含みません)。 その他のシステムではゼロでなければなりません。 Unixドメインソケット経由で接続されたセッションでは、このパラメータは無視され、常にゼロとして読み取られます。

tcp_user_timeout (integer) #

Specifies the amount of time that transmitted data may remain unacknowledged before the TCP connection is forcibly closed. If this value is specified without units, it is taken as milliseconds. A value of 0 (the default) selects the operating system's default. This parameter is supported only on systems that support <symbol>TCP_USER_TIMEOUT</symbol> (which does not include Windows); on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero. 未応答の送信データが残ったままの接続が強制的に閉じられるまでの時間を指定します。 この値が単位なしで指定された場合は、ミリ秒単位であるとみなします。 0(デフォルトです)の場合はオペレーティングシステムのデフォルト値を使用します。 このパラメータは、TCP_USER_TIMEOUTをサポートするシステム(Windowsは含みません)でのみ使用できます。他のシステムでは、0にする必要があります。 UNIXドメインソケットで接続しているセッションではこのパラメータは無視され、常に0として扱われます。

client_connection_check_interval (integer) #

Sets the time interval between optional checks that the client is still connected, while running queries. The check is performed by polling the socket, and allows long running queries to be aborted sooner if the kernel reports that the connection is closed. 問い合わせを実行中に、クライアントがまだ接続しているどうかの追加のチェックを行う時間間隔を指定します。 このチェックはソケットをポーリングすることによって行われ、その接続がクローズされていることをカーネルが報告することによって、長時間実行中の問い合わせをより早くアボートさせることができます。

This option relies on kernel events exposed by Linux, macOS, illumos and the BSD family of operating systems, and is not currently available on other systems. このオプションは、Linux、macOS、illumos、BSDファミリーのオペレーティングシステムによって公開されるカーネルイベントに依存しており、現在他のシステムでは利用できません。

If the value is specified without units, it is taken as milliseconds. The default value is <literal>0</literal>, which disables connection checks. Without connection checks, the server will detect the loss of the connection only at the next interaction with the socket, when it waits for, receives or sends data. 値が単位なしに指定されると、ミリ秒であるとみなされます。 デフォルト値は0で、接続のチェックは無効になります。 接続チェックがない場合、サーバは接続が失われたことを、次のソケットへのアクセス、すなわちソケットの待受、データの受信、送信のときにだけ検出します。

For the kernel itself to detect lost TCP connections reliably and within a known timeframe in all scenarios including network failure, it may also be necessary to adjust the TCP keepalive settings of the operating system, or the <xref linkend="guc-tcp-keepalives-idle"/>, <xref linkend="guc-tcp-keepalives-interval"/> and <xref linkend="guc-tcp-keepalives-count"/> settings of <productname>PostgreSQL</productname>. ネットワーク障害を含めて、TCP接続が失われたことをすべてのシナリオにおいて既知のタイムフレームの中で確実にカーネルが検出するためには、オペレーティングシステムのTCP keepalive設定、あるいはPostgreSQLtcp_keepalives_idletcp_keepalives_intervaltcp_keepalives_count設定を調整することが必要になるかもしれません。

20.3.3. 認証 #

<title>Authentication</title>
authentication_timeout (integer) #

Maximum amount of time allowed to complete client authentication. If a would-be client has not completed the authentication protocol in this much time, the server closes the connection. This prevents hung clients from occupying a connection indefinitely. If this value is specified without units, it is taken as seconds. The default is one minute (<literal>1m</literal>). This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. クライアント認証を完了するまでの最大時間です。 もし、この時間内に自称クライアントが認証プロトコルを完了しない場合、サーバは接続を閉じます。 これはハングしたクライアントが接続を永久に占有することを防ぎます。 この値が単位なしで指定された場合は、秒単位であるとみなします。 デフォルトは1分(1m)です。 このパラメータはpostgresql.confファイル、またはサーバのコマンドラインでのみ設定可能です。

password_encryption (enum) #

When a password is specified in <xref linkend="sql-createrole"/> or <xref linkend="sql-alterrole"/>, this parameter determines the algorithm to use to encrypt the password. Possible values are <literal>scram-sha-256</literal>, which will encrypt the password with SCRAM-SHA-256, and <literal>md5</literal>, which stores the password as an MD5 hash. The default is <literal>scram-sha-256</literal>. CREATE ROLEあるいはALTER ROLEでパスワードを設定する際に、このパラメータはパスワードを暗号化するアルゴリズムを指定します。 可能な値は、SCRAM-SHA-256でパスワードを暗号化するscram-sha-256とパスワードをMD5ハッシュとして格納するmd5です。 デフォルト値はscram-sha-256です。

Note that older clients might lack support for the SCRAM authentication mechanism, and hence not work with passwords encrypted with SCRAM-SHA-256. See <xref linkend="auth-password"/> for more details. 古いクライアントはSCRAM認証機構をサポートしていない可能性があり、したがってSCRAM-SHA-256による暗号化は動作しないかもしれないことに注意してください。 さらなる詳細については21.5をご覧ください。

scram_iterations (integer) #

The number of computational iterations to be performed when encrypting a password using SCRAM-SHA-256. The default is <literal>4096</literal>. A higher number of iterations provides additional protection against brute-force attacks on stored passwords, but makes authentication slower. Changing the value has no effect on existing passwords encrypted with SCRAM-SHA-256 as the iteration count is fixed at the time of encryption. In order to make use of a changed value, a new password must be set. SCRAM-SHA-256を使用してパスワードを暗号化するときに実行される計算の反復回数です。 デフォルトは4096です。 反復回数が多いほど、格納されたパスワードに対するブルートフォース攻撃に対する保護が強化されますが、認証の速度は低下します。 反復カウントは暗号化時に固定されるため、値を変更してもSCRAM-SHA-256で暗号化された既存のパスワードには影響しません。 変更された値を有効にするには、新しいパスワードを設定する必要があります。

krb_server_keyfile (string) #

Sets the location of the server's Kerberos key file. The default is <filename>FILE:/usr/local/pgsql/etc/krb5.keytab</filename> (where the directory part is whatever was specified as <varname>sysconfdir</varname> at build time; use <literal>pg_config &#45;-sysconfdir</literal> to determine that). If this parameter is set to an empty string, it is ignored and a system-dependent default is used. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. See <xref linkend="gssapi-auth"/> for more information. Kerberosサーバーキーファイルの場所を設定します。 デフォルトはFILE:/usr/local/pgsql/etc/krb5.keytabです。 (ディレクトリ部分は構築時にsysconfdirで指定されたものです。 pg_config --sysconfdirを使って確認してください。) このパラメータが空文字列に設定されると、それは無視されてシステム依存のデフォルトが使用されます。 このパラメータはpostgresql.confファイル、またはサーバのコマンドラインでのみ設定可能です。 詳細は21.6をご覧ください。

krb_caseins_users (boolean) #

Sets whether GSSAPI user names should be treated case-insensitively. The default is <literal>off</literal> (case sensitive). This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. GSSAPIユーザ名を大文字小文字の区別なく取り扱うかどうかを設定します。 デフォルトはoff(大文字小文字を区別する)です。 このパラメータはpostgresql.confファイル、またはサーバのコマンドラインでのみ設定可能です。

gss_accept_delegation (boolean) #

Sets whether GSSAPI delegation should be accepted from the client. The default is <literal>off</literal> meaning credentials from the client will <emphasis>not</emphasis> be accepted. Changing this to <literal>on</literal> will make the server accept credentials delegated to it from the client. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. クライアントからのGSSAPI委任を受け入れるかどうかを設定します。 デフォルトはoffです。 これは、クライアントからの資格証明が受け入れられないことを意味します。 これをonに変更すると、サーバは、クライアントから委任された資格証明を受け入れます。 このパラメータは、postgresql.confファイルまたはサーバコマンドラインでのみ設定できます。

db_user_namespace (boolean) #

This parameter enables per-database user names. It is off by default. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータはデータベース毎のユーザ名を可能にします。 デフォルトはオフです。 このパラメータはpostgresql.confファイル、またはサーバのコマンドラインでのみ設定可能です。

If this is on, you should create users as <replaceable>username@dbname</replaceable>. When <replaceable>username</replaceable> is passed by a connecting client, <literal>@</literal> and the database name are appended to the user name and that database-specific user name is looked up by the server. Note that when you create users with names containing <literal>@</literal> within the SQL environment, you will need to quote the user name. これがオンの場合、username@dbnameの様にしてユーザを作成しなければなりません。 usernameが接続中のクライアントより渡された時、 @およびデータベース名がユーザ名に付加され、そのデータベース特有のユーザ名をサーバが見に行きます。 SQL環境下で@を含む名前のユーザを作成する場合、そのユーザ名は引用符で括られなければならないことに注意してください。

With this parameter enabled, you can still create ordinary global users. Simply append <literal>@</literal> when specifying the user name in the client, e.g., <literal>joe@</literal>. The <literal>@</literal> will be stripped off before the user name is looked up by the server. このパラメータを有効にしていても通常の広域ユーザを作成することができます。 クライアントにユーザ名を指定する時に、たとえばjoe@のように単に@を付け加えてください。 @はサーバがユーザ名を検索する以前に取り去られます。

<varname>db_user_namespace</varname> causes the client's and server's user name representation to differ. Authentication checks are always done with the server's user name so authentication methods must be configured for the server's user name, not the client's. Because <literal>md5</literal> uses the user name as salt on both the client and server, <literal>md5</literal> cannot be used with <varname>db_user_namespace</varname>. db_user_namespaceはクライアントとサーバのユーザ名の表示を区別することができます。 認証検査は常にサーバのユーザ名で行われるので、認証方式はクライアントのではなくサーバのユーザ名で構成されなければなりません。 md5では、クライアントおよびサーバの両方でユーザ名をソルトとして使用するので、md5db_user_namespaceと一緒に使用することはできません。

注記

This feature is intended as a temporary measure until a complete solution is found. At that time, this option will be removed. この機能は完全な解決方法が見つかるまでの一時的なものです。 完全な解決方法が見つかったら、このオプションは削除される予定です。

20.3.4. SSL #

See <xref linkend="ssl-tcp"/> for more information about setting up <acronym>SSL</acronym>. The configuration parameters for controlling transfer encryption using <acronym>TLS</acronym> protocols are named <literal>ssl</literal> for historic reasons, even though support for the <acronym>SSL</acronym> protocol has been deprecated. <acronym>SSL</acronym> is in this context used interchangeably with <acronym>TLS</acronym>. SSLの設定の詳細は、19.9を参照してください。 TLSプロトコルを使用した転送暗号化を制御するための構成パラメータは、SSLプロトコルのサポートが推奨されていないにもかかわらず、歴史的な理由からsslと名付けられています。 SSLはこの文脈でTLSと同じ意味で使用されます。

ssl (boolean) #

Enables <acronym>SSL</acronym> connections. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is <literal>off</literal>. SSLによる接続を有効にします。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトはoffです。

ssl_ca_file (string) #

Specifies the name of the file containing the SSL server certificate authority (CA). Relative paths are relative to the data directory. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is empty, meaning no CA file is loaded, and client certificate verification is not performed. SSLサーバ認証局(CA)が入っているファイル名を設定します。 相対パスの場合は、データディレクトリからの相対パスになります。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトは空で、この場合CAファイルは読み込まれず、クライアントのサーバ検証は行われません。

ssl_cert_file (string) #

Specifies the name of the file containing the SSL server certificate. Relative paths are relative to the data directory. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is <filename>server.crt</filename>. SSLサーバ証明書が入っているファイル名を設定します。 相対パスの場合は、データディレクトリからの相対パスになります。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトは server.crt です。

ssl_crl_file (string) #

Specifies the name of the file containing the SSL client certificate revocation list (CRL). Relative paths are relative to the data directory. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is empty, meaning no CRL file is loaded (unless <xref linkend="guc-ssl-crl-dir"/> is set). SSLクライアント証明書失効リスト(CRL)が入っているファイル名を設定します。 相対パスの場合は、データディレクトリからの相対パスになります。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトは空で、この場合CRLファイルは読み込まれません(ssl_crl_dirが設定されていない限り)。

ssl_crl_dir (string) #

Specifies the name of the directory containing the SSL client certificate revocation list (CRL). Relative paths are relative to the data directory. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is empty, meaning no CRLs are used (unless <xref linkend="guc-ssl-crl-file"/> is set). SSLクライアント証明書失効リスト(CRL)が入っているディレクトリ名を設定します。 相対パスの場合は、データディレクトリからの相対パスになります。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトは空で、この場合CRLファイルは読み込まれません(ssl_crl_fileが設定されていない限り)。

The directory needs to be prepared with the <productname>OpenSSL</productname> command <literal>openssl rehash</literal> or <literal>c_rehash</literal>. See its documentation for details. このディレクトリはOpenSSLコマンドのopenssl rehashあるいはc_rehashで準備されなければなりません。 詳細はそれらのドキュメントをご覧ください。

When using this setting, CRLs in the specified directory are loaded on-demand at connection time. New CRLs can be added to the directory and will be used immediately. This is unlike <xref linkend="guc-ssl-crl-file"/>, which causes the CRL in the file to be loaded at server start time or when the configuration is reloaded. Both settings can be used together. この設定を使用すると、指定したディレクトリ内のCRLが接続時に必要に応じて読み込まれます。 新しいCRLをこのディレクトリに追加することが可能で、即座に使用されます。 サーバが起動されるとき、あるいは設定が再読込されるときに読み込まれるssl_crl_fileとは異なります。 両方の設定は一緒に使用できます。

ssl_key_file (string) #

Specifies the name of the file containing the SSL server private key. Relative paths are relative to the data directory. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is <filename>server.key</filename>. SSLサーバの秘密鍵が入っているファイル名を設定します。 相対パスの場合は、データディレクトリからの相対パスになります。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトは server.key です。

ssl_ciphers (string) #

Specifies a list of <acronym>SSL</acronym> cipher suites that are allowed to be used by SSL connections. See the <citerefentry><refentrytitle>ciphers</refentrytitle></citerefentry> manual page in the <productname>OpenSSL</productname> package for the syntax of this setting and a list of supported values. Only connections using TLS version 1.2 and lower are affected. There is currently no setting that controls the cipher choices used by TLS version 1.3 connections. The default value is <literal>HIGH:MEDIUM:+3DES:!aNULL</literal>. The default is usually a reasonable choice unless you have specific security requirements. SSL接続で使うことのできるSSL暗号スイートのリストを指定します。 設定構文と使用可能な値のリストについてはOpenSSLパッケージの ciphersマニュアルをご覧ください。 TLSバージョン1.2あるいはそれ以下のバージョンを使用する接続のみが影響を受けます。 今の所、TLSバージョン1.3接続で使用される暗号の選択を制御する設定はありません。 デフォルト値はHIGH:MEDIUM:+3DES:!aNULLです。 特別なセキュリティ要件でなければ通常これが適当です。

This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。

Explanation of the default value: デフォルト値の説明:

HIGH #

Cipher suites that use ciphers from <literal>HIGH</literal> group (e.g., AES, Camellia, 3DES) HIGHグループ(たとえばAES, Camellia, 3DES)を使用する暗号スイート

MEDIUM #

Cipher suites that use ciphers from <literal>MEDIUM</literal> group (e.g., RC4, SEED) MEDIUMグループ(たとえば RC4, SEED)を使用する暗号スイート

+3DES #

The <productname>OpenSSL</productname> default order for <literal>HIGH</literal> is problematic because it orders 3DES higher than AES128. This is wrong because 3DES offers less security than AES128, and it is also much slower. <literal>+3DES</literal> reorders it after all other <literal>HIGH</literal> and <literal>MEDIUM</literal> ciphers. OpenSSLHIGHに対するデフォルトの並び順には問題があります。 3DESがAES128より高いとしているからです。 3DESはAES128よりもセキュアではなく、またずっと遅いので、これは間違っています。 +3DESではそれを他のすべてのHIGHMEDIUM暗号よりも後に位置づけます。

!aNULL #

Disables anonymous cipher suites that do no authentication. Such cipher suites are vulnerable to <acronym>MITM</acronym> attacks and therefore should not be used. 認証を行わない匿名暗号スイートを無効にします。 そういった暗号スイートはMITM攻撃に対して脆弱で、使用すべきではありません。

Available cipher suite details will vary across <productname>OpenSSL</productname> versions. Use the command <literal>openssl ciphers -v 'HIGH:MEDIUM:+3DES:!aNULL'</literal> to see actual details for the currently installed <productname>OpenSSL</productname> version. Note that this list is filtered at run time based on the server key type. OpenSSLのバージョンにより、利用可能な暗号スイートの詳細は異なります。 openssl ciphers -v 'HIGH:MEDIUM:+3DES:!aNULL' コマンドを使って現在インストールされているOpenSSLのバージョンに関する詳細情報を得てください。 ここで得られるリストは、サーバキータイプにより実行時にフィルターされることに注意してください。

ssl_prefer_server_ciphers (boolean) #

Specifies whether to use the server's SSL cipher preferences, rather than the client's. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is <literal>on</literal>. サーバのSSL暗号設定をクライアントに優先して使うかどうかを指定します。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルトはonです。

Older PostgreSQL versions do not have this setting and always use the client's preferences. This setting is mainly for backward compatibility with those versions. Using the server's preferences is usually better because it is more likely that the server is appropriately configured. 古いバージョンのPostgreSQLにはこの設定がなく、常にクライアントの設定を使います。 この設定は、主に古いバージョンとの互換性のために設けられています。 通常サーバの設定に従うほうが良いです。大抵の場合、サーバはより適切に設定されているからです。

ssl_ecdh_curve (string) #

Specifies the name of the curve to use in <acronym>ECDH</acronym> key exchange. It needs to be supported by all clients that connect. It does not need to be the same curve used by the server's Elliptic Curve key. This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. The default is <literal>prime256v1</literal>. ECDHキー交換で使われる曲線の名前を指定します。 接続するすべてのクライアントがこの設定をサポートしている必要があります。 サーバの楕円曲線キーで使用されるのと同じ曲線である必要はありません。 このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。 デフォルト値はprime256v1です。

<productname>OpenSSL</productname> names for the most common curves are: OpenSSLはよく使われる曲線に名前を付けています。 prime256v1 (NIST P-256), secp384r1 (NIST P-384), secp521r1 (NIST P-521). The full list of available curves can be shown with the command <command>openssl ecparam -list_curves</command>. Not all of them are usable in <acronym>TLS</acronym> though. 利用できる曲線の完全なリストはopenssl ecparam -list_curvesで得られます。ただし、TLSではこのすべてが利用できるわけではありません。

ssl_min_protocol_version (enum) #

Sets the minimum SSL/TLS protocol version to use. Valid values are currently: <literal>TLSv1</literal>, <literal>TLSv1.1</literal>, <literal>TLSv1.2</literal>, <literal>TLSv1.3</literal>. Older versions of the <productname>OpenSSL</productname> library do not support all values; an error will be raised if an unsupported setting is chosen. Protocol versions before TLS 1.0, namely SSL version 2 and 3, are always disabled. 使用するSSL/TLSプロトコルバージョンの最小値を設定します。 今の所使用できる値はTLSv1TLSv1.1TLSv1.2TLSv1.3です。 古いバージョンのOpenSSLライブラリはすべての値をサポートしません。 サポートしていない値が設定されるとエラーが発生します。 TLS 1.0より前のプロトコルバージョン、すなわちSSLバージョン2あるいは3は常に無効となります。

The default is <literal>TLSv1.2</literal>, which satisfies industry best practices as of this writing. デフォルトはTLSv1.2で、本稿執筆時点では業界のベストプラクティスを満たしています。

This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。

ssl_max_protocol_version (enum) #

Sets the maximum SSL/TLS protocol version to use. Valid values are as for <xref linkend="guc-ssl-min-protocol-version"/>, with addition of an empty string, which allows any protocol version. The default is to allow any version. Setting the maximum protocol version is mainly useful for testing or if some component has issues working with a newer protocol. 使用するSSL/TLSプロトコルバージョンの最大値を設定します。 使用できる値はssl_min_protocol_versionと、すべてのプロトコルバージョンを許可する空文字です。 デフォルトはすべてのプロトコルバージョンを許可する設定です。 最大プロトコルバージョンの設定は主にテスト、あるいは新しいプロトコルを使った時にコンポーネントのどこかに問題がある時に有用です。

This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。

ssl_dh_params_file (string) #

Specifies the name of the file containing Diffie-Hellman parameters used for so-called ephemeral DH family of SSL ciphers. The default is empty, in which case compiled-in default DH parameters used. Using custom DH parameters reduces the exposure if an attacker manages to crack the well-known compiled-in DH parameters. You can create your own DH parameters file with the command <command>openssl dhparam -out dhparams.pem 2048</command>. いわゆる短命DH系SSL暗号で使用するディフィー・ヘルマンパラメータを格納するファイル名を指定します。 デフォルトは空で、この場合はコンパイル時に決められたデフォルトのDHパラメータが使用されます。 攻撃者が、よく知られたコンパイル時設定のDHパラメータを解読しようとしている場合には、カスタムDHパラメータを使うことでその危険性を低減できます。 openssl dhparam -out dhparams.pem 2048を使って、独自のDHパラメータファイルを作ることができます。

This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータは、postgresql.confファイルか、サーバのコマンドラインでのみ設定可能です。

ssl_passphrase_command (string) #

Sets an external command to be invoked when a passphrase for decrypting an SSL file such as a private key needs to be obtained. By default, this parameter is empty, which means the built-in prompting mechanism is used. 秘密鍵などのSSLファイルを復号する際に、パスフレーズの入手が必要な時に起動される外部コマンドを設定します。 デフォルトではこのパラメータは空文字で、組み込みのプロンプト機構が使用されます。

The command must print the passphrase to the standard output and exit with code 0. In the parameter value, <literal>%p</literal> is replaced by a prompt string. (Write <literal>%%</literal> for a literal <literal>%</literal>.) Note that the prompt string will probably contain whitespace, so be sure to quote adequately. A single newline is stripped from the end of the output if present. このコマンドは、パスフレーズを標準出力に書き出し、コード0で終了しなければなりません。 パラメータの値の%pはプロンプト文字列に置き換えられます。 (%を使いたい場合は%%としてください。) プロンプト文字列はおそらく空白文字を含むので、適切に引用符付けするように注意してください。 出力の最後に一個の改行があれば、削除されます。

The command does not actually have to prompt the user for a passphrase. It can read it from a file, obtain it from a keychain facility, or similar. It is up to the user to make sure the chosen mechanism is adequately secure. このコマンドは実際にはパスフレーズ用にユーザにプロンプトを表示する必要はありません。 ファイルからパスフレーズが読めるなら、キーチェーン機構やその他から取得します。 選択された仕組みが適切にセキュアかどうかを確認するのはユーザ次第です。

This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータはpostgresql.confファイル内、またはサーバのコマンドラインのみで設定可能です。

ssl_passphrase_command_supports_reload (boolean) #

This parameter determines whether the passphrase command set by <varname>ssl_passphrase_command</varname> will also be called during a configuration reload if a key file needs a passphrase. If this parameter is off (the default), then <varname>ssl_passphrase_command</varname> will be ignored during a reload and the SSL configuration will not be reloaded if a passphrase is needed. That setting is appropriate for a command that requires a TTY for prompting, which might not be available when the server is running. Setting this parameter to on might be appropriate if the passphrase is obtained from a file, for example. このパラメータは、キーにパスフレーズが必要な場合、設定ファイルの再読み込み中にssl_passphrase_commandで設定されたパスフレーズコマンドも呼び出されるかどうかを設定します。 このパラメータがoff(デフォルト)なら、ssl_passphrase_commandは再読込の際に無視され、パスフレーズが必要な場合、SSL設定は再読込されません。 この設定は、サーバ実行中は存在しないかもしれないTTYがプロンプトに必要なコマンドに適しています。 たとえばパスフレーズがファイルから読み込める場合には、この設定をonにするのが適切です。

This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line. このパラメータはpostgresql.confファイル内、またはサーバのコマンドラインのみで設定可能です。