1SECURITY LABEL(7)        PostgreSQL 12.2 Documentation       SECURITY LABEL(7)
2
3
4

NAME

6       SECURITY_LABEL - define or change a security label applied to an object
7

SYNOPSIS

9       SECURITY LABEL [ FOR provider ] ON
10       {
11         TABLE object_name |
12         COLUMN table_name.column_name |
13         AGGREGATE aggregate_name ( aggregate_signature ) |
14         DATABASE object_name |
15         DOMAIN object_name |
16         EVENT TRIGGER object_name |
17         FOREIGN TABLE object_name
18         FUNCTION function_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
19         LARGE OBJECT large_object_oid |
20         MATERIALIZED VIEW object_name |
21         [ PROCEDURAL ] LANGUAGE object_name |
22         PROCEDURE procedure_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
23         PUBLICATION object_name |
24         ROLE object_name |
25         ROUTINE routine_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
26         SCHEMA object_name |
27         SEQUENCE object_name |
28         SUBSCRIPTION object_name |
29         TABLESPACE object_name |
30         TYPE object_name |
31         VIEW object_name
32       } IS 'label'
33
34       where aggregate_signature is:
35
36       * |
37       [ argmode ] [ argname ] argtype [ , ... ] |
38       [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]
39

DESCRIPTION

41       SECURITY LABEL applies a security label to a database object. An
42       arbitrary number of security labels, one per label provider, can be
43       associated with a given database object. Label providers are loadable
44       modules which register themselves by using the function
45       register_label_provider.
46
47           Note
48           register_label_provider is not an SQL function; it can only be
49           called from C code loaded into the backend.
50
51       The label provider determines whether a given label is valid and
52       whether it is permissible to assign that label to a given object. The
53       meaning of a given label is likewise at the discretion of the label
54       provider.  PostgreSQL places no restrictions on whether or how a label
55       provider must interpret security labels; it merely provides a mechanism
56       for storing them. In practice, this facility is intended to allow
57       integration with label-based mandatory access control (MAC) systems
58       such as SELinux. Such systems make all access control decisions based
59       on object labels, rather than traditional discretionary access control
60       (DAC) concepts such as users and groups.
61

PARAMETERS

63       object_name
64       table_name.column_name
65       aggregate_name
66       function_name
67       procedure_name
68       routine_name
69           The name of the object to be labeled. Names of tables, aggregates,
70           domains, foreign tables, functions, procedures, routines,
71           sequences, types, and views can be schema-qualified.
72
73       provider
74           The name of the provider with which this label is to be associated.
75           The named provider must be loaded and must consent to the proposed
76           labeling operation. If exactly one provider is loaded, the provider
77           name may be omitted for brevity.
78
79       argmode
80           The mode of a function, procedure, or aggregate argument: IN, OUT,
81           INOUT, or VARIADIC. If omitted, the default is IN. Note that
82           SECURITY LABEL does not actually pay any attention to OUT
83           arguments, since only the input arguments are needed to determine
84           the function's identity. So it is sufficient to list the IN, INOUT,
85           and VARIADIC arguments.
86
87       argname
88           The name of a function, procedure, or aggregate argument. Note that
89           SECURITY LABEL does not actually pay any attention to argument
90           names, since only the argument data types are needed to determine
91           the function's identity.
92
93       argtype
94           The data type of a function, procedure, or aggregate argument.
95
96       large_object_oid
97           The OID of the large object.
98
99       PROCEDURAL
100           This is a noise word.
101
102       label
103           The new security label, written as a string literal; or NULL to
104           drop the security label.
105

EXAMPLES

107       The following example shows how the security label of a table might be
108       changed.
109
110           SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';
111

COMPATIBILITY

113       There is no SECURITY LABEL command in the SQL standard.
114

SEE ALSO

116       sepgsql, src/test/modules/dummy_seclabel
117
118
119
120PostgreSQL 12.2                      2020                    SECURITY LABEL(7)
Impressum