1e41f4b71Sopenharmony_ci# Configuring an OpenHarmony SELinux Policy for a Parameter
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci## Scenario
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciTo implement access control for a system parameter, you can configure an SELinux label for the parameter. For details about the parameter definition, see [Parameter Management](subsys-boot-init-sysparam.md).
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci## Procedure
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciDefine the mappings between parameters and labels in the **parameter_contexts** file. If a parameter name ends with a dot (.), the parameter is a wildcard parameter. Otherwise, the parameter is a fixed parameter.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciThe following is an example of the mapping between a label and a wildcard parameter. The label for parameters starting with **init.svc.** is **u:object_r:init_svc_param:s0**.
12e41f4b71Sopenharmony_ci```text
13e41f4b71Sopenharmony_ciinit.svc. u:object_r:init_svc_param:s0
14e41f4b71Sopenharmony_ci```
15e41f4b71Sopenharmony_ciThe following is an example of the mapping between a label and a fixed parameter. The label for the parameter **const.secure** is **u:object_r:secure_param:s0**.
16e41f4b71Sopenharmony_ci```text
17e41f4b71Sopenharmony_ciconst.secure u:object_r:secure_param:s0
18e41f4b71Sopenharmony_ci```
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ciThe wildcard parameters are labelled by the best match prefix. For example, the **paramter_contexts** file contains the following mappings:
21e41f4b71Sopenharmony_ci```text
22e41f4b71Sopenharmony_ciinit. u:object_r:init_param:s0
23e41f4b71Sopenharmony_ciinit.svc. u:object_r:init_svc_param:s0
24e41f4b71Sopenharmony_ci```
25e41f4b71Sopenharmony_ciThen,
26e41f4b71Sopenharmony_ci- The label of the **init.a** parameter is **u:object_r:init_param:s0**.
27e41f4b71Sopenharmony_ci- The label of the **init.svc** parameter is **u:object_r:init_param:s0**.
28e41f4b71Sopenharmony_ci- The label of the **init.svc.a** parameter is **u:object_r:init_svc_param:s0**.
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ciFor example, to assign the label **init_svc_param** for parameters prefixed with **init.svc.**, do as follows:
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci1. Add the parameter-label mapping in the **parameter_contexts** file.
34e41f4b71Sopenharmony_ci    ```text
35e41f4b71Sopenharmony_ci    init.svc. u:object_r:init_svc_param:s0
36e41f4b71Sopenharmony_ci    ```
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci2. Add **init_svc_param** in **type.te** to make the label valid.
39e41f4b71Sopenharmony_ci    ```text
40e41f4b71Sopenharmony_ci    type init_svc_param, parameter_attr;
41e41f4b71Sopenharmony_ci    ```
42