Skip to content
Snippets Groups Projects
  • Stephen Smalley's avatar
    16011320
    Clean up socket rules. · 16011320
    Stephen Smalley authored
    
    Replace * or any permission set containing create with
    create_socket_perms or create_stream_socket_perms.
    
    Add net_domain() to all domains using network sockets and
    delete rules already covered by domain.te or net.te.
    
    For netlink_route_socket, only nlmsg_write needs to be separately
    granted to specific domains that are permitted to modify the routing
    table.   Clarification:  read/write permissions are just ability to
    perform read/recv() or write/send() on the socket, whereas nlmsg_read/
    nlmsg_write permissions control ability to observe or modify the
    underlying kernel state accessed via the socket.
    See security/selinux/nlmsgtab.c in the kernel for the mapping of
    netlink message types to nlmsg_read or nlmsg_write.
    
    Delete legacy rule for b/12061011.
    
    This change does not touch any rules where only read/write were allowed
    to a socket created by another domain (inherited across exec or
    received across socket or binder IPC).  We may wish to rewrite some or all
    of those rules with the rw_socket_perms macro but that is a separate
    change.
    
    Change-Id: Ib0637ab86f6d388043eff928e5d96beb02e5450e
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
    16011320
    History
    Clean up socket rules.
    Stephen Smalley authored
    
    Replace * or any permission set containing create with
    create_socket_perms or create_stream_socket_perms.
    
    Add net_domain() to all domains using network sockets and
    delete rules already covered by domain.te or net.te.
    
    For netlink_route_socket, only nlmsg_write needs to be separately
    granted to specific domains that are permitted to modify the routing
    table.   Clarification:  read/write permissions are just ability to
    perform read/recv() or write/send() on the socket, whereas nlmsg_read/
    nlmsg_write permissions control ability to observe or modify the
    underlying kernel state accessed via the socket.
    See security/selinux/nlmsgtab.c in the kernel for the mapping of
    netlink message types to nlmsg_read or nlmsg_write.
    
    Delete legacy rule for b/12061011.
    
    This change does not touch any rules where only read/write were allowed
    to a socket created by another domain (inherited across exec or
    received across socket or binder IPC).  We may wish to rewrite some or all
    of those rules with the rw_socket_perms macro but that is a separate
    change.
    
    Change-Id: Ib0637ab86f6d388043eff928e5d96beb02e5450e
    Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
drmserver.te 1.36 KiB
# drmserver - DRM service
type drmserver, domain;
type drmserver_exec, exec_type, file_type;

init_daemon_domain(drmserver)
typeattribute drmserver mlstrustedsubject;

net_domain(drmserver)

# Perform Binder IPC to system server.
binder_use(drmserver)
binder_call(drmserver, system_server)
binder_call(drmserver, appdomain)
binder_service(drmserver)

# Perform Binder IPC to mediaserver
binder_call(drmserver, mediaserver)

allow drmserver sdcard_type:dir search;
allow drmserver drm_data_file:dir create_dir_perms;
allow drmserver drm_data_file:file create_file_perms;
allow drmserver tee_device:chr_file rw_file_perms;
allow drmserver platform_app_data_file:file { read write getattr };
allow drmserver app_data_file:file { read write getattr };
allow drmserver sdcard_type:file { read write getattr };
r_dir_file(drmserver, efs_file)

type drmserver_socket, file_type;

# /data/app/tlcd_sock socket file.
# Clearly, /data/app is the most logical place to create a socket.  Not.
allow drmserver apk_data_file:dir rw_dir_perms;
type_transition drmserver apk_data_file:sock_file drmserver_socket;
allow drmserver drmserver_socket:sock_file create_file_perms;
allow drmserver tee:unix_stream_socket connectto;
# Delete old socket file if present.
allow drmserver apk_data_file:sock_file unlink;

# After taking a video, drmserver looks at the video file.
r_dir_file(drmserver, media_rw_data_file)