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

19.8. 暗号化オプション #

<title>Encryption Options</title>

<productname>PostgreSQL</productname> offers encryption at several levels, and provides flexibility in protecting data from disclosure due to database server theft, unscrupulous administrators, and insecure networks. Encryption might also be required to secure sensitive data such as medical records or financial transactions. PostgreSQLは、複数レベルの暗号化を備え、データベースサーバ自身、管理者の注意不足、安全ではないネットワークを原因とした漏洩からデータを柔軟に保護することができます。 また、医療記録や金融取引など高セキュリティが求められるデータを格納する場合に暗号化が必要な場合もあります。

パスワードの暗号化

Database user passwords are stored as hashes (determined by the setting <xref linkend="guc-password-encryption"/>), so the administrator cannot determine the actual password assigned to the user. If SCRAM or MD5 encryption is used for client authentication, the unencrypted password is never even temporarily present on the server because the client encrypts it before being sent across the network. SCRAM is preferred, because it is an Internet standard and is more secure than the PostgreSQL-specific MD5 authentication protocol. データベースユーザのパスワードは(password_encryptionによって決定される)ハッシュとして格納されます。ですので、ユーザに割り当てられているパスワードは管理者でも分かりません。 SCRAM又はMD5暗号化がクライアント認証に使用されている場合、平文のパスワードはサーバ上に一時的にも存在することはありません。ネットワーク上に流れる前にクライアントが暗号化を行うからです。 SCRAMは、インターネット標準で、PostgreSQL特有なMD5認証プロトコルよりセキュアであるため、より望ましいです。

特定の列に関する暗号化

The <xref linkend="pgcrypto"/> module allows certain fields to be stored encrypted. This is useful if only some of the data is sensitive. The client supplies the decryption key and the data is decrypted on the server and then sent to the client. pgcryptoモジュールにより、あるフィールドを暗号化して保存することができます。 データの一部が極秘データであるような場合に有用です。 クライアントが提供した復号化用のキーで、サーバ上のデータを復号化し、クライアントに返されます。

The decrypted data and the decryption key are present on the server for a brief time while it is being decrypted and communicated between the client and server. This presents a brief moment where the data and keys can be intercepted by someone with complete access to the database server, such as the system administrator. 復号化されたデータと復号化用のキーは、復号処理中およびクライアントサーバ間の通信中サーバ上に存在している時間があります。 このため、データベースサーバへのすべてのアクセス権限を持つユーザ(例えばシステム管理者)によって、データとキーが盗まれるわずかな時間があります。

データパーティションに関する暗号化

Storage encryption can be performed at the file system level or the block level. Linux file system encryption options include eCryptfs and EncFS, while FreeBSD uses PEFS. Block level or full disk encryption options include dm-crypt + LUKS on Linux and GEOM modules geli and gbde on FreeBSD. Many other operating systems support this functionality, including Windows. ストレージの暗号化は、ファイルシステムレベルまたはブロックレベルで行うことができます。 Linuxファイルシステムの暗号化オプションには、eCryptfsとEncFSがあります。一方、FreeBSDではPEFSを使用します。 ブロックレベルまたはフルディスクの暗号化オプションとして、Linuxにはdm-crypt + LUKS、FreeBSDにはGEOMモジュールのgeliとgbdeがあります。 これにより、ファイルシステムパーティション全体をディスク上で暗号化することができます。 他の多くのオペレーティングシステムは、Windowsを含め、この機能をサポートしています。

This mechanism prevents unencrypted data from being read from the drives if the drives or the entire computer is stolen. This does not protect against attacks while the file system is mounted, because when mounted, the operating system provides an unencrypted view of the data. However, to mount the file system, you need some way for the encryption key to be passed to the operating system, and sometimes the key is stored somewhere on the host that mounts the disk. この機構により、ディスク装置やコンピュータ全体が盗まれた場合でも、ディスクから平文のデータが読み取られることを防止できます。 ファイルシステムがマウントされている時は、この機構による保護は働きません。 マウント時にはオペレーティングシステムが復号化したデータを提供するからです。 しかし、ファイルシステムをマウントするためになんらかの方法で暗号化キーをオペレーティングシステムに渡さなければなりません。 そのディスク装置をマウントするホストのどこかに暗号化キーを格納している場合もあります。

ネットワーク越しのデータ暗号化

SSL connections encrypt all data sent across the network: the password, the queries, and the data returned. The <filename>pg_hba.conf</filename> file allows administrators to specify which hosts can use non-encrypted connections (<literal>host</literal>) and which require SSL-encrypted connections (<literal>hostssl</literal>). Also, clients can specify that they connect to servers only via SSL. SSL接続により、ネットワーク越しに送信されるデータ(パスワード、問い合わせ、結果のデータ)はすべて暗号化されます。 pg_hba.confファイルを使用して、管理者はどのホストは暗号化しない接続を使用し(host)、どのホストがSSLで暗号化された接続を必要とするか(hostssl)を指定することができます。 また、SSL経由のサーバとの接続のみを使用するようにクライアントで指定することもできます。

GSSAPI-encrypted connections encrypt all data sent across the network, including queries and data returned. (No password is sent across the network.) The <filename>pg_hba.conf</filename> file allows administrators to specify which hosts can use non-encrypted connections (<literal>host</literal>) and which require GSSAPI-encrypted connections (<literal>hostgssenc</literal>). Also, clients can specify that they connect to servers only on GSSAPI-encrypted connections (<literal>gssencmode=require</literal>). GSSAPI暗号化接続は、問い合わせ及び返却されるデータを含めてネットワーク上に転送されるすべてのデータを暗号化します。 (パスワードはネットワーク上に送信されません。) 管理者はpg_hba.confファイルを使ってどのホストが非暗号化接続を使うか(host)、どのホストがGSSAPI暗号化接続を要求するか(hostgssenc)を指定できます。 クライアントはGSSAPI暗号化接続のみを使ってサーバに接続することも指定できます(gssencmode=require)。

<application>Stunnel</application> or <application>SSH</application> can also be used to encrypt transmissions. StunnelSSHを使用して暗号化転送を行うこともできます。

SSLホスト認証

It is possible for both the client and server to provide SSL certificates to each other. It takes some extra configuration on each side, but this provides stronger verification of identity than the mere use of passwords. It prevents a computer from pretending to be the server just long enough to read the password sent by the client. It also helps prevent <quote>man in the middle</quote> attacks where a computer between the client and server pretends to be the server and reads and passes all data between the client and server. クライアントとサーバの両方で証明書を互いに提供することができます。 これには両方で追加の設定を行わなければなりませんが、これにより単なるパスワードの使用よりも強力な身元の検証を行うことができます。 クライアントから送信されたパスワードを盗聴する偽装サーバからコンピュータを保護します。 また、クライアントとサーバとの間にあるコンピュータがサーバになりすまし、クライアントとサーバ間で流れるデータを読み取り中継する、中間者攻撃から保護することもできます。

クライアントサイドの暗号化

If the system administrator for the server's machine cannot be trusted, it is necessary for the client to encrypt the data; this way, unencrypted data never appears on the database server. Data is encrypted on the client before being sent to the server, and database results have to be decrypted on the client before being used. サーバマシンのシステム管理者を信頼できない場合、クライアント側でデータを暗号化する必要があります。 この場合、平文のデータはデータベースサーバ上に存在しません。 データはサーバに送信される前にクライアント上で暗号化されます。 また、使用する前にデータベースからの結果をクライアントで復号化しなければなりません。