Skip to content

Commit

Permalink
sepolicy: Add support for dnscrypt-proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
syphyr committed Jun 21, 2020
1 parent 089232a commit 580f2ab
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
37 changes: 37 additions & 0 deletions dnscrypt_proxy.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##
## SEPolicy to execute dnscrypt_proxy (transition from init)
##
type dnscrypt_proxy, domain;
type dnscrypt_proxy_exec, exec_type, file_type;

typeattribute dnscrypt_proxy domain;
init_daemon_domain(dnscrypt_proxy)

allow dnscrypt_proxy system_file:dir r_dir_perms;
allow dnscrypt_proxy system_file:file { lock execute_no_trans };
allow dnscrypt_proxy node:tcp_socket { node_bind };
allow dnscrypt_proxy node:udp_socket { node_bind };
allow dnscrypt_proxy port:tcp_socket { name_bind name_connect };
allow dnscrypt_proxy port:udp_socket { name_bind };
allow dnscrypt_proxy proc_net:file r_file_perms;
allow dnscrypt_proxy proc_stat:file r_file_perms;
allow dnscrypt_proxy properties_device:dir r_dir_perms;
allow dnscrypt_proxy devpts:chr_file { open read write };
allow dnscrypt_proxy shell_exec:file rx_file_perms;
allow dnscrypt_proxy shell_data_file:dir create_dir_perms;
allow dnscrypt_proxy shell_data_file:file create_file_perms;
allow dnscrypt_proxy toolbox_exec:file rx_file_perms;
allow dnscrypt_proxy property_socket:sock_file write;
allow dnscrypt_proxy self:capability { net_admin net_raw sys_ptrace dac_override };
allow dnscrypt_proxy self:capability2 block_suspend;
allow dnscrypt_proxy self:rawip_socket create_socket_perms;
allow dnscrypt_proxy self:tcp_socket { create_socket_perms listen accept };
allow dnscrypt_proxy self:udp_socket create_socket_perms;
allow dnscrypt_proxy init:file r_file_perms;
allow dnscrypt_proxy init:dir r_dir_perms;
allow dnscrypt_proxy dnscrypt_proxy_exec:file execute_no_trans;
allow dnscrypt_proxy kernel:file read;
allow dnscrypt_proxy rootfs:dir { read open };
allow dnscrypt_proxy dnsproxyd_socket:sock_file write;
allow dnscrypt_proxy init:unix_stream_socket connectto;
set_prop(dnscrypt_proxy, system_prop)
4 changes: 4 additions & 0 deletions domain.te
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ neverallow {
-vold
-dumpstate
-system_server
-dnscrypt_proxy
userdebug_or_eng(`-perfprofd')
} self:capability sys_ptrace;

Expand Down Expand Up @@ -543,6 +544,7 @@ neverallow {
-init
-shell
-vold
-dnscrypt_proxy
} shell_data_file:dir no_w_dir_perms;

neverallow {
Expand All @@ -553,6 +555,7 @@ neverallow {
-init
-installd
-system_server # why?
-dnscrypt_proxy
userdebug_or_eng(`-uncrypt')
} shell_data_file:dir { open search };

Expand All @@ -564,6 +567,7 @@ neverallow {
-appdomain
-dumpstate
-installd
-dnscrypt_proxy
userdebug_or_eng(`-uncrypt')
} shell_data_file:file open;

Expand Down
5 changes: 5 additions & 0 deletions file_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,8 @@
/mnt/user(/.*)? u:object_r:mnt_user_file:s0
/mnt/runtime(/.*)? u:object_r:storage_file:s0
/storage(/.*)? u:object_r:storage_file:s0

# dnscrypt-proxy
/system/bin/dnscrypt u:object_r:dnscrypt_proxy_exec:s0
/system/bin/dnscrypt-iptables u:object_r:dnscrypt_proxy_exec:s0
/system/xbin/dnscrypt-proxy u:object_r:dnscrypt_proxy_exec:s0
3 changes: 3 additions & 0 deletions property_contexts
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ config. u:object_r:config_prop:s0
ro.config. u:object_r:config_prop:s0
dalvik. u:object_r:dalvik_prop:s0
ro.dalvik. u:object_r:dalvik_prop:s0

# Dnscrypt Proxy
persist.privacy. u:object_r:system_prop:s0

0 comments on commit 580f2ab

Please sign in to comment.