summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ssl.sgml
blob: f071b30fe79485e29e34645e6cd7e3c83b5738d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!-- doc/src/sgml/config.sgml -->

<sect1 id="runtime-ssl">
 <title>Secure Socket Layer (SSL)</title>

 <sect2 id="runtime-config-ssl-settings">

  <title>SSL Settings</title>

  <variablelist>

   <varlistentry id="guc-ssl" xreflabel="ssl">
    <term><varname>ssl</varname> (<type>boolean</type>)
     <indexterm>
      <primary><varname>ssl</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      When set to on, <productname>Pgpool-II</productname> enables the <acronym>SSL</acronym>
      for both the frontend and backend communications.
      Default is off.
     </para>
     <note>
      <para>
       <xref linkend="guc-ssl-key"> and <xref linkend="guc-ssl-cert"> must also be
	 configured in order for SSL to work with frontend connections.
      </para>
     </note>
     <note>
      <para>
       For SSL to work <productname>Pgpool-II</productname> must be build with OpenSSL support.
       See <xref linkend="install-pgpool"> for details on building the
	<productname>Pgpool-II</productname>.
      </para>
     </note>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-key" xreflabel="ssl_key">
    <term><varname>ssl_key</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_key</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      Specifies the private key file to be used for
      incoming frontend connections. Relative paths are relative to
      <productname>Pgpool-II</productname> configuration directory.
      There is no default value for this option, and if left unset
      <acronym>SSL</acronym> will be disabled for incoming frontend connections.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-cert" xreflabel="ssl_cert">
    <term><varname>ssl_cert</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_cert</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      Specifies the public x509 certificate file to be used
      for the incoming frontend connections. Relative paths are relative to
      <productname>Pgpool-II</productname> configuration directory.
      There is no default value for this option, and if left unset
      <acronym>SSL</acronym> will be disabled for incoming frontend connections.
     </para>

     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-ca-cert" xreflabel="ssl_ca_cert">
    <term><varname>ssl_ca_cert</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_ca_cert</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      Specifies a <acronym>PEM</acronym> format <acronym>CA</acronym>
      certificate file, which can be used to verify the backend server
      certificates. Relative paths are relative to
      <productname>Pgpool-II</productname> configuration directory. This is
      analogous to the <command>-CApath</command> option of the
      <command>OpenSSL verify(1)</command> command.
     </para>

     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-ca-cert-dir" xreflabel="ssl_ca_cert_dir">
    <term><varname>ssl_ca_cert_dir</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_ca_cert_dir</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      Specifies the path to a directory containing <acronym>PEM</acronym>
      format <acronym>CA</acronym> certificate files, which can be used
      to verify the backend server certificates. This is analogous to
      the <command>-CApath</command> option of the
      <command>OpenSSL verify(1)</command> command.
     </para>
     <para>
      The default value for this option is unset, which means no
      verification takes place. Verification will still happen if
      this option is not set but a value is provided for
      <xref linkend="guc-ssl-ca-cert">.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-crl-file" xreflabel="ssl_crl_file">
    <term><varname>ssl_crl_file</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_crl_file</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      Specifies the file containing the SSL server certificate
      revocation list (CRL). Relative paths are relative to
      <productname>Pgpool-II</productname> configuration directory.
      The default is empty, meaning no <acronym>CRL</acronym> file is loaded.
     </para>

     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-ciphers" xreflabel="ssl_ciphers">
    <term><varname>ssl_ciphers</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_ciphers</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      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 <application>OpenSSL</application> 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>, which is same
      as <productname>PostgreSQL</productname>.
      See <productname>PostgreSQL</productname> manual to know why
      the value is chosen.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-prefer-server-ciphers" xreflabel="ssl_prefer_server_ciphers">
    <term><varname>ssl_prefer_server_ciphers</varname> (<type>boolean</type>)
     <indexterm>
      <primary><varname>ssl_prefer_server_ciphers</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      Specifies whether to use the server's <acronym>SSL</acronym>
      cipher preferences, rather than the client's.
      The default value is false.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-ecdh-curve" xreflabel="ssl_ecdh_curve">
    <term><varname>ssl_ecdh_curve</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_ecdh_curve</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      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. The default value is <literal>prime256v1</literal>.
     </para>
     <para>
      OpenSSL names for the most common curves are:
      <literal>prime256v1</literal> (NIST P-256),
      <literal>secp384r1</literal> (NIST P-384),
      <literal>secp521r1</literal> (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.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-dh-params-file" xreflabel="ssl_dh_params_file">
    <term><varname>ssl_dh_params_file</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_dh_params_file</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      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 -out dhparams.pem 2048</command>.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="guc-ssl-passphrase-command" xreflabel="ssl_passphrase_command">
    <term><varname>ssl_passphrase_command</varname> (<type>string</type>)
     <indexterm>
      <primary><varname>ssl_passphrase_command</varname> configuration parameter</primary>
     </indexterm>
    </term>
    <listitem>
     <para>
      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 SSL file will not be loaded if passphrase is required.
     </para>
     <para>
      The command must print the passphrase to the standard output and
      exit with code 0. In the parameter value, %p is replaced by a prompt
      string. (Write %% for a 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.
     </para>
     <para>
      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.
     </para>
     <para>
      This parameter can only be set at server start.
     </para>
    </listitem>
   </varlistentry>

  </variablelist>
 </sect2>

 <sect2 id="runtime-g-connection-pooling-settings">

  <title>Generating SSL certificates</title>

  <para>
   Certificate handling is outside the scope of this document. The
   <ulink url="http://developer.postgresql.org/pgdocs/postgres/ssl-tcp.html">
    Secure TCP/IP Connections with SSL</> page at postgresql.org has
   pointers with sample commands for how to generate self-signed
   certificates. 
  </para>

 </sect2>

</sect1>