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

F.42. sslinfo — クライアントのSSL情報を取得する #

<title>sslinfo &mdash; obtain client SSL information</title>

The <filename>sslinfo</filename> module provides information about the SSL certificate that the current client provided when connecting to <productname>PostgreSQL</productname>. The module is useless (most functions will return NULL) if the current connection does not use SSL. 現在のクライアントがPostgreSQLに接続する際に提供する SSL 証明書に関する情報を、sslinfoモジュールは提供します。 現在の接続が SSL を使用しない場合、モジュールは無用です(大部分の関数は NULL を返します)。

Some of the information available through this module can also be obtained using the built-in system view <link linkend="monitoring-pg-stat-ssl-view"> <structname>pg_stat_ssl</structname></link>. このモジュールを通じて取得できる情報の中には、組み込みシステムビューpg_stat_sslを使っても取得できるものがあります。

This extension won't build at all unless the installation was configured with <literal>&#45;-with-ssl=openssl</literal>. インストールを--with-ssl=opensslオプション付きで構築しない限り、この拡張は全く構築されません。

F.42.1. 提供される関数 #

<title>Functions Provided</title>
ssl_is_used() returns boolean

Returns true if current connection to server uses SSL, and false otherwise. サーバへの現在の接続において SSL を使用する場合 true、使用しない場合 false を返します。

ssl_version() returns text

Returns the name of the protocol used for the SSL connection (e.g., TLSv1.0, TLSv1.1, TLSv1.2 or TLSv1.3). SSL接続に使われているプロトコルの名前(例えば、TLSv1.0、TLSv1.1、TLSv1.2またはTLSv1.3)を返します。

ssl_cipher() returns text

Returns the name of the cipher used for the SSL connection (e.g., DHE-RSA-AES256-SHA). SSL接続に使われている暗号の名前(例えば、DHE-RSA-AES256-SHA)を返します。

ssl_client_cert_present() returns boolean

Returns true if current client has presented a valid SSL client certificate to the server, and false otherwise. (The server might or might not be configured to require a client certificate.) 現在のクライアントがサーバに対して、有効な SSL クライアント証明書を提示した場合 true、そうでない場合 false を返します。 (サーバがクライアントに対して、クライアント証明書を要求する方式と要求しない方式があります)。

ssl_client_serial() returns numeric

Returns serial number of current client certificate. The combination of certificate serial number and certificate issuer is guaranteed to uniquely identify a certificate (but not its owner &mdash; the owner ought to regularly change their keys, and get new certificates from the issuer). 現在のクライアント証明書のシリアル番号を返します。 証明書のシリアル番号と証明書の発行者との組み合わせにより、証明書が一意に識別されることが保証されます (しかし、証明書の所有者の保証ではありません。 所有者は定期的にその鍵を変更し、発行者から新しい証明書を取得すべきだからです)。

So, if you run your own CA and allow only certificates from this CA to be accepted by the server, the serial number is the most reliable (albeit not very mnemonic) means to identify a user. したがって、自分で認証局を設立し、その認証局の証明書だけをサーバが受理する場合、シリアル番号は利用者を識別するのに最も信頼できる方法です(あまり記憶の助けにはなりませんが)。

ssl_client_dn() returns text

Returns the full subject of the current client certificate, converting character data into the current database encoding. It is assumed that if you use non-ASCII characters in the certificate names, your database is able to represent these characters, too. If your database uses the SQL_ASCII encoding, non-ASCII characters in the name will be represented as UTF-8 sequences. 現在のクライアント証明書の所有者の内容を全て返します。 文字データは現在のデータベースのエンコーディングに変換されます。 なお、証明書名で非 ASCII 文字を用いる場合、データベースでもその文字を使用できると仮定します。 データベースが SQL_ASCII エンコーディングを使用する場合、証明書名で用いる非 ASCII 文字は UTF-8 のユニコードとして表示されます。

The result looks like <literal>/CN=Somebody /C=Some country/O=Some organization</literal>. その結果は/CN=Somebody /C=Some country /O=Some organizationのようになります。

ssl_issuer_dn() returns text

Returns the full issuer name of the current client certificate, converting character data into the current database encoding. Encoding conversions are handled the same as for <function>ssl_client_dn</function>. 現在のクライアント証明書の発行者名を全て返します。 文字データは現在のデータベースのエンコーディングに変換されます。 エンコーディングの変換法は ssl_client_dn と同じです。

The combination of the return value of this function with the certificate serial number uniquely identifies the certificate. 本関数の戻り値と証明書シリアル番号の組み合わせにより、証明書を一意に識別します。

This function is really useful only if you have more than one trusted CA certificate in your server's certificate authority file, or if this CA has issued some intermediate certificate authority certificates. 実際に本関数が有用となるのは、サーバの認証局ファイルの中に信頼できる認証局の証明書を複数保有している場合、またはこの認証局が中間認証局の証明書を発行している場合だけです。

ssl_client_dn_field(fieldname text) returns text

This function returns the value of the specified field in the certificate subject, or NULL if the field is not present. Field names are string constants that are converted into ASN1 object identifiers using the <productname>OpenSSL</productname> object database. The following values are acceptable: この関数は証明書の所有者の指定した項目の内容を返します。 指定した項目が存在しない場合は NULL を返します。 項目の名前は OpenSSL オブジェクトデータベースを使用して ASN1 オブジェクト識別子に変換された文字列定数です。 以下の項目が受理できます。

commonName (alias CN)
surname (alias SN)
name
givenName (alias GN)
countryName (alias C)
localityName (alias L)
stateOrProvinceName (alias ST)
organizationName (alias O)
organizationalUnitName (alias OU)
title
description
initials
postalCode
streetAddress
generationQualifier
description
dnQualifier
x500UniqueIdentifier
pseudonym
role
emailAddress

All of these fields are optional, except <structfield>commonName</structfield>. It depends entirely on your CA's policy which of them would be included and which wouldn't. The meaning of these fields, however, is strictly defined by the X.500 and X.509 standards, so you cannot just assign arbitrary meaning to them. commonName を除き、全ての項目は任意です。 認証局の方針によって、どの項目を含み、どの項目を含まないかが全て決まります。 しかし、X.500 および X.509 標準によって、項目の意味は厳格に定義されています。 したがって、項目に任意の意味を持たせることはできません。

ssl_issuer_field(fieldname text) returns text

Same as <function>ssl_client_dn_field</function>, but for the certificate issuer rather than the certificate subject. 証明書の所有者に対するものではなく証明書の発行者に対するものであるという点を除き、ssl_client_dn_field と同様の関数です。

ssl_extension_info() returns setof record

Provide information about extensions of client certificate: extension name, extension value, and if it is a critical extension. クライアント証明書の拡張に関する情報を提供します。拡張に関する情報とは、拡張の名前、拡張の値、クリティカルな拡張か否かです。

F.42.2. 作者 #

<title>Author</title>

Victor Wagner , Cryptocom LTD

Dmitry Voronin

E-Mail of Cryptocom OpenSSL development group: Cryptocom 社 OpenSSL 開発グループのメールアドレス