Debian Codegraph @

doc/src/sgml/sepgsql.sgml

raw
1 <!-- doc/src/sgml/sepgsql.sgml -->
2
3 <sect1 id="sepgsql" xreflabel="sepgsql">
4 <title>sepgsql &mdash;
5 SELinux-, label-based mandatory access control (MAC) security module</title>
6
7 <indexterm zone="sepgsql">
8 <primary>sepgsql</primary>
9 </indexterm>
10
11 <para>
12 <filename>sepgsql</filename> is a loadable module that supports label-based
13 mandatory access control (MAC) based on <productname>SELinux</productname> security
14 policy.
15 </para>
16
17 <warning>
18 <para>
19 The current implementation has significant limitations, and does not
20 enforce mandatory access control for all actions. See
21 <xref linkend="sepgsql-limitations"/>.
22 </para>
23 </warning>
24
25 <sect2 id="sepgsql-overview">
26 <title>Overview</title>
27
28 <para>
29 This module integrates with <productname>SELinux</productname> to provide an
30 additional layer of security checking above and beyond what is normally
31 provided by <productname>PostgreSQL</productname>. From the perspective of
32 <productname>SELinux</productname>, this module allows
33 <productname>PostgreSQL</productname> to function as a user-space object
34 manager. Each table or function access initiated by a DML query will be
35 checked against the system security policy. This check is in addition to
36 the usual SQL permissions checking performed by
37 <productname>PostgreSQL</productname>.
38 </para>
39
40 <para>
41 <productname>SELinux</productname> access control decisions are made using
42 security labels, which are represented by strings such as
43 <literal>system_u:object_r:sepgsql_table_t:s0</literal>. Each access control
44 decision involves two labels: the label of the subject attempting to
45 perform the action, and the label of the object on which the operation is
46 to be performed. Since these labels can be applied to any sort of object,
47 access control decisions for objects stored within the database can be
48 (and, with this module, are) subjected to the same general criteria used
49 for objects of any other type, such as files. This design is intended to
50 allow a centralized security policy to protect information assets
51 independent of the particulars of how those assets are stored.
52 </para>
53
54 <para>
55 The <link linkend="sql-security-label"><command>SECURITY LABEL</command></link> statement allows assignment of
56 a security label to a database object.
57 </para>
58
59 </sect2>
60 <sect2 id="sepgsql-installation">
61 <title>Installation</title>
62
63 <para>
64 <filename>sepgsql</filename> can only be used on <productname>Linux</productname>
65 2.6.28 or higher with <productname>SELinux</productname> enabled.
66 It is not available on any other platform. You will also need
67 <productname>libselinux</productname> 2.1.10 or higher and
68 <productname>selinux-policy</productname> 3.9.13 or higher (although some
69 distributions may backport the necessary rules into older policy
70 versions).
71 </para>
72
73 <para>
74 The <command>sestatus</command> command allows you to check the status of
75 <productname>SELinux</productname>. A typical display is:
76 <screen>
77 $ sestatus
78 SELinux status: enabled
79 SELinuxfs mount: /selinux
80 Current mode: enforcing
81 Mode from config file: enforcing
82 Policy version: 24
83 Policy from config file: targeted
84 </screen>
85 If <productname>SELinux</productname> is disabled or not installed, you must set
86 that product up first before installing this module.
87 </para>
88
89 <para>
90 To build this module, specify <xref
91 linkend="configure-option-with-sepgsql"/> (when using <link
92 linkend="install-make">make and autoconf</link> ) or <xref
93 linkend="configure-with-sepgsql-meson"/> (when using <link
94 linkend="install-meson">meson</link>).
95
96 Be sure that the <filename>libselinux-devel</filename> RPM is installed at
97 build time.
98 </para>
99
100 <para>
101 To use this module, you must include <literal>sepgsql</literal>
102 in the <xref linkend="guc-shared-preload-libraries"/> parameter in
103 <filename>postgresql.conf</filename>. The module will not function correctly
104 if loaded in any other manner. Once the module is loaded, you
105 should execute <filename>sepgsql.sql</filename> in each database.
106 This will install functions needed for security label management, and
107 assign initial security labels.
108 </para>
109
110 <para>
111 Here is an example showing how to initialize a fresh database cluster
112 with <filename>sepgsql</filename> functions and security labels installed.
113 Adjust the paths shown as appropriate for your installation:
114 </para>
115
116 <screen>
117 $ export PGDATA=/path/to/data/directory
118 $ initdb
119 $ vi $PGDATA/postgresql.conf
120 change
121 #shared_preload_libraries = '' # (change requires restart)
122 to
123 shared_preload_libraries = 'sepgsql' # (change requires restart)
124 $ for DBNAME in template0 template1 postgres; do
125 postgres --single -F -c exit_on_error=true $DBNAME \
126 &lt;/usr/local/pgsql/share/contrib/sepgsql.sql &gt;/dev/null
127 done
128 </screen>
129
130 <para>
131 Please note that you may see some or all of the following notifications
132 depending on the particular versions you have of
133 <productname>libselinux</productname> and <productname>selinux-policy</productname>:
134 <screen>
135 /etc/selinux/targeted/contexts/sepgsql_contexts: line 33 has invalid object type db_blobs
136 /etc/selinux/targeted/contexts/sepgsql_contexts: line 36 has invalid object type db_language
137 /etc/selinux/targeted/contexts/sepgsql_contexts: line 37 has invalid object type db_language
138 /etc/selinux/targeted/contexts/sepgsql_contexts: line 38 has invalid object type db_language
139 /etc/selinux/targeted/contexts/sepgsql_contexts: line 39 has invalid object type db_language
140 /etc/selinux/targeted/contexts/sepgsql_contexts: line 40 has invalid object type db_language
141 </screen>
142 These messages are harmless and should be ignored.
143 </para>
144
145 <para>
146 If the installation process completes without error, you can now start the
147 server normally.
148 </para>
149 </sect2>
150
151 <sect2 id="sepgsql-regression">
152 <title>Regression Tests</title>
153
154 <para>
155 The <filename>sepgsql</filename> test suite is run if
156 <literal>PG_TEST_EXTRA</literal> contains <literal>sepgsql</literal> (see
157 <xref linkend="regress-additional"/>). This method is suitable during
158 development of <productname>PostgreSQL</productname>. Alternatively, there
159 is a way to run the tests to checks whether a database instance has been
160 set up properly for <literal>sepgsql</literal>.
161 </para>
162
163 <para>
164 Due to the nature of <productname>SELinux</productname>, running the
165 regression tests for <filename>sepgsql</filename> requires several extra
166 configuration steps, some of which must be done as root.
167 </para>
168
169 <para>
170 The manual tests must be run in the <filename>contrib/sepgsql</filename> directory
171 of a configured PostgreSQL build tree. Although they require a build tree,
172 the tests are designed to be executed against an installed server,
173 that is they are comparable to <literal>make installcheck</literal> not
174 <literal>make check</literal>.
175 </para>
176
177 <para>
178 First, set up <filename>sepgsql</filename> in a working database
179 according to the instructions in <xref linkend="sepgsql-installation"/>.
180 Note that the current operating system user must be able to connect to the
181 database as superuser without password authentication.
182 </para>
183
184 <para>
185 Second, build and install the policy package for the regression test.
186 The <filename>sepgsql-regtest</filename> policy is a special purpose policy package
187 which provides a set of rules to be allowed during the regression tests.
188 It should be built from the policy source file
189 <filename>sepgsql-regtest.te</filename>, which is done using
190 <command>make</command> with a Makefile supplied by SELinux.
191 You will need to locate the appropriate
192 Makefile on your system; the path shown below is only an example.
193 (This Makefile is usually supplied by the
194 <filename>selinux-policy-devel</filename> or
195 <filename>selinux-policy</filename> RPM.)
196 Once built, install this policy package using the
197 <command>semodule</command> command, which loads supplied policy packages
198 into the kernel. If the package is correctly installed,
199 <literal><command>semodule</command> -l</literal> should list <literal>sepgsql-regtest</literal> as an
200 available policy package:
201 </para>
202
203 <screen>
204 $ cd .../contrib/sepgsql
205 $ make -f /usr/share/selinux/devel/Makefile
206 $ sudo semodule -u sepgsql-regtest.pp
207 $ sudo semodule -l | grep sepgsql
208 sepgsql-regtest 1.07
209 </screen>
210
211 <para>
212 Third, turn on <literal>sepgsql_regression_test_mode</literal>.
213 For security reasons, the rules in <filename>sepgsql-regtest</filename>
214 are not enabled by default;
215 the <literal>sepgsql_regression_test_mode</literal> parameter enables
216 the rules needed to launch the regression tests.
217 It can be turned on using the <command>setsebool</command> command:
218 </para>
219
220 <screen>
221 $ sudo setsebool sepgsql_regression_test_mode on
222 $ getsebool sepgsql_regression_test_mode
223 sepgsql_regression_test_mode --> on
224 </screen>
225
226 <para>
227 Fourth, verify your shell is operating in the <literal>unconfined_t</literal>
228 domain:
229 </para>
230 <screen>
231 $ id -Z
232 unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
233 </screen>
234
235 <para>
236 See <xref linkend="sepgsql-resources"/> for details on adjusting your
237 working domain, if necessary.
238 </para>
239
240 <para>
241 Finally, run the regression test script:
242 </para>
243 <screen>
244 $ ./test_sepgsql
245 </screen>
246
247 <para>
248 This script will attempt to verify that you have done all the configuration
249 steps correctly, and then it will run the regression tests for the
250 <filename>sepgsql</filename> module.
251 </para>
252
253 <para>
254 After completing the tests, it's recommended you disable
255 the <literal>sepgsql_regression_test_mode</literal> parameter:
256 </para>
257
258 <screen>
259 $ sudo setsebool sepgsql_regression_test_mode off
260 </screen>
261
262 <para>
263 You might prefer to remove the <filename>sepgsql-regtest</filename> policy
264 entirely:
265 </para>
266
267 <screen>
268 $ sudo semodule -r sepgsql-regtest
269 </screen>
270 </sect2>
271
272 <sect2 id="sepgsql-parameters">
273 <title>GUC Parameters</title>
274
275 <variablelist>
276 <varlistentry id="guc-sepgsql-permissive" xreflabel="sepgsql.permissive">
277 <term>
278 <varname>sepgsql.permissive</varname> (<type>boolean</type>)
279 <indexterm>
280 <primary><varname>sepgsql.permissive</varname> configuration parameter</primary>
281 </indexterm>
282 </term>
283 <listitem>
284 <para>
285 This parameter enables <filename>sepgsql</filename> to function
286 in permissive mode, regardless of the system setting.
287 The default is off.
288 This parameter can only be set in the <filename>postgresql.conf</filename>
289 file or on the server command line.
290 </para>
291
292 <para>
293 When this parameter is on, <filename>sepgsql</filename> functions
294 in permissive mode, even if SELinux in general is working in enforcing
295 mode. This parameter is primarily useful for testing purposes.
296 </para>
297 </listitem>
298
299 </varlistentry>
300 <varlistentry id="guc-sepgsql-debug-audit" xreflabel="sepgsql.debug_audit">
301 <term>
302 <varname>sepgsql.debug_audit</varname> (<type>boolean</type>)
303 <indexterm>
304 <primary><varname>sepgsql.debug_audit</varname> configuration parameter</primary>
305 </indexterm>
306 </term>
307 <listitem>
308 <para>
309 This parameter enables the printing of audit messages regardless of
310 the system policy settings.
311 The default is off, which means that messages will be printed according
312 to the system settings.
313 </para>
314
315 <para>
316 The security policy of <productname>SELinux</productname> also has rules to
317 control whether or not particular accesses are logged.
318 By default, access violations are logged, but allowed
319 accesses are not.
320 </para>
321
322 <para>
323 This parameter forces all possible logging to be turned on, regardless
324 of the system policy.
325 </para>
326 </listitem>
327 </varlistentry>
328 </variablelist>
329 </sect2>
330
331 <sect2 id="sepgsql-features">
332 <title>Features</title>
333 <sect3 id="sepgsql-features-controlled-obj-classes">
334 <title>Controlled Object Classes</title>
335 <para>
336 The security model of <productname>SELinux</productname> describes all the access
337 control rules as relationships between a subject entity (typically,
338 a client of the database) and an object entity (such as a database
339 object), each of which is
340 identified by a security label. If access to an unlabeled object is
341 attempted, the object is treated as if it were assigned the label
342 <literal>unlabeled_t</literal>.
343 </para>
344
345 <para>
346 Currently, <filename>sepgsql</filename> allows security labels to be
347 assigned to schemas, tables, columns, sequences, views, and functions.
348 When <filename>sepgsql</filename> is in use, security labels are
349 automatically assigned to supported database objects at creation time.
350 This label is called a default security label, and is decided according
351 to the system security policy, which takes as input the creator's label,
352 the label assigned to the new object's parent object and optionally name
353 of the constructed object.
354 </para>
355
356 <para>
357 A new database object basically inherits the security label of the parent
358 object, except when the security policy has special rules known as
359 type-transition rules, in which case a different label may be applied.
360 For schemas, the parent object is the current database; for tables,
361 sequences, views, and functions, it is the containing schema; for columns,
362 it is the containing table.
363 </para>
364 </sect3>
365
366 <sect3 id="sepgsql-features-dml-permissions">
367 <title>DML Permissions</title>
368
369 <para>
370 For tables, <literal>db_table:select</literal>, <literal>db_table:insert</literal>,
371 <literal>db_table:update</literal> or <literal>db_table:delete</literal> are
372 checked for all the referenced target tables depending on the kind of
373 statement; in addition, <literal>db_table:select</literal> is also checked for
374 all the tables that contain columns referenced in the
375 <literal>WHERE</literal> or <literal>RETURNING</literal> clause, as a data source
376 for <literal>UPDATE</literal>, and so on.
377 </para>
378
379 <para>
380 Column-level permissions will also be checked for each referenced column.
381 <literal>db_column:select</literal> is checked on not only the columns being
382 read using <literal>SELECT</literal>, but those being referenced in other DML
383 statements; <literal>db_column:update</literal> or <literal>db_column:insert</literal>
384 will also be checked for columns being modified by <literal>UPDATE</literal> or
385 <literal>INSERT</literal>.
386 </para>
387
388 <para>
389 For example, consider:
390 <synopsis>
391 UPDATE t1 SET x = 2, y = func1(y) WHERE z = 100;
392 </synopsis>
393
394 Here, <literal>db_column:update</literal> will be checked for
395 <literal>t1.x</literal>, since it is being updated,
396 <literal>db_column:{select update}</literal> will be checked for
397 <literal>t1.y</literal>, since it is both updated and referenced, and
398 <literal>db_column:select</literal> will be checked for <literal>t1.z</literal>, since
399 it is only referenced.
400 <literal>db_table:{select update}</literal> will also be checked
401 at the table level.
402 </para>
403
404 <para>
405 For sequences, <literal>db_sequence:get_value</literal> is checked when we
406 reference a sequence object using <literal>SELECT</literal>; however, note that we
407 do not currently check permissions on execution of corresponding functions
408 such as <literal>lastval()</literal>.
409 </para>
410
411 <para>
412 For views, <literal>db_view:expand</literal> will be checked, then any other
413 required permissions will be checked on the objects being
414 expanded from the view, individually.
415 </para>
416
417 <para>
418 For functions, <literal>db_procedure:{execute}</literal> will be checked when
419 user tries to execute a function as a part of query, or using fast-path
420 invocation. If this function is a trusted procedure, it also checks
421 <literal>db_procedure:{entrypoint}</literal> permission to check whether it
422 can perform as entry point of trusted procedure.
423 </para>
424
425 <para>
426 In order to access any schema object, <literal>db_schema:search</literal>
427 permission is required on the containing schema. When an object is
428 referenced without schema qualification, schemas on which this
429 permission is not present will not be searched (just as if the user did
430 not have <literal>USAGE</literal> privilege on the schema). If an explicit schema
431 qualification is present, an error will occur if the user does not have
432 the requisite permission on the named schema.
433 </para>
434
435 <para>
436 The client must be allowed to access all referenced tables and
437 columns, even if they originated from views which were then expanded,
438 so that we apply consistent access control rules independent of the manner
439 in which the table contents are referenced.
440 </para>
441
442 <para>
443 The default database privilege system allows database superusers to
444 modify system catalogs using DML commands, and reference or modify
445 toast tables. These operations are prohibited when
446 <filename>sepgsql</filename> is enabled.
447 </para>
448 </sect3>
449
450 <sect3 id="sepgsql-features-ddl-permissions">
451 <title>DDL Permissions</title>
452 <para>
453 <productname>SELinux</productname> defines several permissions to control common
454 operations for each object type; such as creation, alter, drop and
455 relabel of security label. In addition, several object types have
456 special permissions to control their characteristic operations; such as
457 addition or deletion of name entries within a particular schema.
458 </para>
459 <para>
460 Creating a new database object requires <literal>create</literal> permission.
461 <productname>SELinux</productname> will grant or deny this permission based on the
462 client's security label and the proposed security label for the new
463 object. In some cases, additional privileges are required:
464 </para>
465
466 <itemizedlist>
467 <listitem>
468 <para>
469 <link linkend="sql-createdatabase"><command>CREATE DATABASE</command></link> additionally requires
470 <literal>getattr</literal> permission for the source or template database.
471 </para>
472 </listitem>
473 <listitem>
474 <para>
475 Creating a schema object additionally requires <literal>add_name</literal>
476 permission on the parent schema.
477 </para>
478 </listitem>
479 <listitem>
480 <para>
481 Creating a table additionally requires permission to create each
482 individual table column, just as if each table column were a
483 separate top-level object.
484 </para>
485 </listitem>
486 <listitem>
487 <para>
488 Creating a function marked as <literal>LEAKPROOF</literal> additionally
489 requires <literal>install</literal> permission. (This permission is also
490 checked when <literal>LEAKPROOF</literal> is set for an existing function.)
491 </para>
492 </listitem>
493 </itemizedlist>
494
495 <para>
496 When <literal>DROP</literal> command is executed, <literal>drop</literal> will be
497 checked on the object being removed. Permissions will be also checked for
498 objects dropped indirectly via <literal>CASCADE</literal>. Deletion of objects
499 contained within a particular schema (tables, views, sequences and
500 procedures) additionally requires <literal>remove_name</literal> on the schema.
501 </para>
502
503 <para>
504 When <literal>ALTER</literal> command is executed, <literal>setattr</literal> will be
505 checked on the object being modified for each object types, except for
506 subsidiary objects such as the indexes or triggers of a table, where
507 permissions are instead checked on the parent object. In some cases,
508 additional permissions are required:
509 </para>
510
511 <itemizedlist>
512 <listitem>
513 <para>
514 Moving an object to a new schema additionally requires
515 <literal>remove_name</literal> permission on the old schema and
516 <literal>add_name</literal> permission on the new one.
517 </para>
518 </listitem>
519 <listitem>
520 <para>
521 Setting the <literal>LEAKPROOF</literal> attribute on a function requires
522 <literal>install</literal> permission.
523 </para>
524 </listitem>
525 <listitem>
526 <para>
527 Using <link linkend="sql-security-label"><command>SECURITY LABEL</command></link> on an object additionally
528 requires <literal>relabelfrom</literal> permission for the object in
529 conjunction with its old security label and <literal>relabelto</literal>
530 permission for the object in conjunction with its new security label.
531 (In cases where multiple label providers are installed and the user
532 tries to set a security label, but it is not managed by
533 <productname>SELinux</productname>, only <literal>setattr</literal> should be checked here.
534 This is currently not done due to implementation restrictions.)
535 </para>
536 </listitem>
537 </itemizedlist>
538
539 </sect3>
540
541 <sect3 id="sepgsql-features-trusted-procedures">
542 <title>Trusted Procedures</title>
543 <para>
544 Trusted procedures are similar to security definer functions or setuid
545 commands. <productname>SELinux</productname> provides a feature to allow trusted
546 code to run using a security label different from that of the client,
547 generally for the purpose of providing highly controlled access to
548 sensitive data (e.g., rows might be omitted, or the precision of stored
549 values might be reduced). Whether or not a function acts as a trusted
550 procedure is controlled by its security label and the operating system
551 security policy. For example:
552 </para>
553
554 <screen>
555 postgres=# CREATE TABLE customer (
556 cid int primary key,
557 cname text,
558 credit text
559 );
560 CREATE TABLE
561 postgres=# SECURITY LABEL ON COLUMN customer.credit
562 IS 'system_u:object_r:sepgsql_secret_table_t:s0';
563 SECURITY LABEL
564 postgres=# CREATE FUNCTION show_credit(int) RETURNS text
565 AS 'SELECT regexp_replace(credit, ''-[0-9]+$'', ''-xxxx'', ''g'')
566 FROM customer WHERE cid = $1'
567 LANGUAGE sql;
568 CREATE FUNCTION
569 postgres=# SECURITY LABEL ON FUNCTION show_credit(int)
570 IS 'system_u:object_r:sepgsql_trusted_proc_exec_t:s0';
571 SECURITY LABEL
572 </screen>
573
574 <para>
575 The above operations should be performed by an administrative user.
576 </para>
577
578 <screen>
579 postgres=# SELECT * FROM customer;
580 ERROR: SELinux: security policy violation
581 postgres=# SELECT cid, cname, show_credit(cid) FROM customer;
582 cid | cname | show_credit
583 -----+--------+---------------------
584 1 | taro | 1111-2222-3333-xxxx
585 2 | hanako | 5555-6666-7777-xxxx
586 (2 rows)
587 </screen>
588
589 <para>
590 In this case, a regular user cannot reference <literal>customer.credit</literal>
591 directly, but a trusted procedure <literal>show_credit</literal> allows the user
592 to print the credit card numbers of customers with some of the digits
593 masked out.
594 </para>
595 </sect3>
596
597 <sect3 id="sepgsql-features-dynamic-domain-transitions">
598 <title>Dynamic Domain Transitions</title>
599 <para>
600 It is possible to use SELinux's dynamic domain transition feature
601 to switch the security label of the client process, the client domain,
602 to a new context, if that is allowed by the security policy.
603 The client domain needs the <literal>setcurrent</literal> permission and also
604 <literal>dyntransition</literal> from the old to the new domain.
605 </para>
606 <para>
607 Dynamic domain transitions should be considered carefully, because they
608 allow users to switch their label, and therefore their privileges,
609 at their option, rather than (as in the case of a trusted procedure)
610 as mandated by the system.
611 Thus, the <literal>dyntransition</literal> permission is only considered
612 safe when used to switch to a domain with a smaller set of privileges than
613 the original one. For example:
614 </para>
615 <screen>
616 regression=# select sepgsql_getcon();
617 sepgsql_getcon
618 -------------------------------------------------------
619 unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
620 (1 row)
621
622 regression=# SELECT sepgsql_setcon('unconfined_u:unconfined_r:unconfined_t:s0-s0:c1.c4');
623 sepgsql_setcon
624 ----------------
625 t
626 (1 row)
627
628 regression=# SELECT sepgsql_setcon('unconfined_u:unconfined_r:unconfined_t:s0-s0:c1.c1023');
629 ERROR: SELinux: security policy violation
630 </screen>
631 <para>
632 In this example above we were allowed to switch from the larger MCS
633 range <literal>c1.c1023</literal> to the smaller range <literal>c1.c4</literal>, but
634 switching back was denied.
635 </para>
636 <para>
637 A combination of dynamic domain transition and trusted procedure
638 enables an interesting use case that fits the typical process life-cycle
639 of connection pooling software.
640 Even if your connection pooling software is not allowed to run most
641 of SQL commands, you can allow it to switch the security label
642 of the client using the <literal>sepgsql_setcon()</literal> function
643 from within a trusted procedure; that should take some
644 credential to authorize the request to switch the client label.
645 After that, this session will have the privileges of the target user,
646 rather than the connection pooler.
647 The connection pooler can later revert the security label change by
648 again using <literal>sepgsql_setcon()</literal> with
649 <literal>NULL</literal> argument, again invoked from within a trusted
650 procedure with appropriate permissions checks.
651 The point here is that only the trusted procedure actually has permission
652 to change the effective security label, and only does so when given proper
653 credentials. Of course, for secure operation, the credential store
654 (table, procedure definition, or whatever) must be protected from
655 unauthorized access.
656 </para>
657 </sect3>
658
659 <sect3 id="sepgsql-features-misc">
660 <title>Miscellaneous</title>
661 <para>
662 We reject the <link linkend="sql-load"><command>LOAD</command></link> command across the board, because
663 any module loaded could easily circumvent security policy enforcement.
664 </para>
665
666 </sect3>
667 </sect2>
668
669 <sect2 id="sepgsql-functions">
670 <title>Sepgsql Functions</title>
671 <para>
672 <xref linkend="sepgsql-functions-table"/> shows the available functions.
673 </para>
674
675 <table id="sepgsql-functions-table">
676 <title>Sepgsql Functions</title>
677 <tgroup cols="1">
678 <thead>
679 <row>
680 <entry role="func_table_entry"><para role="func_signature">
681 Function
682 </para>
683 <para>
684 Description
685 </para></entry>
686 </row>
687 </thead>
688
689 <tbody>
690 <row>
691 <entry role="func_table_entry"><para role="func_signature">
692 <function>sepgsql_getcon</function> ()
693 <returnvalue>text</returnvalue>
694 </para>
695 <para>
696 Returns the client domain, the current security label of the client.
697 </para></entry>
698 </row>
699
700 <row>
701 <entry role="func_table_entry"><para role="func_signature">
702 <function>sepgsql_setcon</function> ( <type>text</type> )
703 <returnvalue>boolean</returnvalue>
704 </para>
705 <para>
706 Switches the client domain of the current session to the new domain,
707 if allowed by the security policy.
708 It also accepts <literal>NULL</literal> input as a request to transition
709 to the client's original domain.
710 </para></entry>
711 </row>
712
713 <row>
714 <entry role="func_table_entry"><para role="func_signature">
715 <function>sepgsql_mcstrans_in</function> ( <type>text</type> )
716 <returnvalue>text</returnvalue>
717 </para>
718 <para>
719 Translates the given qualified MLS/MCS range into raw format if
720 the mcstrans daemon is running.
721 </para></entry>
722 </row>
723
724 <row>
725 <entry role="func_table_entry"><para role="func_signature">
726 <function>sepgsql_mcstrans_out</function> ( <type>text</type> )
727 <returnvalue>text</returnvalue>
728 </para>
729 <para>
730 Translates the given raw MLS/MCS range into qualified format if
731 the mcstrans daemon is running.
732 </para></entry>
733 </row>
734
735 <row>
736 <entry role="func_table_entry"><para role="func_signature">
737 <function>sepgsql_restorecon</function> ( <type>text</type> )
738 <returnvalue>boolean</returnvalue>
739 </para>
740 <para>
741 Sets up initial security labels for all objects within the
742 current database. The argument may be <literal>NULL</literal>, or the
743 name of a specfile to be used as alternative of the system default.
744 </para></entry>
745 </row>
746 </tbody>
747 </tgroup>
748 </table>
749 </sect2>
750
751 <sect2 id="sepgsql-limitations">
752 <title>Limitations</title>
753
754 <variablelist>
755 <varlistentry>
756 <term>Data Definition Language (DDL) Permissions</term>
757 <listitem>
758 <para>
759 Due to implementation restrictions, some DDL operations do not
760 check permissions.
761 </para>
762 </listitem>
763 </varlistentry>
764
765 <varlistentry>
766 <term>Data Control Language (DCL) Permissions</term>
767 <listitem>
768 <para>
769 Due to implementation restrictions, DCL operations do not check
770 permissions.
771 </para>
772 </listitem>
773 </varlistentry>
774
775 <varlistentry>
776 <term>Row-level access control</term>
777 <listitem>
778 <para>
779 <productname>PostgreSQL</productname> supports row-level access, but
780 <filename>sepgsql</filename> does not.
781 </para>
782 </listitem>
783 </varlistentry>
784
785 <varlistentry>
786 <term>Covert channels</term>
787 <listitem>
788 <para>
789 <filename>sepgsql</filename> does not try to hide the existence of
790 a certain object, even if the user is not allowed to reference it.
791 For example, we can infer the existence of an invisible object as
792 a result of primary key conflicts, foreign key violations, and so on,
793 even if we cannot obtain the contents of the object. The existence
794 of a top secret table cannot be hidden; we only hope to conceal its
795 contents.
796 </para>
797 </listitem>
798 </varlistentry>
799 </variablelist>
800 </sect2>
801
802 <sect2 id="sepgsql-resources">
803 <title>External Resources</title>
804 <variablelist>
805 <varlistentry>
806 <term><ulink url="https://wiki.postgresql.org/wiki/SEPostgreSQL_Introduction">SE-PostgreSQL Introduction</ulink></term>
807 <listitem>
808 <para>
809 This wiki page provides a brief overview, security design, architecture,
810 administration and upcoming features.
811 </para>
812 </listitem>
813 </varlistentry>
814 <varlistentry>
815 <term><ulink url="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/selinux_users_and_administrators_guide/index">SELinux User's and Administrator's Guide</ulink></term>
816 <listitem>
817 <para>
818 This document provides a wide spectrum of knowledge to administer
819 <productname>SELinux</productname> on your systems.
820 It focuses primarily on Red Hat operating systems, but is not limited to them.
821 </para>
822 </listitem>
823 </varlistentry>
824 <varlistentry>
825 <term><ulink url="https://fedoraproject.org/wiki/SELinux_FAQ">Fedora SELinux FAQ</ulink></term>
826 <listitem>
827 <para>
828 This document answers frequently asked questions about
829 <productname>SELinux</productname>.
830 It focuses primarily on Fedora, but is not limited to Fedora.
831 </para>
832 </listitem>
833 </varlistentry>
834 </variablelist>
835 </sect2>
836
837 <sect2 id="sepgsql-author">
838 <title>Author</title>
839 <para>
840 KaiGai Kohei <email>[email protected]</email>
841 </para>
842 </sect2>
843 </sect1>