Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp133788pxb; Wed, 20 Jan 2021 03:12:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2c7yZYi7G5qg7CeQRDhQoJWJmoRlh43f6vUcn/OMHYg+jJeRJXsxCeoDpH1SUNtxGsNlR X-Received: by 2002:a50:9ee3:: with SMTP id a90mr6869538edf.44.1611141133056; Wed, 20 Jan 2021 03:12:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611141133; cv=none; d=google.com; s=arc-20160816; b=sUbSA2amd1Mxhd5QfK7CEp2qmqRco6mW+cVaejFxHp7cR3Rn1XKsGWuaX5ziedrPJE DuYpMbF4g9UAj0OLiZFHwizlQkfKqx+fgdB1t7B1NV8Khfg1YEhyzZ6QCSug1Gp5mYgf Nwr5rUvpJXQVfYonAXsuKCXPscCZqPs+5v0TPVJC2A5D4cG6fFFRauh9S3TbJQ6mbzJs lD6ETPehuNje1+ZgaxKrvziaCXCWwl2Swy1ILdJFR0waaOGClz39vZdO2bMW5+tUCJef JFiOzZZpFMOXquy7pw6nIaCxTxOIHiJ11yWpZwWbP9jq4XLuEyXEAIYLQlKMj0EW+rZi M0og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date:dkim-signature; bh=LrM5Ul2ReIAvM0/mrX+sPV+Ys4iX+tnqp28ALcwTgsg=; b=wh34NXe17RpmRf9+5KQ/4aVbOAc3dM/4hJmNdjjRdpfQ1P3GLUvusJw4C1qxAfXPwt of8gkqzTqCtWpkakAfjMgdou2kGGkJ53793PFuuzNIOVABeLfq2B7MUNiTeHcleEYN5R rNABvoXTdu+TYZs+oA5H2yJ1AlU8afheaYDtBto+weM3PcXBs3nmcwCz9q6rUG8l9jW6 jqQ4xzWZvDJEoxkN+Z5s/B/dayGs6/hR1dN7UNgmT5n9PVpD0+HiSi2S9Y9X9mRfkZvD 7MqgHuBhHcpQhg3cjVwe1zg8X79DBeOuyXP4lIpYOeRbShVDkWPVZxIh8Kj+ptaYVw/i 7KCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=XBzKqbJT; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si732543edv.282.2021.01.20.03.12.08; Wed, 20 Jan 2021 03:12:13 -0800 (PST) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=XBzKqbJT; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727310AbhATLIi (ORCPT + 16 others); Wed, 20 Jan 2021 06:08:38 -0500 Received: from smtp.sws.net.au ([46.4.88.250]:35946 "EHLO smtp.sws.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731612AbhATJnM (ORCPT ); Wed, 20 Jan 2021 04:43:12 -0500 Received: from xev.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id 070FFEC7A for ; Wed, 20 Jan 2021 20:42:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1611135746; bh=LrM5Ul2ReIAvM0/mrX+sPV+Ys4iX+tnqp28ALcwTgsg=; l=8434; h=Date:From:To:Subject:From; b=XBzKqbJTgfCWhmd6HjHZMtpoECFRVMzz3u+aAPCyTmu+rBQJ9MKjqRy1RKVNUoNf2 YDeXcTihNrjAIjPkir/K5E2+4+OeftwQ29qh3Bn1+KzOLH/qn/n+nyN8IjG1tXEjy0 ISBrc5rFxG99OLJb1Wt7xauw0puRPj3Xrvwa+riY= Received: by xev.coker.com.au (Postfix, from userid 1001) id 001DB131FBA2; Wed, 20 Jan 2021 20:42:21 +1100 (AEDT) Date: Wed, 20 Jan 2021 20:42:21 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] misc network patches Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Collection of net related patches, ready for inclusion. Signed-off-by: Russell Coker Index: refpolicy-2.20210120/policy/modules/admin/netutils.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/admin/netutils.te +++ refpolicy-2.20210120/policy/modules/admin/netutils.te @@ -109,6 +109,7 @@ allow ping_t self:tcp_socket create_sock allow ping_t self:rawip_socket { create ioctl read write bind getopt setopt getattr }; allow ping_t self:packet_socket { create ioctl read write bind getopt setopt }; allow ping_t self:netlink_route_socket create_netlink_socket_perms; +allow ping_t self:icmp_socket create; corenet_all_recvfrom_netlabel(ping_t) corenet_sendrecv_icmp_packets(ping_t) @@ -164,13 +165,14 @@ allow traceroute_t self:capability { net allow traceroute_t self:fifo_file rw_inherited_fifo_file_perms; allow traceroute_t self:process signal; allow traceroute_t self:rawip_socket create_socket_perms; -allow traceroute_t self:packet_socket create_socket_perms; +allow traceroute_t self:packet_socket { map create_socket_perms }; allow traceroute_t self:udp_socket create_socket_perms; can_exec(traceroute_t, traceroute_exec_t) kernel_read_system_state(traceroute_t) kernel_read_network_state(traceroute_t) +kernel_search_fs_sysctls(traceroute_t) corecmd_search_bin(traceroute_t) @@ -205,6 +207,7 @@ auth_use_nsswitch(traceroute_t) logging_send_syslog_msg(traceroute_t) +miscfiles_read_generic_certs(traceroute_t) miscfiles_read_localization(traceroute_t) userdom_use_inherited_user_terminals(traceroute_t) Index: refpolicy-2.20210120/policy/modules/system/sysnetwork.fc =================================================================== --- refpolicy-2.20210120.orig/policy/modules/system/sysnetwork.fc +++ refpolicy-2.20210120/policy/modules/system/sysnetwork.fc @@ -27,6 +27,7 @@ ifdef(`distro_debian',` /etc/dhcp3?/dhclient.* gen_context(system_u:object_r:dhcp_etc_t,s0) /etc/systemd/network(/.*)? gen_context(system_u:object_r:net_conf_t,s0) +/etc/tor/torsocks.conf -- gen_context(system_u:object_r:net_conf_t,s0) ifdef(`distro_redhat',` /etc/sysconfig/network-scripts/.*resolv\.conf -- gen_context(system_u:object_r:net_conf_t,s0) Index: refpolicy-2.20210120/policy/modules/system/sysnetwork.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/system/sysnetwork.te +++ refpolicy-2.20210120/policy/modules/system/sysnetwork.te @@ -5,6 +5,14 @@ policy_module(sysnetwork, 1.26.3) # Declarations # +## +##

+## Determine whether DHCP client +## can manage samba +##

+##
+gen_tunable(dhcpc_manage_samba, false) + attribute_role dhcpc_roles; roleattribute system_r dhcpc_roles; @@ -175,6 +183,15 @@ ifdef(`init_systemd',` ') optional_policy(` + tunable_policy(`dhcpc_manage_samba',` + samba_manage_var_files(dhcpc_t) + init_exec_script_files(dhcpc_t) + init_get_system_status(dhcpc_t) + samba_restart(dhcpc_t) + ') +') + +optional_policy(` avahi_domtrans(dhcpc_t) ') Index: refpolicy-2.20210120/policy/modules/roles/staff.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/roles/staff.te +++ refpolicy-2.20210120/policy/modules/roles/staff.te @@ -15,6 +15,10 @@ userdom_unpriv_user_template(staff) # corenet_ib_access_unlabeled_pkeys(staff_t) +corenet_tcp_bind_all_unreserved_ports(staff_t) +corenet_udp_bind_all_unreserved_ports(staff_t) +corenet_tcp_bind_generic_node(staff_t) + optional_policy(` apache_role(staff_r, staff_t) ') @@ -36,6 +40,10 @@ optional_policy(` ') optional_policy(` + netutils_domtrans_ping(staff_t) +') + +optional_policy(` postgresql_role(staff_r, staff_t) ') @@ -65,6 +73,11 @@ optional_policy(` ') optional_policy(` + # for torbrowser-launcher + xdg_exec_data(staff_t) +') + +optional_policy(` xscreensaver_role(staff_r, staff_t) ') Index: refpolicy-2.20210120/policy/modules/roles/unprivuser.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/roles/unprivuser.te +++ refpolicy-2.20210120/policy/modules/roles/unprivuser.te @@ -7,11 +7,23 @@ policy_module(unprivuser, 2.10.0) # # Declarations # +## +##

+## Allow user to bind all unreserved ports +##

+##
+gen_tunable(user_bind_unreserved, false) #role user_r; userdom_unpriv_user_template(user) +tunable_policy(`user_bind_unreserved', ` + corenet_tcp_bind_all_unreserved_ports(user_t) + corenet_udp_bind_all_unreserved_ports(user_t) + corenet_tcp_bind_generic_node(user_t) +') + optional_policy(` apache_role(user_r, user_t) ') @@ -25,6 +37,10 @@ optional_policy(` ') optional_policy(` + netutils_domtrans_ping(user_t) +') + +optional_policy(` screen_role_template(user, user_r, user_t) ') @@ -33,6 +49,11 @@ optional_policy(` ') optional_policy(` + # for torbrowser-launcher + xdg_exec_data(user_t) +') + +optional_policy(` xscreensaver_role(user_r, user_t) ') Index: refpolicy-2.20210120/policy/modules/services/samba.if =================================================================== --- refpolicy-2.20210120.orig/policy/modules/services/samba.if +++ refpolicy-2.20210120/policy/modules/services/samba.if @@ -729,3 +729,22 @@ interface(`samba_admin',` files_list_tmp($1) admin_pattern($1, { swat_tmp_t smbd_tmp_t winbind_tmp_t }) ') + +######################################## +## +## Restart and get status of samba daemon +## +## +## +## Domain allowed access. +## +## +# +interface(`samba_restart',` + gen_require(` + type samba_unit_t; + ') + + allow $1 samba_unit_t:file getattr; + allow $1 samba_unit_t:service { start stop status reload }; +') Index: refpolicy-2.20210120/policy/modules/system/xdg.if =================================================================== --- refpolicy-2.20210120.orig/policy/modules/system/xdg.if +++ refpolicy-2.20210120/policy/modules/system/xdg.if @@ -921,6 +921,24 @@ interface(`xdg_watch_documents_dirs',` ######################################## ## +## Allow executing the xdg data home files +## +## +## +## Domain allowed access. +## +## +# +interface(`xdg_exec_data',` + gen_require(` + type xdg_data_t; + ') + + can_exec($1, xdg_data_t) +') + +######################################## +## ## Create objects in the user home dir with an automatic type transition to ## the xdg_documents_t type. ## Index: refpolicy-2.20210120/policy/modules/services/mon.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/services/mon.te +++ refpolicy-2.20210120/policy/modules/services/mon.te @@ -58,6 +58,9 @@ manage_files_pattern(mon_t, mon_var_log_ manage_files_pattern(mon_t, mon_runtime_t, mon_runtime_t) files_runtime_filetrans(mon_t, mon_runtime_t, file) +# to read fips_enabled +kernel_read_crypto_sysctls(mon_t) + kernel_read_kernel_sysctls(mon_t) kernel_read_network_state(mon_t) kernel_read_system_state(mon_t) Index: refpolicy-2.20210120/policy/modules/services/mailman.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/services/mailman.te +++ refpolicy-2.20210120/policy/modules/services/mailman.te @@ -112,6 +112,7 @@ corecmd_exec_bin(mailman_cgi_t) dev_read_urand(mailman_cgi_t) files_search_locks(mailman_cgi_t) +files_read_usr_files(mailman_cgi_t) term_use_controlling_term(mailman_cgi_t) Index: refpolicy-2.20210120/policy/modules/services/dkim.te =================================================================== --- refpolicy-2.20210120.orig/policy/modules/services/dkim.te +++ refpolicy-2.20210120/policy/modules/services/dkim.te @@ -35,6 +35,7 @@ kernel_read_vm_overcommit_sysctl(dkim_mi corenet_udp_bind_generic_node(dkim_milter_t) corenet_udp_bind_all_unreserved_ports(dkim_milter_t) +corenet_udp_bind_generic_port(dkim_milter_t) dev_read_urand(dkim_milter_t) # for cpu/online