2 # PostgreSQL HOST-BASED ACCESS (HBA) CONTROL FILE
7 # o which hosts are allowed to connect
8 # o how users are authenticated on each host
9 # o databases accessible by each host
11 # It is read on postmaster startup and when the postmaster receives a SIGHUP.
12 # If you edit the file on a running system, you have to SIGHUP the postmaster
13 # for the changes to take effect.
15 # Each line is a new record. Records cannot be continued across multiple
16 # lines. Comments begin with # and continue to the end of the line.
17 # Blank lines are ignored. A record consists of tokens separated by
18 # multiple spaces or tabs.
20 # The first token of a record indicates its type. The remainder of the
21 # record is interpreted based on its type.
26 # There are three types of records:
35 # This record identifies the networked hosts that are permitted to connect
40 # host DBNAME IP_ADDRESS ADDRESS_MASK AUTH_TYPE [AUTH_ARGUMENT]
44 # o the name of a PostgreSQL database
45 # o "all" to indicate all databases
46 # o "sameuser" to allow access only to databases with the same
47 # name as the connecting user
49 # IP_ADDRESS and ADDRESS_MASK are standard dotted decimal IP address and
50 # mask values. IP addresses can only be specified numerically, not as
51 # domain or host names.
53 # AUTH_TYPE and AUTH_ARGUMENT are described below.
55 # There can be multiple "host" records, possibly with overlapping sets of
56 # host addresses. The postmaster finds the first entry that matches the
57 # connecting host IP address and the requested database name. If no entry
58 # matches the database/hostname combination, the connection is rejected.
64 # The format of this record is identical to "host".
66 # This record identifies a set of network hosts that are permitted to
67 # connect to databases over secure SSL IP connections. Note that a "host"
68 # record will also allow SSL connections. "hostssl" forces these
69 # hosts to use *only* SSL-secured connections.
71 # This keyword is only available if the server was compiled with SSL
78 # This record identifies the authentication to use when connecting to
79 # the server via a local UNIX domain socket. UNIX-socket connections are
80 # allowed only if this record type appears.
84 # local DBNAME AUTH_TYPE [AUTH_ARGUMENT]
86 # This format is identical to the "host" record type except the IP_ADDRESS
87 # and ADDRESS_MASK fields are omitted.
89 # As with "host" records, the first "local" record matching the requested
90 # database name is used.
94 # Authentication Types (AUTH_TYPE)
95 # ================================
97 # AUTH_TYPE indicates the method used to authenticate users. The username
98 # is specified in the connection request. A different AUTH_TYPE can be
99 # specified for each record in the file.
101 # trust: No authentication is done. Any valid username is accepted,
102 # including the PostgreSQL superuser. This option should
103 # be use only for machines where all users are truested.
105 # password: Authentication is done by matching a password supplied
106 # in clear by the host. If no AUTH_ARGUMENT is used, the
107 # password is compared with the user's entry in the
110 # If AUTH_ARGUMENT is specified, the username is looked up
111 # in that file in the $PGDATA directory. If the username
112 # exists but there is no password, the password is looked
113 # up in pg_shadow. If a password exists in the file, it is
114 # it used instead. These secondary files allow fine-grained
115 # control over who can access which databases and whether
116 # a non-default passwords are required. The same file can be
117 # used in multiple records for easier administration.
118 # Password files can be maintained with the pg_passwd(1)
119 # utility. Remember, these passwords override pg_shadow
122 # crypt: Same as "password", but authentication is done by
123 # encrypting the password sent over the network. This is
124 # always preferable to "password" except for old clients
125 # that don't support "crypt". Also, crypt can use
126 # usernames stored in secondary password files but not
127 # secondary passwords.
129 # ident: Authentication is done by the ident server on the local
130 # (127.0.0.1) or remote host. AUTH_ARGUMENT is required and
131 # maps names found in the $PGDATA/pg_ident.conf file. The
132 # connection is accepted if the file contains an entry for
133 # this map name with the ident-supplied username and the
134 # requested PostgreSQL username. The special map name
135 # "sameuser" indicates an implied map (not in pg_ident.conf)
136 # that maps each ident username to the identical PostgreSQL
139 # krb4: Kerberos V4 authentication is used.
141 # krb5: Kerberos V5 authentication is used.
143 # reject: Reject the connection. This is used to reject certain hosts
144 # that are part of a network specified later in the file.
145 # To be effective, "reject" must appear before the later
148 # Local UNIX-domain socket connections support only the AUTH_TYPEs of
149 # "trust", "password", "crypt", and "reject".
157 # Allow any user on the local system to connect to any database under any
158 # username using Unix-domain sockets (the default for local connections):
159 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
162 # The same using IP connections on the same machine:
163 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
164 # host all 127.0.0.1 255.255.255.255 trust
166 # Allow any user from any host with IP address 192.168.93.x to
167 # connect to database "template1" as the same username that ident reports
168 # for the connection (typically his Unix username):
170 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
171 # host template1 192.168.93.0 255.255.255.0 ident sameuser
173 # Allow a user from host 192.168.12.10 to connect to database "template1"
174 # if the user's password in pg_shadow is correctly supplied:
176 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
177 # host template1 192.168.12.10 255.255.255.255 crypt
179 # In the absence of preceding "host" lines, these two lines will reject
180 # all connection from 192.168.54.1 (since that entry will be matched
181 # first), but allow Kerberos V5-validated connections from anywhere else
182 # on the Internet. The zero mask means that no bits of the host IP address
183 # are considered, so it matches any host:
186 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
187 # host all 192.168.54.1 255.255.255.255 reject
188 # host all 0.0.0.0 0.0.0.0 krb5
190 # Allow users from 192.168.x.x hosts to connect to any database if they
191 # pass the ident check. For example, if ident says the user is "james" and
192 # he requests to connect as PostgreSQL user "guest", the connection is
193 # allowed if there is an entry in $PGDATA/pg_ident.conf with map name
194 # "phoenix" that says "james" is allowed to connect as "guest":
196 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
197 # host all 192.168.0.0 255.255.0.0 ident phoenix
199 # See $PGDATA/pg_ident.conf for more information on Ident maps.
201 # Put your actual configuration here
202 # ==================================
204 # This default configuration allows any local user to connect with any
205 # PostgreSQL username, over either UNIX domain sockets or IP:
207 # If you want to allow non-local connections, you will need to add more
208 # "host" records. Also, remember IP connections are only enabled if you
209 # start the postmaster with the -i option.
211 # CAUTION: if you are on a multiple-user machine, the default
212 # configuration is probably too liberal for you. Change it to use
213 # something other than "trust" authentication.
215 # TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE AUTH_ARGUMENT
218 host all 127.0.0.1 255.255.255.255 trust