]> begriffs open source - ai-pg/blob - full-docs/txt/sql-security-label.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-security-label.txt
1
2 SECURITY LABEL
3
4    SECURITY LABEL — define or change a security label applied to an object
5
6 Synopsis
7
8 SECURITY LABEL [ FOR provider ] ON
9 {
10   TABLE object_name |
11   COLUMN table_name.column_name |
12   AGGREGATE aggregate_name ( aggregate_signature ) |
13   DATABASE object_name |
14   DOMAIN object_name |
15   EVENT TRIGGER object_name |
16   FOREIGN TABLE object_name |
17   FUNCTION function_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
18   LARGE OBJECT large_object_oid |
19   MATERIALIZED VIEW object_name |
20   [ PROCEDURAL ] LANGUAGE object_name |
21   PROCEDURE procedure_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
22   PUBLICATION object_name |
23   ROLE object_name |
24   ROUTINE routine_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
25   SCHEMA object_name |
26   SEQUENCE object_name |
27   SUBSCRIPTION object_name |
28   TABLESPACE object_name |
29   TYPE object_name |
30   VIEW object_name
31 } IS { string_literal | NULL }
32
33 where aggregate_signature is:
34
35 * |
36 [ argmode ] [ argname ] argtype [ , ... ] |
37 [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] a
38 rgtype [ , ... ]
39
40 Description
41
42    SECURITY LABEL applies a security label to a database object. An
43    arbitrary number of security labels, one per label provider, can be
44    associated with a given database object. Label providers are loadable
45    modules which register themselves by using the function
46    register_label_provider.
47
48 Note
49
50    register_label_provider is not an SQL function; it can only be called
51    from C code loaded into the backend.
52
53    The label provider determines whether a given label is valid and
54    whether it is permissible to assign that label to a given object. The
55    meaning of a given label is likewise at the discretion of the label
56    provider. PostgreSQL places no restrictions on whether or how a label
57    provider must interpret security labels; it merely provides a mechanism
58    for storing them. In practice, this facility is intended to allow
59    integration with label-based mandatory access control (MAC) systems
60    such as SELinux. Such systems make all access control decisions based
61    on object labels, rather than traditional discretionary access control
62    (DAC) concepts such as users and groups.
63
64    You must own the database object to use SECURITY LABEL.
65
66 Parameters
67
68    object_name
69           table_name.column_name
70           aggregate_name
71           function_name
72           procedure_name
73           routine_name
74           The name of the object to be labeled. Names of objects that
75           reside in schemas (tables, functions, etc.) can be
76           schema-qualified.
77
78    provider
79           The name of the provider with which this label is to be
80           associated. The named provider must be loaded and must consent
81           to the proposed labeling operation. If exactly one provider is
82           loaded, the provider name may be omitted for brevity.
83
84    argmode
85           The mode of a function, procedure, or aggregate argument: IN,
86           OUT, INOUT, or VARIADIC. If omitted, the default is IN. Note
87           that SECURITY LABEL does not actually pay any attention to OUT
88           arguments, since only the input arguments are needed to
89           determine the function's identity. So it is sufficient to list
90           the IN, INOUT, and VARIADIC arguments.
91
92    argname
93           The name of a function, procedure, or aggregate argument. Note
94           that SECURITY LABEL does not actually pay any attention to
95           argument names, since only the argument data types are needed to
96           determine the function's identity.
97
98    argtype
99           The data type of a function, procedure, or aggregate argument.
100
101    large_object_oid
102           The OID of the large object.
103
104    PROCEDURAL
105           This is a noise word.
106
107    string_literal
108           The new setting of the security label, written as a string
109           literal.
110
111    NULL
112           Write NULL to drop the security label.
113
114 Examples
115
116    The following example shows how the security label of a table could be
117    set or changed:
118 SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_
119 t:s0';
120
121    To remove the label:
122 SECURITY LABEL FOR selinux ON TABLE mytable IS NULL;
123
124 Compatibility
125
126    There is no SECURITY LABEL command in the SQL standard.
127
128 See Also
129
130    sepgsql, src/test/modules/dummy_seclabel