1postgresql_selinux(8)      SELinux Policy postgresql     postgresql_selinux(8)
2
3
4

NAME

6       postgresql_selinux  - Security Enhanced Linux Policy for the postgresql
7       processes
8

DESCRIPTION

10       Security-Enhanced Linux secures the postgresql processes  via  flexible
11       mandatory access control.
12
13       The  postgresql  processes  execute with the postgresql_t SELinux type.
14       You can check if you have these processes running by executing  the  ps
15       command with the -Z qualifier.
16
17       For example:
18
19       ps -eZ | grep postgresql_t
20
21
22

ENTRYPOINTS

24       The  postgresql_t SELinux type can be entered via the postgresql_exec_t
25       file type.
26
27       The default entrypoint paths for the postgresql_t domain are  the  fol‐
28       lowing:
29
30       /usr/bin/(se)?postgres,    /usr/bin/initdb(.sepgsql)?,   /usr/lib/post‐
31       gresql/bin/.*,      /usr/bin/pg_ctl,       /usr/libexec/postgresql-ctl,
32       /usr/bin/postgresql-check-db-dir,
33       /usr/lib/pgsql/test/regress/pg_regress
34

PROCESS TYPES

36       SELinux defines process types (domains) for each process running on the
37       system
38
39       You can see the context of a process using the -Z option to ps
40
41       Policy  governs  the  access confined processes have to files.  SELinux
42       postgresql policy is very flexible allowing users to setup their  post‐
43       gresql processes in as secure a method as possible.
44
45       The following process types are defined for postgresql:
46
47       postgresql_t
48
49       Note:  semanage  permissive  -a  postgresql_t  can  be used to make the
50       process type postgresql_t permissive. SELinux does not deny  access  to
51       permissive  process  types,  but the AVC (SELinux denials) messages are
52       still generated.
53
54

BOOLEANS

56       SELinux policy is customizable based on least access  required.   post‐
57       gresql policy is extremely flexible and has several booleans that allow
58       you to manipulate the policy and run postgresql with the  tightest  ac‐
59       cess possible.
60
61
62
63       If  you want to allow postgresql to use ssh and rsync for point-in-time
64       recovery, you must turn on the postgresql_can_rsync  boolean.  Disabled
65       by default.
66
67       setsebool -P postgresql_can_rsync 1
68
69
70
71       If  you  want  to  allow transmit client label to foreign database, you
72       must turn on the postgresql_selinux_transmit_client_label boolean. Dis‐
73       abled by default.
74
75       setsebool -P postgresql_selinux_transmit_client_label 1
76
77
78
79       If you want to deny user domains applications to map a memory region as
80       both executable and writable, this  is  dangerous  and  the  executable
81       should be reported in bugzilla, you must turn on the deny_execmem bool‐
82       ean. Enabled by default.
83
84       setsebool -P deny_execmem 1
85
86
87
88       If you want to determine whether exim can  connect  to  databases,  you
89       must turn on the exim_can_connect_db boolean. Disabled by default.
90
91       setsebool -P exim_can_connect_db 1
92
93
94
95       If you want to allow all domains to execute in fips_mode, you must turn
96       on the fips_mode boolean. Enabled by default.
97
98       setsebool -P fips_mode 1
99
100
101
102       If you want to determine whether ftpd can connect to databases over the
103       TCP  network, you must turn on the ftpd_connect_db boolean. Disabled by
104       default.
105
106       setsebool -P ftpd_connect_db 1
107
108
109
110       If you want to allow HTTPD scripts and modules to connect to  databases
111       over  the  network,  you  must turn on the httpd_can_network_connect_db
112       boolean. Disabled by default.
113
114       setsebool -P httpd_can_network_connect_db 1
115
116
117
118       If you want to allow confined applications to run  with  kerberos,  you
119       must turn on the kerberos_enabled boolean. Enabled by default.
120
121       setsebool -P kerberos_enabled 1
122
123
124
125       If  you  want  to  allow  system  to run with NIS, you must turn on the
126       nis_enabled boolean. Disabled by default.
127
128       setsebool -P nis_enabled 1
129
130
131
132       If you want to allow PowerDNS to connect to databases over the network,
133       you  must  turn on the pdns_can_network_connect_db boolean. Disabled by
134       default.
135
136       setsebool -P pdns_can_network_connect_db 1
137
138
139

PORT TYPES

141       SELinux defines port types to represent TCP and UDP ports.
142
143       You can see the types associated with a port  by  using  the  following
144       command:
145
146       semanage port -l
147
148
149       Policy  governs  the  access  confined  processes  have to these ports.
150       SELinux postgresql policy is very  flexible  allowing  users  to  setup
151       their postgresql processes in as secure a method as possible.
152
153       The following port types are defined for postgresql:
154
155
156       postgresql_port_t
157
158
159
160       Default Defined Ports:
161                 tcp 5432,9898
162

MANAGED FILES

164       The SELinux process type postgresql_t can manage files labeled with the
165       following file types.  The paths listed are the default paths for these
166       file types.  Note the processes UID still need to have DAC permissions.
167
168       cluster_conf_t
169
170            /etc/cluster(/.*)?
171
172       cluster_var_lib_t
173
174            /var/lib/pcsd(/.*)?
175            /var/lib/cluster(/.*)?
176            /var/lib/openais(/.*)?
177            /var/lib/pengine(/.*)?
178            /var/lib/corosync(/.*)?
179            /usr/lib/heartbeat(/.*)?
180            /var/lib/heartbeat(/.*)?
181            /var/lib/pacemaker(/.*)?
182
183       cluster_var_run_t
184
185            /var/run/crm(/.*)?
186            /var/run/cman_.*
187            /var/run/rsctmp(/.*)?
188            /var/run/aisexec.*
189            /var/run/heartbeat(/.*)?
190            /var/run/pcsd-ruby.socket
191            /var/run/corosync-qnetd(/.*)?
192            /var/run/corosync-qdevice(/.*)?
193            /var/run/corosync.pid
194            /var/run/cpglockd.pid
195            /var/run/rgmanager.pid
196            /var/run/cluster/rgmanager.sk
197
198       faillog_t
199
200            /var/log/btmp.*
201            /var/log/faillog.*
202            /var/log/tallylog.*
203            /var/run/faillock(/.*)?
204
205       hugetlbfs_t
206
207            /dev/hugepages
208            /usr/lib/udev/devices/hugepages
209
210       krb5_host_rcache_t
211
212            /var/tmp/krb5_0.rcache2
213            /var/cache/krb5rcache(/.*)?
214            /var/tmp/nfs_0
215            /var/tmp/DNS_25
216            /var/tmp/host_0
217            /var/tmp/imap_0
218            /var/tmp/HTTP_23
219            /var/tmp/HTTP_48
220            /var/tmp/ldap_55
221            /var/tmp/ldap_487
222            /var/tmp/ldapmap1_0
223
224       lastlog_t
225
226            /var/log/lastlog.*
227
228       postgresql_db_t
229
230            /var/lib/pgsql(/.*)?
231            /var/lib/sepgsql(/.*)?
232            /var/lib/postgres(ql)?(/.*)?
233            /usr/share/jonas/pgsql(/.*)?
234            /usr/lib/pgsql/test/regress(/.*)?
235
236       postgresql_lock_t
237
238
239       postgresql_log_t
240
241            /var/lib/pgsql/.*.log
242            /var/log/rhdb/rhdb(/.*)?
243            /var/log/postgresql(/.*)?
244            /var/log/postgres.log.*
245            /var/lib/pgsql/logfile(/.*)?
246            /var/lib/pgsql/data/log(/.*)?
247            /var/log/sepostgresql.log.*
248            /var/lib/pgsql/data/pg_log(/.*)?
249            /var/lib/sepgsql/pgstartup.log
250
251       postgresql_tmp_t
252
253
254       postgresql_var_run_t
255
256            /var/run/postgresql(/.*)?
257
258       root_t
259
260            /sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
261            /
262            /initrd
263
264       security_t
265
266            /selinux
267
268

FILE CONTEXTS

270       SELinux requires files to have an extended attribute to define the file
271       type.
272
273       You can see the context of a file using the -Z option to ls
274
275       Policy governs the access  confined  processes  have  to  these  files.
276       SELinux  postgresql  policy  is  very  flexible allowing users to setup
277       their postgresql processes in as secure a method as possible.
278
279       EQUIVALENCE DIRECTORIES
280
281
282       postgresql policy stores data  with  multiple  different  file  context
283       types  under  the /var/lib/pgsql directory.  If you would like to store
284       the data in a different directory you can use the semanage  command  to
285       create  an equivalence mapping.  If you wanted to store this data under
286       the /srv directory you would execute the following command:
287
288       semanage fcontext -a -e /var/lib/pgsql /srv/pgsql
289       restorecon -R -v /srv/pgsql
290
291       postgresql policy stores data  with  multiple  different  file  context
292       types under the /var/lib/sepgsql directory.  If you would like to store
293       the data in a different directory you can use the semanage  command  to
294       create  an equivalence mapping.  If you wanted to store this data under
295       the /srv directory you would execute the following command:
296
297       semanage fcontext -a -e /var/lib/sepgsql /srv/sepgsql
298       restorecon -R -v /srv/sepgsql
299
300       STANDARD FILE CONTEXT
301
302       SELinux defines the file context  types  for  the  postgresql,  if  you
303       wanted  to store files with these types in a diffent paths, you need to
304       execute the semanage command to specify alternate labeling and then use
305       restorecon to put the labels on disk.
306
307       semanage  fcontext  -a  -t postgresql_var_run_t '/srv/mypostgresql_con‐
308       tent(/.*)?'
309       restorecon -R -v /srv/mypostgresql_content
310
311       Note: SELinux often uses regular expressions  to  specify  labels  that
312       match multiple files.
313
314       The following file types are defined for postgresql:
315
316
317
318       postgresql_db_t
319
320       -  Set  files  with  the postgresql_db_t type, if you want to treat the
321       files as postgresql database content.
322
323
324       Paths:
325            /var/lib/pgsql(/.*)?,    /var/lib/sepgsql(/.*)?,    /var/lib/post‐
326            gres(ql)?(/.*)?,                     /usr/share/jonas/pgsql(/.*)?,
327            /usr/lib/pgsql/test/regress(/.*)?
328
329
330       postgresql_etc_t
331
332       - Set files with the postgresql_etc_t type, if you want to store  post‐
333       gresql files in the /etc directories.
334
335
336       Paths:
337            /etc/postgresql(/.*)?, /etc/sysconfig/pgsql(/.*)?
338
339
340       postgresql_exec_t
341
342       -  Set files with the postgresql_exec_t type, if you want to transition
343       an executable to the postgresql_t domain.
344
345
346       Paths:
347            /usr/bin/(se)?postgres, /usr/bin/initdb(.sepgsql)?, /usr/lib/post‐
348            gresql/bin/.*,    /usr/bin/pg_ctl,    /usr/libexec/postgresql-ctl,
349            /usr/bin/postgresql-check-db-dir,
350            /usr/lib/pgsql/test/regress/pg_regress
351
352
353       postgresql_initrc_exec_t
354
355       -  Set  files  with  the  postgresql_initrc_exec_t type, if you want to
356       transition an executable to the postgresql_initrc_t domain.
357
358
359
360       postgresql_lock_t
361
362       - Set files with the postgresql_lock_t type, if you want to  treat  the
363       files as postgresql lock data, stored under the /var/lock directory
364
365
366
367       postgresql_log_t
368
369       -  Set  files  with the postgresql_log_t type, if you want to treat the
370       data as postgresql log data, usually stored under the  /var/log  direc‐
371       tory.
372
373
374       Paths:
375            /var/lib/pgsql/.*.log,   /var/log/rhdb/rhdb(/.*)?,  /var/log/post‐
376            gresql(/.*)?,     /var/log/postgres.log.*,     /var/lib/pgsql/log‐
377            file(/.*)?,     /var/lib/pgsql/data/log(/.*)?,    /var/log/sepost‐
378            gresql.log.*,                    /var/lib/pgsql/data/pg_log(/.*)?,
379            /var/lib/sepgsql/pgstartup.log
380
381
382       postgresql_tmp_t
383
384       -  Set files with the postgresql_tmp_t type, if you want to store post‐
385       gresql temporary files in the /tmp directories.
386
387
388
389       postgresql_unit_file_t
390
391       - Set files with the postgresql_unit_file_t type, if you want to  treat
392       the files as postgresql unit content.
393
394
395
396       postgresql_var_run_t
397
398       -  Set  files  with the postgresql_var_run_t type, if you want to store
399       the postgresql files under the /run or /var/run directory.
400
401
402
403       Note: File context can be temporarily modified with the chcon  command.
404       If  you want to permanently change the file context you need to use the
405       semanage fcontext command.  This will modify the SELinux labeling data‐
406       base.  You will need to use restorecon to apply the labels.
407
408

COMMANDS

410       semanage  fcontext  can also be used to manipulate default file context
411       mappings.
412
413       semanage permissive can also be used to manipulate  whether  or  not  a
414       process type is permissive.
415
416       semanage  module can also be used to enable/disable/install/remove pol‐
417       icy modules.
418
419       semanage port can also be used to manipulate the port definitions
420
421       semanage boolean can also be used to manipulate the booleans
422
423
424       system-config-selinux is a GUI tool available to customize SELinux pol‐
425       icy settings.
426
427

AUTHOR

429       This manual page was auto-generated using sepolicy manpage .
430
431

SEE ALSO

433       selinux(8), postgresql(8), semanage(8), restorecon(8), chcon(1), sepol‐
434       icy(8), setsebool(8)
435
436
437
438postgresql                         23-02-03              postgresql_selinux(8)
Impressum