1SECURITY LABEL(7) PostgreSQL 10.7 Documentation SECURITY LABEL(7)
2
3
4
6 SECURITY_LABEL - define or change a security label applied to an object
7
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 PUBLICATION object_name |
23 ROLE object_name |
24 SCHEMA object_name |
25 SEQUENCE object_name |
26 SUBSCRIPTION object_name |
27 TABLESPACE object_name |
28 TYPE object_name |
29 VIEW object_name
30 } IS 'label'
31
32 where aggregate_signature is:
33
34 * |
35 [ argmode ] [ argname ] argtype [ , ... ] |
36 [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]
37
39 SECURITY LABEL applies a security label to a database object. An
40 arbitrary number of security labels, one per label provider, can be
41 associated with a given database object. Label providers are loadable
42 modules which register themselves by using the function
43 register_label_provider.
44
45 Note
46 register_label_provider is not an SQL function; it can only be
47 called from C code loaded into the backend.
48
49 The label provider determines whether a given label is valid and
50 whether it is permissible to assign that label to a given object. The
51 meaning of a given label is likewise at the discretion of the label
52 provider. PostgreSQL places no restrictions on whether or how a label
53 provider must interpret security labels; it merely provides a mechanism
54 for storing them. In practice, this facility is intended to allow
55 integration with label-based mandatory access control (MAC) systems
56 such as SE-Linux. Such systems make all access control decisions based
57 on object labels, rather than traditional discretionary access control
58 (DAC) concepts such as users and groups.
59
61 object_name
62 table_name.column_name
63 aggregate_name
64 function_name
65 The name of the object to be labeled. Names of tables, aggregates,
66 domains, foreign tables, functions, sequences, types, and views can
67 be schema-qualified.
68
69 provider
70 The name of the provider with which this label is to be associated.
71 The named provider must be loaded and must consent to the proposed
72 labeling operation. If exactly one provider is loaded, the provider
73 name may be omitted for brevity.
74
75 argmode
76 The mode of a function or aggregate argument: IN, OUT, INOUT, or
77 VARIADIC. If omitted, the default is IN. Note that SECURITY LABEL
78 does not actually pay any attention to OUT arguments, since only
79 the input arguments are needed to determine the function's
80 identity. So it is sufficient to list the IN, INOUT, and VARIADIC
81 arguments.
82
83 argname
84 The name of a function or aggregate argument. Note that SECURITY
85 LABEL does not actually pay any attention to argument names, since
86 only the argument data types are needed to determine the function's
87 identity.
88
89 argtype
90 The data type of a function or aggregate argument.
91
92 large_object_oid
93 The OID of the large object.
94
95 PROCEDURAL
96 This is a noise word.
97
98 label
99 The new security label, written as a string literal; or NULL to
100 drop the security label.
101
103 The following example shows how the security label of a table might be
104 changed.
105
106 SECURITY LABEL FOR selinux ON TABLE mytable IS 'system_u:object_r:sepgsql_table_t:s0';
107
109 There is no SECURITY LABEL command in the SQL standard.
110
112 sepgsql, src/test/modules/dummy_seclabel
113
114
115
116PostgreSQL 10.7 2019 SECURITY LABEL(7)