add content

This commit is contained in:
2019-05-08 14:53:59 +03:00
parent fdb66ec988
commit 840f37da49
122 changed files with 5873 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
#
# /etc
#
/etc/wireguard(/.*)? gen_context(system_u:object_r:wireguard_etc_t,s0)
#
# /usr
#
/usr/bin/wg -- gen_context(system_u:object_r:wireguard_exec_t,s0)
/usr/bin/wg-quick -- gen_context(system_u:object_r:wireguard_script_exec_t,s0)

View File

@@ -0,0 +1,128 @@
## <summary>Policy for logical volume management programs.</summary>
########################################
## <summary>
## Execute wireguard programs in the wireguard domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`wireguard_domtrans',`
gen_require(`
type wireguard_t, wireguard_exec_t;
type wireguard_script_t, wireguard_script_exec_t;
')
corecmd_search_bin($1)
domtrans_pattern($1, wireguard_exec_t, wireguard_t)
domtrans_pattern($1, wireguard_script_exec_t, wireguard_script_t)
')
########################################
## <summary>
## Execute wireguard programs in the caller domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`wireguard_exec',`
gen_require(`
type wireguard_exec_t;
')
corecmd_search_bin($1)
can_exec($1, wireguard_exec_t)
')
########################################
## <summary>
## Execute wireguard programs in the wireguard domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to allow the Wireguard domain.
## </summary>
## </param>
## <rolecap/>
#
interface(`wireguard_run',`
gen_require(`
type wireguard_t, wireguard_script_t;
')
wireguard_domtrans($1)
role $2 types wireguard_t;
role $2 types wireguard_script_t;
')
########################################
## <summary>
## Send wireguard a null signal.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`wireguard_signull',`
gen_require(`
type wireguard_t;
')
allow $1 wireguard_t:process signull;
')
########################################
## <summary>
## Read Wireguard configuration files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`wireguard_read_config',`
gen_require(`
type wireguard_etc_t;
')
files_search_etc($1)
allow $1 wireguard_etc_t:dir list_dir_perms;
read_files_pattern($1, wireguard_etc_t, wireguard_etc_t)
')
########################################
## <summary>
## Manage Wireguard configuration files.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <rolecap/>
#
interface(`wireguard_manage_config',`
gen_require(`
type wireguard_etc_t;
')
files_search_etc($1)
manage_dirs_pattern($1, wireguard_etc_t, wireguard_etc_t)
manage_files_pattern($1, wireguard_etc_t, wireguard_etc_t)
')

View File

@@ -0,0 +1,84 @@
policy_module(wireguard, 1.0.0)
########################################
#
# Declarations
#
type wireguard_t;
type wireguard_exec_t;
init_system_domain(wireguard_t, wireguard_exec_t)
# needs privowner because it assigns the identity system_u to device nodes
# but runs as the identity of the sysadmin
domain_obj_id_change_exemption(wireguard_t)
role system_r types wireguard_t;
type wireguard_script_t;
type wireguard_script_exec_t;
init_system_domain(wireguard_script_t, wireguard_script_exec_t)
domtrans_pattern(wireguard_script_t, wireguard_exec_t, wireguard_t)
type wireguard_etc_t;
files_type(wireguard_etc_t)
########################################
#
# wireguard Local policy
#
kernel_request_load_module(wireguard_t)
allow wireguard_t self:capability net_admin;
allow wireguard_t self:netlink_generic_socket create_socket_perms;
allow wireguard_t self:netlink_route_socket r_netlink_socket_perms;
allow wireguard_t self:udp_socket create_socket_perms;
allow wireguard_t wireguard_script_t:fifo_file read_fifo_file_perms;
manage_dirs_pattern(wireguard_t, wireguard_etc_t, wireguard_etc_t)
manage_files_pattern(wireguard_t, wireguard_etc_t, wireguard_etc_t)
manage_lnk_files_pattern(wireguard_t, wireguard_etc_t, wireguard_etc_t)
files_etc_filetrans(wireguard_t, wireguard_etc_t, dir)
filetrans_pattern(wireguard_t, wireguard_etc_t, wireguard_etc_t, file)
userdom_use_user_ptys(wireguard_t)
domain_use_interactive_fds(wireguard_t)
########################################
#
# wireguard-quick Local policy
#
files_read_etc_files(wireguard_script_t)
corecmd_exec_bin(wireguard_script_t)
corecmd_exec_shell(wireguard_script_t)
sysnet_domtrans_ifconfig(wireguard_script_t)
manage_dirs_pattern(wireguard_script_t, wireguard_etc_t, wireguard_etc_t)
manage_files_pattern(wireguard_script_t, wireguard_etc_t, wireguard_etc_t)
manage_lnk_files_pattern(wireguard_script_t, wireguard_etc_t, wireguard_etc_t)
filetrans_pattern(wireguard_script_t, wireguard_etc_t, wireguard_etc_t, file)
allow wireguard_script_t self:fifo_file rw_fifo_file_perms;
kernel_read_network_state(wireguard_script_t)
miscfiles_read_localization(wireguard_script_t)
userdom_use_user_ptys(wireguard_script_t)
domain_use_interactive_fds(wireguard_script_t)
########################################
#
# optional policy
#
optional_policy(`
gen_require(`
type sysadm_t;
role sysadm_r;
')
wireguard_run(sysadm_t, sysadm_r)
')