From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 50C3E138CD3 for ; Tue, 9 Jun 2015 13:24:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CEC39E08A4; Tue, 9 Jun 2015 13:24:28 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 52274E08A4 for ; Tue, 9 Jun 2015 13:24:28 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CE284340ABC for ; Tue, 9 Jun 2015 13:24:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A589BA48 for ; Tue, 9 Jun 2015 13:24:18 +0000 (UTC) From: "Sven Vermeulen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Vermeulen" Message-ID: <1433001629.d4afeed432628ed87eb86e305d80b982751edcab.swift@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:swift commit in: policy/modules/contrib/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/contrib/kdeconnect.fc policy/modules/contrib/kdeconnect.if policy/modules/contrib/kdeconnect.te X-VCS-Directories: policy/modules/contrib/ X-VCS-Committer: swift X-VCS-Committer-Name: Sven Vermeulen X-VCS-Revision: d4afeed432628ed87eb86e305d80b982751edcab X-VCS-Branch: swift Date: Tue, 9 Jun 2015 13:24:18 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a0f3f354-f66e-407e-8f2c-5b42ace213ca X-Archives-Hash: d07d284adce8048a01b83471ee28ad54 commit: d4afeed432628ed87eb86e305d80b982751edcab Author: Jason Zaman perfinion com> AuthorDate: Sat May 30 15:52:25 2015 +0000 Commit: Sven Vermeulen gentoo org> CommitDate: Sat May 30 16:00:29 2015 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=d4afeed4 Add KDEConnect policy Thanks to Dan O. and a few minor fixups. Gentoo bug 536672 policy/modules/contrib/kdeconnect.fc | 1 + policy/modules/contrib/kdeconnect.if | 97 +++++++++++++++++++++++++++++ policy/modules/contrib/kdeconnect.te | 114 +++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+) diff --git a/policy/modules/contrib/kdeconnect.fc b/policy/modules/contrib/kdeconnect.fc new file mode 100644 index 0000000..797a7a0 --- /dev/null +++ b/policy/modules/contrib/kdeconnect.fc @@ -0,0 +1 @@ +/usr/lib/libexec/kdeconnectd -- gen_context(system_u:object_r:kdeconnect_exec_t,s0) diff --git a/policy/modules/contrib/kdeconnect.if b/policy/modules/contrib/kdeconnect.if new file mode 100644 index 0000000..f07be14 --- /dev/null +++ b/policy/modules/contrib/kdeconnect.if @@ -0,0 +1,97 @@ +## policy for kdeconnect + +######################################## +## +## Execute kdeconnect in the kdeconnect domin. +## +## +## +## Domain allowed to transition. +## +## +# +interface(`kdeconnect_domtrans',` + gen_require(` + type kdeconnect_t, kdeconnect_exec_t; + ') + + corecmd_search_bin($1) + domtrans_pattern($1, kdeconnect_exec_t, kdeconnect_t) +') + +######################################## +## +## Execute kdeconnect in the kdeconnect domain, and +## allow the specified role the kdeconnect domain. +## +## +## +## Domain allowed to transition +## +## +## +## +## The role to be allowed the kdeconnect domain. +## +## +# +interface(`kdeconnect_run',` + gen_require(` + type kdeconnect_t; + ') + + kdeconnect_domtrans($1) + role $2 types kdeconnect_t; +') + +######################################## +## +## Role access for kdeconnect +## +## +## +## Role allowed access +## +## +## +## +## User domain for the role +## +## +# +interface(`kdeconnect_role',` + gen_require(` + type kdeconnect_t; + ') + + role $1 types kdeconnect_t; + + kdeconnect_domtrans($2) + + allow $2 kdeconnect_t:unix_stream_socket connectto; + allow kdeconnect_t $2:unix_stream_socket { read write connectto }; + + ps_process_pattern($2, kdeconnect_t) + allow $2 kdeconnect_t:process { signull signal sigkill }; +') + +######################################### +## +## Send and receive messages from the kdeconnect daemon +## over dbus. +## +## +## +## Domain allowed access. +## +## +# +interface(`kdeconnect_dbus_chat',` + gen_require(` + type kdeconnect_t; + class dbus send_msg; + ') + + allow $1 kdeconnect_t:dbus send_msg; + allow kdeconnect_t $1:dbus send_msg; +') diff --git a/policy/modules/contrib/kdeconnect.te b/policy/modules/contrib/kdeconnect.te new file mode 100644 index 0000000..92be330 --- /dev/null +++ b/policy/modules/contrib/kdeconnect.te @@ -0,0 +1,114 @@ +policy_module(kdeconnect, 1.0.0) + +######################################## +# +# Declarations +# + +## +##

+## Allow KDEConnect to read user home files +##

+##
+gen_tunable(kdeconnect_read_user_files, true) + +type kdeconnect_t; +type kdeconnect_exec_t; +application_domain(kdeconnect_t, kdeconnect_exec_t) + +type kdeconnect_xdg_cache_home_t; +xdg_cache_home_content(kdeconnect_xdg_cache_home_t) + +type kdeconnect_tmp_t; +userdom_user_tmp_file(kdeconnect_tmp_t) + +type kdeconnect_xdg_config_home_t; +xdg_config_home_content(kdeconnect_xdg_config_home_t) + +type kdeconnect_xdg_data_home_t; +xdg_data_home_content(kdeconnect_xdg_data_home_t) + +type kdeconnect_tmpfs_t; +userdom_user_tmpfs_file(kdeconnect_tmpfs_t) + +######################################## +# +# kdeconnect local policy +# + +allow kdeconnect_t self:fifo_file manage_fifo_file_perms; +allow kdeconnect_t self:unix_stream_socket create_stream_socket_perms; +allow kdeconnect_t self:unix_dgram_socket { write getopt create setopt }; +allow kdeconnect_t self:netlink_route_socket create_netlink_socket_perms; +allow kdeconnect_t self:netlink_kobject_uevent_socket create_socket_perms; +allow kdeconnect_t self:tcp_socket create_stream_socket_perms; +allow kdeconnect_t self:udp_socket create_stream_socket_perms; +allow kdeconnect_t self:process { execmem signal }; + +kernel_read_system_state(kdeconnect_t) + +manage_dirs_pattern(kdeconnect_t, kdeconnect_tmp_t, kdeconnect_tmp_t) +manage_files_pattern(kdeconnect_t, kdeconnect_tmp_t, kdeconnect_tmp_t) +files_tmp_filetrans(kdeconnect_t, kdeconnect_tmp_t, { dir file }) + +manage_files_pattern(kdeconnect_t, kdeconnect_xdg_cache_home_t, kdeconnect_xdg_cache_home_t) +manage_dirs_pattern(kdeconnect_t, kdeconnect_xdg_cache_home_t, kdeconnect_xdg_cache_home_t) +xdg_cache_home_filetrans(kdeconnect_t, kdeconnect_xdg_cache_home_t, dir) + +manage_files_pattern(kdeconnect_t, kdeconnect_xdg_config_home_t, kdeconnect_xdg_config_home_t) +manage_dirs_pattern(kdeconnect_t, kdeconnect_xdg_config_home_t, kdeconnect_xdg_config_home_t) +xdg_config_home_filetrans(kdeconnect_t, kdeconnect_xdg_config_home_t, { dir file }) + +manage_files_pattern(kdeconnect_t, kdeconnect_xdg_data_home_t, kdeconnect_xdg_data_home_t) +manage_dirs_pattern(kdeconnect_t, kdeconnect_xdg_data_home_t, kdeconnect_xdg_data_home_t) +xdg_data_home_filetrans(kdeconnect_t, kdeconnect_xdg_data_home_t, { dir file }) + +manage_dirs_pattern(kdeconnect_t, kdeconnect_tmpfs_t, kdeconnect_tmpfs_t) +manage_files_pattern(kdeconnect_t, kdeconnect_tmpfs_t, kdeconnect_tmpfs_t) +fs_tmpfs_filetrans(kdeconnect_t, kdeconnect_tmpfs_t, { dir file }) + +corenet_sendrecv_kdeconnect_client_packets(kdeconnect_t) +corenet_sendrecv_kdeconnect_server_packets(kdeconnect_t) +corenet_tcp_bind_kdeconnect_port(kdeconnect_t) +corenet_tcp_bind_generic_node(kdeconnect_t) +corenet_tcp_connect_kdeconnect_port(kdeconnect_t) +corenet_tcp_sendrecv_kdeconnect_port(kdeconnect_t) +corenet_udp_bind_kdeconnect_port(kdeconnect_t) +corenet_udp_sendrecv_kdeconnect_port(kdeconnect_t) +corenet_udp_bind_generic_node(kdeconnect_t) + +dev_read_sysfs(kdeconnect_t) +domain_use_interactive_fds(kdeconnect_t) + +files_manage_generic_tmp_files(kdeconnect_t) +files_read_etc_files(kdeconnect_t) +files_read_usr_files(kdeconnect_t) +fs_getattr_xattr_fs(kdeconnect_t) + +miscfiles_read_localization(kdeconnect_t) +udev_read_db(kdeconnect_t) + +userdom_manage_user_tmp_files(kdeconnect_t) +userdom_manage_user_tmp_sockets(kdeconnect_t) +userdom_use_user_ptys(kdeconnect_t) +# KDEConnect needs access to some global config/cache/data files +xdg_manage_cache_home(kdeconnect_t) +xdg_manage_config_home(kdeconnect_t) +xdg_manage_data_home(kdeconnect_t) + +xserver_stream_connect(kdeconnect_t) +xserver_user_x_domain_template(kdeconnect, kdeconnect_t, kdeconnect_tmpfs_t) + +tunable_policy(`kdeconnect_read_user_files',` + userdom_read_user_home_content_files(kdeconnect_t) +') + +####################################### +# +# Allow KDEConnect to talk to DBUS +# + +dbus_all_session_bus_client(kdeconnect_t) +dbus_connect_all_session_bus(kdeconnect_t) +dbus_connect_system_bus(kdeconnect_t) +dbus_system_bus_client(kdeconnect_t)