-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth-pg-hba-conf.html
More file actions
950 lines (934 loc) · 77.6 KB
/
auth-pg-hba-conf.html
File metadata and controls
950 lines (934 loc) · 77.6 KB
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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>20.1. pg_hba.confファイル</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="client-authentication.html" title="第20章 クライアント認証" /><link rel="next" href="auth-username-maps.html" title="20.2. ユーザ名マップ" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 18.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="client-authentication.html" title="第20章 クライアント認証">第20章 クライアント認証</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 18.3 : auth-pg-hba-conf.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="client-authentication.html" title="第20章 クライアント認証">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="client-authentication.html" title="第20章 クライアント認証">上へ</a></td><td width="60%" align="center">20.1. <code class="filename">pg_hba.conf</code>ファイル</td><td width="20%" align="right"> <a accesskey="n" href="auth-username-maps.html" title="20.2. ユーザ名マップ">次へ</a></td></tr></table><hr /></div><div class="sect1" id="AUTH-PG-HBA-CONF"><div class="titlepage"><div><div><h2 class="title" style="clear: both">20.1. <code class="filename">pg_hba.conf</code>ファイル <a href="#AUTH-PG-HBA-CONF" class="id_link">#</a></h2></div></div></div><span class="original">
<title>The <filename>pg_hba.conf</filename> File</title>
</span><a id="id-1.6.7.9.2" class="indexterm"></a><p>
<span class="original">
Client authentication is controlled by a configuration file,
which traditionally is named
<filename>pg_hba.conf</filename> and is stored in the database
cluster's data directory.
(<acronym>HBA</acronym> stands for host-based authentication.) A default
<filename>pg_hba.conf</filename> file is installed when the data
directory is initialized by <xref linkend="app-initdb"/>. It is
possible to place the authentication configuration file elsewhere,
however; see the <xref linkend="guc-hba-file"/> configuration parameter.
</span>
クライアント認証はデータベースクラスタのデータディレクトリ内の、伝統的に<code class="filename">pg_hba.conf</code>という名前の設定ファイルで管理されています。
(<acronym class="acronym">HBA</acronym>とは、host-based authentication: ホストベース認証の略です。)
デフォルトの<code class="filename">pg_hba.conf</code>ファイルは、データディレクトリが<a class="xref" href="app-initdb.html" title="initdb"><span class="refentrytitle"><span class="application">initdb</span></span></a>で初期化される時にインストールされます。
しかし、この認証設定ファイルを他の場所に設置することができます。
<a class="xref" href="runtime-config-file-locations.html#GUC-HBA-FILE">hba_file</a>設定パラメータを参照してください。
</p><p>
<span class="original">
The <filename>pg_hba.conf</filename> file is read on start-up and when
the main server process receives a
<systemitem>SIGHUP</systemitem><indexterm><primary>SIGHUP</primary></indexterm>
signal. If you edit the file on an
active system, you will need to signal the postmaster
(using <literal>pg_ctl reload</literal>, calling the SQL function
<function>pg_reload_conf()</function>, or using <literal>kill
-HUP</literal>) to make it re-read the file.
</span>
<code class="filename">pg_hba.conf</code>ファイルは起動時と、主サーバプロセスが<span class="systemitem">SIGHUP</span>シグナルを受け取った時に読み込まれます。<a id="id-1.6.7.9.4.3" class="indexterm"></a>
稼働中のシステムでファイルを編集した場合は、(<code class="literal">pg_ctl reload</code>の使用、SQL関数の<code class="function">pg_reload_conf()</code>の呼び出し、または<code class="literal">kill -HUP</code>を使用して)postmasterにファイルをもう一度読み込むようにシグナルを出さなければなりません。
</p><div class="note"><h3 class="title">注記</h3><p>
<span class="original">
The preceding statement is not true on Microsoft Windows: there, any
changes in the <filename>pg_hba.conf</filename> file are immediately
applied by subsequent new connections.
</span>
上記はマイクロソフトWindowsに対して当てはまりません。
つまり、<code class="filename">pg_hba.conf</code>に対する変更は、ただちにそれ以降の新しい接続に反映されます。
</p></div><p>
<span class="original">
The system view
<link linkend="view-pg-hba-file-rules"><structname>pg_hba_file_rules</structname></link>
can be helpful for pre-testing changes to the <filename>pg_hba.conf</filename>
file, or for diagnosing problems if loading of the file did not have the
desired effects. Rows in the view with
non-null <structfield>error</structfield> fields indicate problems in the
corresponding lines of the file.
</span>
<code class="filename">pg_hba.conf</code>に対する変更を事前にテストする際、あるいはそのファイルをロードしても期待していた結果が得られなかった場合には、システムビュー<a class="link" href="view-pg-hba-file-rules.html" title="53.10. pg_hba_file_rules"><code class="structname">pg_hba_file_rules</code></a>が役に立ちます。
そのビューの<code class="structfield">error</code>フィールドがNULLでない行は、そのファイルの該当行に問題があることを示しています。
</p><p>
<span class="original">
The general format of the <filename>pg_hba.conf</filename> file is
a set of records, one per line. Blank lines are ignored, as is any
text after the <literal>#</literal> comment character.
A record can be continued onto the next line by ending the line with
a backslash. (Backslashes are not special except at the end of a line.)
A record is made
up of a number of fields which are separated by spaces and/or tabs.
Fields can contain white space if the field value is double-quoted.
Quoting one of the keywords in a database, user, or address field (e.g.,
<literal>all</literal> or <literal>replication</literal>) makes the word lose its special
meaning, and just match a database, user, or host with that name.
Backslash line continuation applies even within quoted text or comments.
</span>
<code class="filename">pg_hba.conf</code>ファイルの一般的な書式は、1行につき1つのレコードというレコードの集合です。
空行はコメント用の<code class="literal">#</code>文字以降の文字と同じく無視されます。
行の最後をバックスラッシュで終えることによりレコードを次の行に継続できます。(行の最後を除き、バックスラッシュは特別扱いされません。)
レコードはスペースもしくはタブ、もしくはその両方で区切られた、複数のフィールドで構成されています。
フィールドには、フィールド値が二重引用符付きの場合空白文字を含むことができます。
データベース、ユーザもしくはアドレスフィールド内のキーワード(例:<code class="literal">all</code>または<code class="literal">replication</code>)の一つを引用するとその特別な意味が失われ、その名称のデータベース、ユーザもしくはホストと一致するようになります。
引用テキストあるいはコメントもバックスラッシュで行を継続できます。
</p><p>
<span class="original">
Each authentication record specifies a connection type, a client IP address
range (if relevant for the connection type), a database name, a user name,
and the authentication method to be used for connections matching
these parameters. The first record with a matching connection type,
client address, requested database, and user name is used to perform
authentication. There is no <quote>fall-through</quote> or
<quote>backup</quote>: if one record is chosen and the authentication
fails, subsequent records are not considered. If no record matches,
access is denied.
</span>
それぞれの認証レコードは接続形式、(接続形式に対して意味を持つのであれば)クライアントのIPアドレス範囲、データベースの名前、ユーザ名およびこれらのパラメータに一致する接続で使用される認証方法を指定します。
接続形式、クライアントアドレス、要求されたデータベース、およびユーザ名に一致する最初のレコードが認証処理に使用されます。
<span class="quote">「<span class="quote">失敗時の継続</span>」</span>や、 あるいは<span class="quote">「<span class="quote">バックアップ</span>」</span>はありません。
これは、もしあるレコードが選択されて認証に失敗した場合、後続のレコードは考慮されないということです。
どのレコードも一致しない時はアクセスが拒否されます。
</p><p>
<span class="original">
Each record can be an include directive or an authentication record.
Include directives specify files that can be included, that contain
additional records. The records will be inserted in place of the
include directives. Include directives only contain two fields:
<literal>include</literal>, <literal>include_if_exists</literal> or
<literal>include_dir</literal> directive and the file or directory to be
included. The file or directory can be a relative or absolute path, and can
be double-quoted. For the <literal>include_dir</literal> form, all files
not starting with a <literal>.</literal> and ending with
<literal>.conf</literal> will be included. Multiple files within an include
directory are processed in file name order (according to C locale rules,
i.e., numbers before letters, and uppercase letters before lowercase ones).
</span>
各レコードは、includeディレクティブまたは認証レコードにできます。
includeディレクティブは、追加レコードを含むインクルード可能なファイルを指定します。
レコードは、includeディレクティブの代わりに挿入されます。
includeディレクティブには以下の2つのフィールドのみが含まれます。<code class="literal">include</code>、<code class="literal">include_if_exists</code>または<code class="literal">include_dir</code>ディレクティブと、インクルードするファイルまたはディレクトリです。
ファイルまたはディレクトリは、相対または絶対パスにでき、二重引用符で囲むことができます。
<code class="literal">include_dir</code>形式の場合、<code class="literal">.</code>で始まらず<code class="literal">.conf</code>で終わるすべてのファイルがインクルードされます。
インクルードディレクトリ内の複数のファイルは、ファイル名の順(Cロケールの規則に従って、すなわち、文字より先に数字、小文字より先に大文字)に処理されます。
</p><p>
<span class="original">
A record can have several formats:
</span>
レコードはいくつかの形式があります。
</p><pre class="synopsis">
local <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
host <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>address</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostssl <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>address</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostnossl <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>address</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostgssenc <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>address</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostnogssenc <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>address</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
host <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>IP-address</code></em> <em class="replaceable"><code>IP-mask</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostssl <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>IP-address</code></em> <em class="replaceable"><code>IP-mask</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostnossl <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>IP-address</code></em> <em class="replaceable"><code>IP-mask</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostgssenc <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>IP-address</code></em> <em class="replaceable"><code>IP-mask</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
hostnogssenc <em class="replaceable"><code>database</code></em> <em class="replaceable"><code>user</code></em> <em class="replaceable"><code>IP-address</code></em> <em class="replaceable"><code>IP-mask</code></em> <em class="replaceable"><code>auth-method</code></em> [<span class="optional"><em class="replaceable"><code>auth-options</code></em></span>]
include <em class="replaceable"><code>file</code></em>
include_if_exists <em class="replaceable"><code>file</code></em>
include_dir <em class="replaceable"><code>directory</code></em>
</pre><p>
<span class="original">
The meaning of the fields is as follows:
</span>
フィールドの意味は以下のようになっています。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">local</code></span></dt><dd><p>
<span class="original">
This record matches connection attempts using Unix-domain
sockets. Without a record of this type, Unix-domain socket
connections are disallowed.
</span>
このレコードはUnixドメインソケットを使用する接続に対応します。
この種類のレコードを使用しないと、Unixドメインソケット経由の接続は拒否されます。
</p></dd><dt><span class="term"><code class="literal">host</code></span></dt><dd><p>
<span class="original">
This record matches connection attempts made using TCP/IP.
<literal>host</literal> records match
<acronym>SSL</acronym> or non-<acronym>SSL</acronym> connection
attempts as well as <acronym>GSSAPI</acronym> encrypted or
non-<acronym>GSSAPI</acronym> encrypted connection attempts.
</span>
このレコードは、TCP/IPを使用した接続に対応します。
<code class="literal">host</code>レコードは、<acronym class="acronym">SSL</acronym>または非<acronym class="acronym">SSL</acronym>接続、<acronym class="acronym">GSSAPI</acronym>暗号化、非<acronym class="acronym">GSSAPI</acronym>暗号化のいずれかに対応します。
</p><div class="note"><h3 class="title">注記</h3><p>
<span class="original">
Remote TCP/IP connections will not be possible unless
the server is started with an appropriate value for the
<xref linkend="guc-listen-addresses"/> configuration parameter,
since the default behavior is to listen for TCP/IP connections
only on the local loopback address <literal>localhost</literal>.
</span>
サーバのデフォルトの動作は、ローカルループバックアドレスである<code class="literal">localhost</code>のみTCP/IP接続を監視しています。
よってサーバにおいて<a class="xref" href="runtime-config-connection.html#GUC-LISTEN-ADDRESSES">listen_addresses</a>パラメータが適切な値に設定された状態で起動されていない限り、リモートのTCP/IP接続はできません。
</p></div></dd><dt><span class="term"><code class="literal">hostssl</code></span></dt><dd><p>
<span class="original">
This record matches connection attempts made using TCP/IP,
but only when the connection is made with <acronym>SSL</acronym>
encryption.
</span>
このレコードは、接続が<acronym class="acronym">SSL</acronym>で暗号化されている場合にのみTCP/IPネットワークを使用する接続に対応します。
</p><p>
<span class="original">
To make use of this option the server must be built with
<acronym>SSL</acronym> support. Furthermore,
<acronym>SSL</acronym> must be enabled
by setting the <xref linkend="guc-ssl"/> configuration parameter (see
<xref linkend="ssl-tcp"/> for more information).
Otherwise, the <literal>hostssl</literal> record is ignored except for
logging a warning that it cannot match any connections.
</span>
このオプションを使用するためには、サーバは<acronym class="acronym">SSL</acronym>サポートができるように構築されていなければいけません。
また、 <acronym class="acronym">SSL</acronym>は<a class="xref" href="runtime-config-connection.html#GUC-SSL">ssl</a>パラメータを設定することによりサーバの起動時に有効になっていなくてはなりません(詳細は<a class="xref" href="ssl-tcp.html" title="18.9. SSLによる安全なTCP/IP接続">18.9</a>を参照してください)。
そうでなければ、どのような接続にも対応していないという警告が表示されることを除き、<code class="literal">hostssl</code>レコードは無視されます。
</p></dd><dt><span class="term"><code class="literal">hostnossl</code></span></dt><dd><p>
<span class="original">
This record type has the opposite behavior of <literal>hostssl</literal>;
it only matches connection attempts made over
TCP/IP that do not use <acronym>SSL</acronym>.
</span>
このレコードは、<code class="literal">hostssl</code>と反対の動作で、<acronym class="acronym">SSL</acronym>を使用していないTCP/IPの接続のみに対応します。
</p></dd><dt><span class="term"><code class="literal">hostgssenc</code></span></dt><dd><p>
<span class="original">
This record matches connection attempts made using TCP/IP,
but only when the connection is made with <acronym>GSSAPI</acronym>
encryption.
</span>
このレコードは、TCP/IPを使用した接続に対応しますが、<acronym class="acronym">GSSAPI</acronym>暗号化を使用して接続が行われた場合に限ります。
</p><p>
<span class="original">
To make use of this option the server must be built with
<acronym>GSSAPI</acronym> support. Otherwise,
the <literal>hostgssenc</literal> record is ignored except for logging
a warning that it cannot match any connections.
</span>
このオプションを使用するためには、サーバは<acronym class="acronym">GSSAPI</acronym>サポートができるように構築されていなければいけません。
そうでなければ、どのような接続にも対応していないという警告が表示されることを除き、<code class="literal">hostgssenc</code>レコードは無視されます。
</p></dd><dt><span class="term"><code class="literal">hostnogssenc</code></span></dt><dd><p>
<span class="original">
This record type has the opposite behavior of <literal>hostgssenc</literal>;
it only matches connection attempts made over
TCP/IP that do not use <acronym>GSSAPI</acronym> encryption.
</span>
このレコードは、<code class="literal">hostgssenc</code>とは反対の動作で、<acronym class="acronym">GSSAPI</acronym>暗号化を使用していないTCP/IPの接続のみに対応します。
</p></dd><dt><span class="term"><em class="replaceable"><code>database</code></em></span></dt><dd><p>
<span class="original">
Specifies which database name(s) this record matches. The value
<literal>all</literal> specifies that it matches all databases.
The value <literal>sameuser</literal> specifies that the record
matches if the requested database has the same name as the
requested user. The value <literal>samerole</literal> specifies that
the requested user must be a member of the role with the same
name as the requested database. (<literal>samegroup</literal> is an
obsolete but still accepted spelling of <literal>samerole</literal>.)
Superusers are not considered to be members of a role for the
purposes of <literal>samerole</literal> unless they are explicitly
members of the role, directly or indirectly, and not just by
virtue of being a superuser.
The value <literal>replication</literal> specifies that the record
matches if a physical replication connection is requested, however, it
doesn't match with logical replication connections. Note that physical
replication connections do not specify any particular database whereas
logical replication connections do specify it.
Otherwise, this is the name of a specific
<productname>PostgreSQL</productname> database or a regular expression.
Multiple database names and/or regular expressions can be supplied by
separating them with commas.
</span>
このレコードで対応するデータベース名を指定します。
<code class="literal">all</code> という値は、全てのデータベースと対応することを指定します。
<code class="literal">sameuser</code>という値は、要求されたデータベースが要求ユーザと同じ名前を持つ場合にレコードが対応することを指定します。
<code class="literal">samerole</code>という値は、要求ユーザが要求されたデータベースと同じ名前のロールのメンバでなければならないことを指定します。
(以前は<code class="literal">samegroup</code>と書いていましたが、<code class="literal">samerole</code>と記述してください。)
スーパーユーザは、直接的であれ間接的であれ、明示的にsameroleのメンバでない限りsameroleのメンバとはみなされません。
また、スーパーユーザであるからといって<code class="literal">samerole</code>のメンバとはみなされません。
<code class="literal">replication</code>という値は、もし物理レプリケーション接続が要求された場合にレコードが一致することを指定します。
しかし、論理レプリケーションによる接続には一致しません。
物理レプリケーション接続は特定のデータベースを指定しないのに対し、論理レプリケーション接続は特定のデータベースを指定することに注意してください。
それ以外の場合には、特定の<span class="productname">PostgreSQL</span>データベースの名前または正規表現になります。
データベースの名前や正規表現はカンマで区切ることで複数指定できます。
</p><p>
<span class="original">
If the database name starts with a slash (<literal>/</literal>), the
remainder of the name is treated as a regular expression.
(See <xref linkend="posix-syntax-details"/> for details of
<productname>PostgreSQL</productname>'s regular expression syntax.)
</span>
データベース名がスラッシュ(<code class="literal">/</code>)で始まる場合、名前の残りの部分は正規表現として扱われます。
(<span class="productname">PostgreSQL</span>の正規表現構文の詳細については、<a class="xref" href="functions-matching.html#POSIX-SYNTAX-DETAILS" title="9.7.3.1. 正規表現の詳細">9.7.3.1</a>を参照してください。)
</p><p>
<span class="original">
A separate file containing database names and/or regular expressions
can be specified by preceding the file name with <literal>@</literal>.
</span>
データベース名や正規表現を含む別のファイルを、そのファイル名の前に<code class="literal">@</code>を付けることで指定できます。
</p></dd><dt><span class="term"><em class="replaceable"><code>user</code></em></span></dt><dd><p>
<span class="original">
Specifies which database user name(s) this record
matches. The value <literal>all</literal> specifies that it
matches all users. Otherwise, this is either the name of a specific
database user, a regular expression (when starting with a slash
(<literal>/</literal>), or a group name preceded by <literal>+</literal>.
(Recall that there is no real distinction between users and groups
in <productname>PostgreSQL</productname>; a <literal>+</literal> mark really means
<quote>match any of the roles that are directly or indirectly members
of this role</quote>, while a name without a <literal>+</literal> mark matches
only that specific role.) For this purpose, a superuser is only
considered to be a member of a role if they are explicitly a member
of the role, directly or indirectly, and not just by virtue of
being a superuser.
Multiple user names and/or regular expressions can be supplied by
separating them with commas.
</span>
このレコードで対応するデータベースユーザ名を指定します。
<code class="literal">all</code>という値は、全てのユーザが対応することを指定します。
それ以外の場合には特定のデータベースユーザの名前、(スラッシュ(<code class="literal">/</code>)で始まる場合には)正規表現、もしくは<code class="literal">+</code>で始まるグループ名のいずれかになります。
(<span class="productname">PostgreSQL</span>ではユーザとグループの明確な区別がないことを思い出してください。
<code class="literal">+</code>のマークは実のところ、<span class="quote">「<span class="quote">このロールの直接的もしくは間接的なメンバのどちらかに一致していること</span>」</span>を意味しています。
一方、<code class="literal">+</code>のマークがない名前はその特定のロールにのみ一致します。)
このため、スーパーユーザは、直接的であれ間接的であれ明示的にロールのメンバである場合にのみ、ロールのメンバとみなされます。
スーパーユーザであるからといってロールのメンバとはみなされません。
ユーザ名や正規表現は、カンマで区切ることで複数指定できます。
</p><p>
<span class="original">
If the user name starts with a slash (<literal>/</literal>), the
remainder of the name is treated as a regular expression.
(See <xref linkend="posix-syntax-details"/> for details of
<productname>PostgreSQL</productname>'s regular expression syntax.)
</span>
ユーザ名がスラッシュ(<code class="literal">/</code>)で始まる場合、名前の残りの部分は正規表現として扱われます。
(<span class="productname">PostgreSQL</span>の正規表現構文の詳細については、<a class="xref" href="functions-matching.html#POSIX-SYNTAX-DETAILS" title="9.7.3.1. 正規表現の詳細">9.7.3.1</a>を参照してください。)
</p><p>
<span class="original">
A separate file containing user names and/or regular expressions can
be specified by preceding the file name with <literal>@</literal>.
</span>
ユーザ名や正規表現を含む別のファイルを、そのファイル名の前に<code class="literal">@</code>を付けることで指定できます。
</p></dd><dt><span class="term"><em class="replaceable"><code>address</code></em></span></dt><dd><p>
<span class="original">
Specifies the client machine address(es) that this record
matches. This field can contain either a host name, an IP
address range, or one of the special key words mentioned below.
</span>
このレコードに対応しているクライアントマシンのアドレス。
このフィールドはホスト名、IPアドレスの範囲、もしくは下記の特別なキーワードの1つを含んでいます。
</p><p>
<span class="original">
An IP address range is specified using standard numeric notation
for the range's starting address, then a slash (<literal>/</literal>)
and a <acronym>CIDR</acronym> mask length. The mask
length indicates the number of high-order bits of the client
IP address that must match. Bits to the right of this should
be zero in the given IP address.
There must not be any white space between the IP address, the
<literal>/</literal>, and the CIDR mask length.
</span>
IPアドレスの範囲は、範囲の開始アドレス、続いてスラッシュ(<code class="literal">/</code>)と<acronym class="acronym">CIDR</acronym>マスクの長さという標準の数値表記で指定されます。
CIDRマスク長とは、クライアントIPアドレスが一致しなければならない、高位のビット数を表すものです。
指定するIPアドレスのこれより右側のビットには、0を指定しなければなりません。
IPアドレスと<code class="literal">/</code>、およびCIDRマスク長の間に空白を入れてはいけません。
</p><p>
<span class="original">
Typical examples of an IPv4 address range specified this way are
<literal>172.20.143.89/32</literal> for a single host, or
<literal>172.20.143.0/24</literal> for a small network, or
<literal>10.6.0.0/16</literal> for a larger one.
An IPv6 address range might look like <literal>::1/128</literal>
for a single host (in this case the IPv6 loopback address) or
<literal>fe80::7a31:c1ff:0000:0000/96</literal> for a small
network.
<literal>0.0.0.0/0</literal> represents all
IPv4 addresses, and <literal>::0/0</literal> represents
all IPv6 addresses.
To specify a single host, use a mask length of 32 for IPv4 or
128 for IPv6. In a network address, do not omit trailing zeroes.
</span>
典型的なIPv4アドレス範囲の例は、単一のホストでは<code class="literal">172.20.143.89/32</code>、小規模ネットワークでは<code class="literal">172.20.143.0/24</code>、大規模ネットワークでは<code class="literal">10.6.0.0/16</code>のようなものです。
IPv6アドレスの範囲は、単一のホストでは<code class="literal">::1/128</code>(この場合はIPv6ループバックアドレス)、小規模ネットワークでは<code class="literal">fe80::7a31:c1ff:0000:0000/96</code>のようなものです。
<code class="literal">0.0.0.0/0</code>は全てのIPv4アドレスを意味します。また、<code class="literal">::0/0</code>は全てのIPv6アドレスを意味しています。
単一ホストを指定するには、IPv4では32、IPv6では128というマスク長を使用してください。
ネットワークアドレスでは末尾の0を省略できません。
</p><p>
<span class="original">
An entry given in IPv4 format will match only IPv4 connections,
and an entry given in IPv6 format will match only IPv6 connections,
even if the represented address is in the IPv4-in-IPv6 range.
</span>
IPv4書式で与えられたエントリは、IPv4接続のみに対応し、IPv6書式で与えられた項目は、たとえそのアドレスがIPv6内のIPv4の範囲内であったとしてもIPv6接続のみに対応します。
</p><p>
<span class="original">
You can also write <literal>all</literal> to match any IP address,
<literal>samehost</literal> to match any of the server's own IP
addresses, or <literal>samenet</literal> to match any address in any
subnet that the server is directly connected to.
</span>
どのIPアドレスにも一致するように<code class="literal">all</code>と書くこともできますし、
サーバ自身のIPアドレスのいずれかにも一致するように<code class="literal">samehost</code>と書くこともできます。
もしくは、サーバが直接接続されているサブネット内のアドレスのいずれかにも一致するように<code class="literal">samenet</code>と書くことができます。
</p><p>
<span class="original">
If a host name is specified (anything that is not an IP address
range or a special key word is treated as a host name),
that name is compared with the result of a reverse name
resolution of the client's IP address (e.g., reverse DNS
lookup, if DNS is used). Host name comparisons are case
insensitive. If there is a match, then a forward name
resolution (e.g., forward DNS lookup) is performed on the host
name to check whether any of the addresses it resolves to are
equal to the client's IP address. If both directions match,
then the entry is considered to match. (The host name that is
used in <filename>pg_hba.conf</filename> should be the one that
address-to-name resolution of the client's IP address returns,
otherwise the line won't be matched. Some host name databases
allow associating an IP address with multiple host names, but
the operating system will only return one host name when asked
to resolve an IP address.)
</span>
もし、ホスト名(IPアドレスの範囲ではない場合の全て、もしくはホスト名として処理される特別なキーワード)が指定されている場合は、その名前は、クライアントのIPアドレスの逆引き名前解決の結果と比較されます(例えば、もしDNSが使用されている場合は逆引きDNS検索により解決されます)。
ホスト名の比較は、大文字小文字が区別されません。
もし一致するものがあった場合は、解決された、どのアドレスもクライアントのIPアドレスと等しいか否かをチェックするために(例えば、正引きDNS検索のような)ホスト名の正引き名前解決が実行されます。
もし正引き、逆引きの両方で一致した場合は、エントリは一致するものとみなされます。
(<code class="filename">pg_hba.conf</code>内で使用されているホスト名は、クライアントのIPアドレスのアドレス-名前解決が返すホスト名の1つでなければいけません。
もしそうでなければこの行は一致しません。
1つのIPアドレスを複数のホスト名に関連付けるホスト名データベースもありますが、IPアドレスの解決を要求された場合にオペレーティングシステムは1つのホスト名のみを返します。)
</p><p>
<span class="original">
A host name specification that starts with a dot
(<literal>.</literal>) matches a suffix of the actual host
name. So <literal>.example.com</literal> would match
<literal>foo.example.com</literal> (but not just
<literal>example.com</literal>).
</span>
ドット(<code class="literal">.</code>)で始まるホスト名の特定は実際のホスト名のサフィックスに一致します。
よって、<code class="literal">.example.com</code>は、<code class="literal">foo.example.com</code>に一致します
(<code class="literal">example.com</code>だけでは一致しません)。
</p><p>
<span class="original">
When host names are specified
in <filename>pg_hba.conf</filename>, you should make sure that
name resolution is reasonably fast. It can be of advantage to
set up a local name resolution cache such
as <command>nscd</command>. Also, you may wish to enable the
configuration parameter <varname>log_hostname</varname> to see
the client's host name instead of the IP address in the log.
</span>
ホスト名が<code class="filename">pg_hba.conf</code>内で指定されている場合、名前解決が適度に早いことを
確かめてください。
<code class="command">nscd</code>のようなローカル名前解決のキャッシュを設定すると便利です。
また、クライアントのIPアドレスの代わりにホスト名がログで見られるように、<code class="varname">log_hostname</code>の
設定パラメータを有効化することもできます。
</p><p>
<span class="original">
These fields do not apply to <literal>local</literal> records.
</span>
これらのフィールドは<code class="literal">local</code>レコードに適用されません。
</p><div class="note"><h3 class="title">注記</h3><p>
<span class="original">
Users sometimes wonder why host names are handled
in this seemingly complicated way, with two name resolutions
including a reverse lookup of the client's IP address. This
complicates use of the feature in case the client's reverse DNS
entry is not set up or yields some undesirable host name.
It is done primarily for efficiency: this way, a connection attempt
requires at most two resolver lookups, one reverse and one forward.
If there is a resolver problem with some address, it becomes only
that client's problem. A hypothetical alternative
implementation that only did forward lookups would have to
resolve every host name mentioned in
<filename>pg_hba.conf</filename> during every connection attempt.
That could be quite slow if many names are listed.
And if there is a resolver problem with one of the host names,
it becomes everyone's problem.
</span>
時折、ユーザは、クライアントのIPアドレスの逆引きを含む2つの名前解決が必要になる、というような一見複雑に見える方法でなぜホスト名が扱われるのか不思議に思うことがあります。
このため、クライアントの逆引きDNSエントリが設定されていなかったり、いくつかの望ましくないホスト名を生成する場合にこの機能の使用が複雑になります。
これは主に効率のために行われます。このように、接続要求では最大2つのリゾルバの検索、1つは逆引き、1つは正引き、が必要になります。
もしリゾルバにおいて、アドレスに問題があった場合、クライアントのみの問題となります。
正引き検索のみを行うような実装を仮に行っていると、全ての接続要求において<code class="filename">pg_hba.conf</code>内に記載された全てのホスト名を解決しなくてはいけなくなります。
これは、多くの名前が列挙されていた場合にかなり遅くなります。
また、リゾルバにおいて1つのホスト名に問題があった場合、全員の問題となってしまいます。
</p><p>
<span class="original">
Also, a reverse lookup is necessary to implement the suffix
matching feature, because the actual client host name needs to
be known in order to match it against the pattern.
</span>
さらに、逆引き検索はサフィックス一致の機能を実装するために必要です。というのも実際のクライアントのホスト名は
ホスト名がパターンに対して一致するために、知られる必要があるためです。
</p><p>
<span class="original">
Note that this behavior is consistent with other popular
implementations of host name-based access control, such as the
Apache HTTP Server and TCP Wrappers.
</span>
このふるまいは、Apache HTTPサーバやTCPラッパーのような他のよくあるホスト名ベースのアクセス制御の実装と
一致していることに注意してください。
</p></div></dd><dt><span class="term"><em class="replaceable"><code>IP-address</code></em><br /></span><span class="term"><em class="replaceable"><code>IP-mask</code></em></span></dt><dd><p>
<span class="original">
These two fields can be used as an alternative to the
<replaceable>IP-address</replaceable><literal>/</literal><replaceable>mask-length</replaceable>
notation. Instead of
specifying the mask length, the actual mask is specified in a
separate column. For example, <literal>255.0.0.0</literal> represents an IPv4
CIDR mask length of 8, and <literal>255.255.255.255</literal> represents a
CIDR mask length of 32.
</span>
この2つのフィールドは<em class="replaceable"><code>IP-address</code></em><code class="literal">/</code><em class="replaceable"><code>mask-length</code></em>表記の代替として使用可能です。
マスク長を指定する代わりに、実際のマスクを分離した列で指定します。
例えば<code class="literal">255.0.0.0</code>はIPv4のCIDRマスク長8を意味し、<code class="literal">255.255.255.255</code>はCIDRマスク長32を意味しています。
</p><p>
<span class="original">
These fields do not apply to <literal>local</literal> records.
</span>
これらのフィールドは<code class="literal">local</code>レコードに適用されません。
</p></dd><dt><span class="term"><em class="replaceable"><code>auth-method</code></em></span></dt><dd><p>
<span class="original">
Specifies the authentication method to use when a connection matches
this record. The possible choices are summarized here; details
are in <xref linkend="auth-methods"/>. All the options
are lower case and treated case sensitively, so even acronyms like
<literal>ldap</literal> must be specified as lower case.
</span>
接続がこのレコードに一致する場合に使用する認証方式を指定します。
使用できる選択肢は以下にまとめていますが、詳しくは<a class="xref" href="auth-methods.html" title="20.3. 認証方式">20.3</a>を参照してください。
すべてのオプションは小文字で、大文字小文字の区別が認識されます。ですから、<code class="literal">ldap</code>のような頭文字であっても小文字で指定しなければなりません。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">trust</code></span></dt><dd><p>
<span class="original">
Allow the connection unconditionally. This method
allows anyone that can connect to the
<productname>PostgreSQL</productname> database server to login as
any <productname>PostgreSQL</productname> user they wish,
without the need for a password or any other authentication. See <xref
linkend="auth-trust"/> for details.
</span>
接続を無条件で許可します。
この方式は、<span class="productname">PostgreSQL</span>データベースサーバに接続できる全てのユーザが、任意の<span class="productname">PostgreSQL</span>ユーザとしてパスワードや他の認証なしでログインすることを許可します。
詳細は<a class="xref" href="auth-trust.html" title="20.4. Trust認証">20.4</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">reject</code></span></dt><dd><p>
<span class="original">
Reject the connection unconditionally. This is useful for
<quote>filtering out</quote> certain hosts from a group, for example a
<literal>reject</literal> line could block a specific host from connecting,
while a later line allows the remaining hosts in a specific
network to connect.
</span>
接続を無条件に拒否します。
特定のホストをあるグループから<span class="quote">「<span class="quote">除外</span>」</span>するために便利です。
例えば、1行の<code class="literal">reject</code>は特定のホストが接続することを拒否します。一方、
後ろの行では特定のネットワーク内の残りのホストが接続することを許可します。
</p></dd><dt><span class="term"><code class="literal">scram-sha-256</code></span></dt><dd><p>
<span class="original">
Perform SCRAM-SHA-256 authentication to verify the user's
password. See <xref linkend="auth-password"/> for details.
</span>
ユーザのパスワードを検証するためにSCRAM-SHA-256認証を実行します。
詳細は<a class="xref" href="auth-password.html" title="20.5. パスワード認証">20.5</a>をご覧ください。
</p></dd><dt><span class="term"><code class="literal">md5</code></span></dt><dd><p>
<span class="original">
Perform SCRAM-SHA-256 or MD5 authentication to verify the
user's password. See <xref linkend="auth-password"/>
for details.
</span>
ユーザのパスワードを検証するために、SCRAM-SHA-256あるいはMD5認証を実行します。
詳細は<a class="xref" href="auth-password.html" title="20.5. パスワード認証">20.5</a>を参照してください。
</p><div class="warning"><h3 class="title">警告</h3><p>
<span class="original">
Support for MD5-encrypted passwords is deprecated and will be
removed in a future release of
<productname>PostgreSQL</productname>. Refer to
<xref linkend="auth-password"/> for details about migrating to
another password type.
</span>
MD5で暗号化されたパスワードの使用は非推奨となり、将来の<span class="productname">PostgreSQL</span>のリリースで削除されます。
他のパスワードタイプへの移行の詳細については、<a class="xref" href="auth-password.html" title="20.5. パスワード認証">20.5</a>を参照してください。
</p></div></dd><dt><span class="term"><code class="literal">password</code></span></dt><dd><p>
<span class="original">
Require the client to supply an unencrypted password for
authentication.
Since the password is sent in clear text over the
network, this should not be used on untrusted networks.
See <xref linkend="auth-password"/> for details.
</span>
クライアントに対して認証時に平文のパスワードを要求します。
パスワードはネットワークを通じて普通のテキスト形式で送られますので、信頼されていないネットワークでは使用しないでください。
詳細は<a class="xref" href="auth-password.html" title="20.5. パスワード認証">20.5</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">gss</code></span></dt><dd><p>
<span class="original">
Use GSSAPI to authenticate the user. This is only
available for TCP/IP connections. See <xref
linkend="gssapi-auth"/> for details. It can be used in conjunction
with GSSAPI encryption.
</span>
ユーザの認証にGSSAPIを使用します。
これはTCP/IP接続を使用するときのみ使用可能です。
詳細は<a class="xref" href="gssapi-auth.html" title="20.6. GSSAPI認証">20.6</a>を参照してください。
GSSAPI暗号化と組み合わせて使用できます。
</p></dd><dt><span class="term"><code class="literal">sspi</code></span></dt><dd><p>
<span class="original">
Use SSPI to authenticate the user. This is only
available on Windows. See <xref
linkend="sspi-auth"/> for details.
</span>
ユーザの認証にSSPIを使用します。
これはWindowsを使用するときのみ使用可能です。
詳細は<a class="xref" href="sspi-auth.html" title="20.7. SSPI認証">20.7</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">ident</code></span></dt><dd><p>
<span class="original">
Obtain the operating system user name of the client
by contacting the ident server on the client
and check if it matches the requested database user name.
Ident authentication can only be used on TCP/IP
connections. When specified for local connections, peer
authentication will be used instead.
See <xref linkend="auth-ident"/> for details.
</span>
クライアントのオペレーティングシステムにおけるユーザ名をクライアント上のidentサーバに尋ねてユーザ名が要求されたデータベースユーザ名と一致するか検査します。
ident認証は、TCP/IP接続でのみ使用可能です。ローカル接続が指定されている場合は、peer認証が代わりに使用されます。
詳細は<a class="xref" href="auth-ident.html" title="20.8. Ident認証">20.8</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">peer</code></span></dt><dd><p>
<span class="original">
Obtain the client's operating system user name from the operating
system and check if it matches the requested database user name.
This is only available for local connections.
See <xref linkend="auth-peer"/> for details.
</span>
クライアントのオペレーティングシステムにおけるユーザ名をオペレーティングシステムから取得し、ユーザ名が要求されたデータベースユーザ名と一致するか検査します。
これはローカル接続の時にのみ使用可能です。詳細は<a class="xref" href="auth-peer.html" title="20.9. Peer認証">20.9</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">ldap</code></span></dt><dd><p>
<span class="original">
Authenticate using an <acronym>LDAP</acronym> server. See <xref
linkend="auth-ldap"/> for details.
</span>
<acronym class="acronym">LDAP</acronym>サーバを使用して認証します。
詳細は<a class="xref" href="auth-ldap.html" title="20.10. LDAP認証">20.10</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">radius</code></span></dt><dd><p>
<span class="original">
Authenticate using a RADIUS server. See <xref
linkend="auth-radius"/> for details.
</span>
RADIUSサーバを使用して認証します。
詳細は<a class="xref" href="auth-radius.html" title="20.11. RADIUS認証">20.11</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">cert</code></span></dt><dd><p>
<span class="original">
Authenticate using SSL client certificates. See
<xref linkend="auth-cert"/> for details.
</span>
SSLクライアント証明書を使用して認証します。
詳細は<a class="xref" href="auth-cert.html" title="20.12. 証明書認証">20.12</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">pam</code></span></dt><dd><p>
<span class="original">
Authenticate using the Pluggable Authentication Modules
(PAM) service provided by the operating system. See <xref
linkend="auth-pam"/> for details.
</span>
オペレーティングシステムによって提供されるPAM(Pluggable Authentication Modules)サービスを使用した認証です。
詳細は<a class="xref" href="auth-pam.html" title="20.13. PAM認証">20.13</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">bsd</code></span></dt><dd><p>
<span class="original">
Authenticate using the BSD Authentication service provided by the
operating system. See <xref linkend="auth-bsd"/> for details.
</span>
オペレーティングシステムによって提供されたBSD認証サービスを使用して認証します。
詳細は<a class="xref" href="auth-bsd.html" title="20.14. BSD認証">20.14</a>を参照してください。
</p></dd><dt><span class="term"><code class="literal">oauth</code></span></dt><dd><p>
<span class="original">
Authorize and optionally authenticate using a third-party OAuth 2.0
identity provider. See <xref linkend="auth-oauth"/> for details.
</span>
サードパーティのOAuth 2.0アイデンティティプロバイダの使用を認可します。オプションで認証もします。
詳細は、<a class="xref" href="auth-oauth.html" title="20.15. OAuth認可/認証">20.15</a>を参照してください。
</p></dd></dl></div><p>
</p></dd><dt><span class="term"><em class="replaceable"><code>auth-options</code></em></span></dt><dd><p>
<span class="original">
After the <replaceable>auth-method</replaceable> field, there can be field(s) of
the form <replaceable>name</replaceable><literal>=</literal><replaceable>value</replaceable> that
specify options for the authentication method. Details about which
options are available for which authentication methods appear below.
</span>
<em class="replaceable"><code>auth-method</code></em>フィールドの後ろに、
認証方式のオプションを指定する、<em class="replaceable"><code>name</code></em><code class="literal">=</code><em class="replaceable"><code>value</code></em>の形式のフィールドが存在する可能性があります。
どのオプションがどの認証方式に使用できるのか、についての詳細は以下で説明します。
</p><p>
<span class="original">
In addition to the method-specific options listed below, there is a
method-independent authentication option <literal>clientcert</literal>, which
can be specified in any <literal>hostssl</literal> record.
This option can be set to <literal>verify-ca</literal> or
<literal>verify-full</literal>. Both options require the client
to present a valid (trusted) SSL certificate, while
<literal>verify-full</literal> additionally enforces that the
<literal>cn</literal> (Common Name) in the certificate matches
the username or an applicable mapping.
This behavior is similar to the <literal>cert</literal> authentication
method (see <xref linkend="auth-cert"/>) but enables pairing
the verification of client certificates with any authentication
method that supports <literal>hostssl</literal> entries.
</span>
以下に示された方式特定のオプションに加えて、方式に依存しないのひとつの認証オプション<code class="literal">clientcert</code>があり、<code class="literal">hostssl</code>レコードで指定できます。
このオプションは、<code class="literal">verify-ca</code>または<code class="literal">verify-full</code>に設定できます。
どちらのオプションも、クライアントに有効な(信頼された)SSL証明書の提出を要求し、<code class="literal">verify full</code>は、証明書の<code class="literal">cn</code>(Common Name)がユーザ名または適用可能なマッピングと一致することをさらに強制します。
この動作は<code class="literal">cert</code>認証方式(詳細は<a class="xref" href="auth-cert.html" title="20.12. 証明書認証">20.12</a>を参照してください)に似ていますが、クライアント証明書の検証を<code class="literal">hostssl</code>エントリをサポートする任意の認証方式と組み合わせることができます。
</p><p>
<span class="original">
On any record using client certificate authentication (i.e. one
using the <literal>cert</literal> authentication method or one
using the <literal>clientcert</literal> option), you can specify
which part of the client certificate credentials to match using
the <literal>clientname</literal> option. This option can have one
of two values. If you specify <literal>clientname=CN</literal>, which
is the default, the username is matched against the certificate's
<literal>Common Name (CN)</literal>. If instead you specify
<literal>clientname=DN</literal> the username is matched against the
entire <literal>Distinguished Name (DN)</literal> of the certificate.
This option is probably best used in conjunction with a username map.
The comparison is done with the <literal>DN</literal> in
<ulink url="https://datatracker.ietf.org/doc/html/rfc2253">RFC 2253</ulink>
format. To see the <literal>DN</literal> of a client certificate
in this format, do
</span>
クライアント証明書認証を使用するすべてのレコード(つまり、<code class="literal">cert</code>認証方式あるいは<code class="literal">clientcert</code>オプションを使用している)では、<code class="literal">clientname</code>オプションを使ってクライアント証明書資格情報のどの部分を照合するかを指定できます。
このオプションは2つの値のうち1つを持つことができます。
デフォルトである<code class="literal">clientname=CN</code>を指定すると、ユーザ名は証明書の<code class="literal">Common Name (CN)</code>と照合されます。
その代わりに<code class="literal">clientname=DN</code>を指定すると、ユーザ名は証明書の<code class="literal">Distinguished Name (DN)</code>全体と照合されます。
このオプションはおそらくユーザ名マップとともに使うのが最善です。
<a class="ulink" href="https://datatracker.ietf.org/doc/html/rfc2253" target="_top">RFC 2253</a>の<code class="literal">DN</code>と比較されます。
この形式のクライアント証明書の<code class="literal">DN</code>を参照するには以下のようにしてください。
</p><pre class="programlisting">
openssl x509 -in myclient.crt -noout -subject -nameopt RFC2253 | sed "s/^subject=//"
</pre><p>
<span class="original">
Care needs to be taken when using this option, especially when using
regular expression matching against the <literal>DN</literal>.
</span>
このオプションを使って<code class="literal">DN</code>に対して正規表現を使った比較を行う際にはとりわけ注意が必要です。
</p></dd><dt><span class="term"><code class="literal">include</code></span></dt><dd><p>
<span class="original">
This line will be replaced by the contents of the given file.
</span>
この行は、指定したファイルの内容に置き換えられます。
</p></dd><dt><span class="term"><code class="literal">include_if_exists</code></span></dt><dd><p>
<span class="original">
This line will be replaced by the content of the given file if the
file exists. Otherwise, a message is logged to indicate that the file
has been skipped.
</span>
ファイルが存在する場合、この行は指定したファイルの内容に置き換えられます。
存在しない場合は、ファイルがスキップされたことを示すメッセージが記録されます。
</p></dd><dt><span class="term"><code class="literal">include_dir</code></span></dt><dd><p>
<span class="original">
This line will be replaced by the contents of all the files found in
the directory, if they don't start with a <literal>.</literal> and end
with <literal>.conf</literal>, processed in file name order (according
to C locale rules, i.e., numbers before letters, and uppercase letters
before lowercase ones).
</span>
ファイル名が<code class="literal">.</code>で始まらず、<code class="literal">.conf</code>で終わる場合、この行は、そのディレクトリで見つかったすべてのファイルの内容に置き換えられ、ファイル名の順(Cロケールの規則に従って、すなわち、文字より先に数字、小文字より先に大文字)に処理されます。
</p></dd></dl></div><p>
</p><p>
<span class="original">
Files included by <literal>@</literal> constructs are read as lists of names,
which can be separated by either whitespace or commas. Comments are
introduced by <literal>#</literal>, just as in
<filename>pg_hba.conf</filename>, and nested <literal>@</literal> constructs are
allowed. Unless the file name following <literal>@</literal> is an absolute
path, it is taken to be relative to the directory containing the
referencing file.
</span>
<code class="literal">@</code>式により含められるファイルは、空白文字あるいはカンマのどちらかで区切られた名前の列挙として読み込まれます。
コメントは、<code class="filename">pg_hba.conf</code>と同様に<code class="literal">#</code>から始まります。
また、<code class="literal">@</code>式を入れ子にすることもできます。
<code class="literal">@</code>の後のファイル名が絶対パスでない限り、参照元ファイルが存在するディレクトリから見た相対パスであるとみなされます。
</p><p>
<span class="original">
Since the <filename>pg_hba.conf</filename> records are examined
sequentially for each connection attempt, the order of the records is
significant. Typically, earlier records will have tight connection
match parameters and weaker authentication methods, while later
records will have looser match parameters and stronger authentication
methods. For example, one might wish to use <literal>trust</literal>
authentication for local TCP/IP connections but require a password for
remote TCP/IP connections. In this case a record specifying
<literal>trust</literal> authentication for connections from 127.0.0.1 would
appear before a record specifying password authentication for a wider
range of allowed client IP addresses.
</span>
<code class="filename">pg_hba.conf</code>レコードは接続が試みられる度に順番に検査されますので、レコードの順序はとても大切です。
典型的には、始めの方のレコードには厳しい接続照合パラメータと緩い認証方式があるのに対し、終わりの方のレコードにはより緩い照合パラメータとより厳しい認証方式があります。
例えば、ローカルTCP接続では<code class="literal">trust</code>認証方式、リモートTCP接続に対してはパスワードを要求したいとします。
この場合、広範囲にわたって許可されるクライアントのIPアドレスに対するパスワード認証を指定するレコードの前に127.0.0.1からの接続に対する<code class="literal">trust</code>認証指定のレコードが置かれなければなりません。
</p><div class="tip"><h3 class="title">ヒント</h3><p>
<span class="original">
To connect to a particular database, a user must not only pass the
<filename>pg_hba.conf</filename> checks, but must have the
<literal>CONNECT</literal> privilege for the database. If you wish to
restrict which users can connect to which databases, it's usually
easier to control this by granting/revoking <literal>CONNECT</literal> privilege
than to put the rules in <filename>pg_hba.conf</filename> entries.
</span>
特定のデータベースに接続するためには、ユーザは<code class="filename">pg_hba.conf</code>による検査を通過しなければならない他、そのデータベースに対する<code class="literal">CONNECT</code>権限を持たなければなりません。
どのユーザがどのデータベースに接続できるかを制限したければ、通常、<code class="filename">pg_hba.conf</code>項目に規則を追加するよりも、<code class="literal">CONNECT</code>権限の付与・削除を行う方が簡単です。
</p></div><p>
<span class="original">
Some examples of <filename>pg_hba.conf</filename> entries are shown in
<xref linkend="example-pg-hba.conf"/>. See the next section for details on the
different authentication methods.
</span>
<code class="filename">pg_hba.conf</code>ファイルの例をいくつか<a class="xref" href="auth-pg-hba-conf.html#EXAMPLE-PG-HBA.CONF" title="例20.1 pg_hba.confの項目の例">例 20.1</a>に示します。
各種認証方式の詳細については次節で説明します。
</p><div class="example" id="EXAMPLE-PG-HBA.CONF"><p class="title"><strong>例20.1 <code class="filename">pg_hba.conf</code>の項目の例</strong></p><div class="example-contents"><span class="original">
<title>Example <filename>pg_hba.conf</filename> Entries</title>
</span><pre class="programlisting">
<span class="original">
# Allow any user on the local system to connect to any database with
# any database user name using Unix-domain sockets (the default for local
# connections).
</span>
# ローカルシステム上の全てのユーザが、任意のデータベースに
# 任意のデータベースユーザ名でUnixドメインソケットを使用して接続することを許可
# (ローカル接続ではデフォルト)。
#
# TYPE DATABASE USER ADDRESS METHOD
local all all trust
<span class="original">
# The same using local loopback TCP/IP connections.
</span>
# 上記と同じことをローカルループバックのTCP/IP接続を使って行う。
#
# TYPE DATABASE USER ADDRESS METHOD
host all all 127.0.0.1/32 trust
<span class="original">
# The same as the previous line, but using a separate netmask column
</span>
# 上記と同じだが、独立したネットマスク列を使用する
#
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host all all 127.0.0.1 255.255.255.255 trust
<span class="original">
# The same over IPv6.
</span>
# IPv6で上記と同じことを行う。
#
# TYPE DATABASE USER ADDRESS METHOD
host all all ::1/128 trust
<span class="original">
# The same using a host name (would typically cover both IPv4 and IPv6).
</span>
# ホスト名を使用して上記と同じことを行う(通常はIPv4とIPv6の両方をカバーします)。
#
# TYPE DATABASE USER ADDRESS METHOD
host all all localhost trust
<span class="original">
# The same using a regular expression for DATABASE, that allows connection
# to any databases with a name beginning with "db" and finishing with a
# number using two to four digits (like "db1234" or "db12").
</span>
# DATABASEに対して正規表現を使って同じことを行う。(「db1234」や「db12」のような)
# 「db」で始まり、2から4個の数字を使った番号で終わるデータベースへ接続することを許可。
#
# TYPE DATABASE USER ADDRESS METHOD
host "/^db\d{2,4}$" all localhost trust
<span class="original">
# Allow any user from any host with IP address 192.168.93.x to connect
# to database "postgres" as the same user name that ident reports for
# the connection (typically the operating system user name).
</span>
# IPアドレス192.168.93.xを持つ全てのホストの全てのユーザが、
# identがその接続について報告するのと同じユーザ名(典型的にはオペレーティングシステムのユーザ名)で
# データベース「postgres」へ接続することを許可。
#
# TYPE DATABASE USER ADDRESS METHOD
host postgres all 192.168.93.0/24 ident
<span class="original">
# Allow any user from host 192.168.12.10 to connect to database
# "postgres" if the user's password is correctly supplied.
</span>
# ユーザのパスワードが正しく入力された場合、
# ホスト192.168.12.10からのどのようなユーザでもデータベース「postgres」へ接続することを許可。
#
# TYPE DATABASE USER ADDRESS METHOD
host postgres all 192.168.12.10/32 scram-sha-256
<span class="original">
# Allow any user from hosts in the example.com domain to connect to
# any database if the user's password is correctly supplied.
</span>
# ユーザのパスワードが正しく指定された場合は、
# example.comドメイン内のホストからの、どのユーザからのデータベース接続も許可する。
#
# Require SCRAM authentication for most users, but make an exception
# for user 'mike', who uses an older client that doesn't support SCRAM
# authentication.
#
# TYPE DATABASE USER ADDRESS METHOD
host all mike .example.com md5
host all all .example.com scram-sha-256
<span class="original">
# In the absence of preceding "host" lines, these three lines will
# reject all connections from 192.168.54.1 (since that entry will be
# matched first), but allow GSSAPI-encrypted connections from anywhere else
# on the Internet. The zero mask causes no bits of the host IP address to
# be considered, so it matches any host. Unencrypted GSSAPI connections
# (which "fall through" to the third line since "hostgssenc" only matches
# encrypted GSSAPI connections) are allowed, but only from 192.168.12.10.
</span>
# 先行する「host」行がなければ、これら3行によって、
# 192.168.54.1からの接続の試みを全て拒否(この項目が最初に照合されるため)、
# ただし、インターネット上の他の全ての場所からのGSSAPI接続は許可。
# ゼロマスクは、ホストIPアドレスのビットが考慮されずに
# どのホストでも照合できることになる。
# 暗号化されていないGSSAPI接続(「hostgssenc」は暗号化されたGSSAPI接続
# にのみに一致するので、3行目までは「通過」)は許可されるが、192.168.12.10からのみ許可。
#
# TYPE DATABASE USER ADDRESS METHOD
host all all 192.168.54.1/32 reject
hostgssenc all all 0.0.0.0/0 gss
host all all 192.168.12.10/32 gss
<span class="original">
# Allow users from 192.168.x.x hosts to connect to any database, if
# they pass the ident check. If, for example, ident says the user is
# "bryanh" and he requests to connect as PostgreSQL user "guest1", the
# connection is allowed if there is an entry in pg_ident.conf for map
# "omicron" that says "bryanh" is allowed to connect as "guest1".
</span>
# 192.168.x.xホストからのユーザが、ident検査に通る場合、
# どのデータベースにでも接続を許可。もし、例えば、identが「bryanh」と認定し
# 「bryanh」がPostgreSQLのユーザ「guest1」として
# 接続要求を出す場合、「bryanh」は「guest1」として接続が許可されるという
# マップ「omicron」に対する記載事項がpg_ident.confにあれば接続を許可。
#
# TYPE DATABASE USER ADDRESS METHOD
host all all 192.168.0.0/16 ident map=omicron
<span class="original">
# If these are the only four lines for local connections, they will
# allow local users to connect only to their own databases (databases
# with the same name as their database user name) except for users whose
# name end with "helpdesk", administrators and members of role "support",
# who can connect to all databases. The file $PGDATA/admins contains a
# list of names of administrators. Passwords are required in all cases.
</span>
# ローカル接続に対して、以下のたった4行しか記載がない場合、ローカルユーザは
# 自分のデータベース(データベースユーザ名と同じ名前のデータベース)にのみ接続許可。
# ただし、名前が「helpdesk」で終わるユーザ、管理者、ロール「support」のメンバは
# 全てのデータベースに接続可能。$PGDATA/adminsファイルは管理者のリストを含む。
# 全ての場合にパスワードが必要。
#
# TYPE DATABASE USER ADDRESS METHOD
local sameuser all scram-sha-256
local all /^.*helpdesk$ scram-sha-256
local all @admins scram-sha-256
local all +support scram-sha-256
<span class="original">
# The last two lines above can be combined into a single line:
</span>
# 上記の最後の2行は1つの行にまとめることが可能。
local all @admins,+support scram-sha-256
<span class="original">
# The database column can also use lists and file names:
</span>
# データベースの列にはリストやファイル名も使用できる。
local db1,db2,@demodbs all scram-sha-256
</pre></div></div><br class="example-break" /></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="client-authentication.html" title="第20章 クライアント認証">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="client-authentication.html" title="第20章 クライアント認証">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="auth-username-maps.html" title="20.2. ユーザ名マップ">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">第20章 クライアント認証 </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> 20.2. ユーザ名マップ</td></tr></table></div></body></html>