Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A06C5C43387 for ; Tue, 8 Jan 2019 08:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6F77B2070B for ; Tue, 8 Jan 2019 08:52:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=coker.com.au header.i=@coker.com.au header.b="dCr7vai6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726333AbfAHIwr (ORCPT ); Tue, 8 Jan 2019 03:52:47 -0500 Received: from smtp.sws.net.au ([46.4.88.250]:58610 "EHLO smtp.sws.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727295AbfAHIwr (ORCPT ); Tue, 8 Jan 2019 03:52:47 -0500 Received: from xev.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id 66B86EE4C for ; Tue, 8 Jan 2019 19:52:45 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1546937565; bh=k1wDFDaUx1Kw7Gz3nUXcHtrOF3L+zETyNuTgmnbxtGE=; l=2631; h=Date:From:To:Subject:From; b=dCr7vai6vkG4sSoTh94Bk4M0flokRBI/mEATNfPtFXcYlvSZ0/sBlApxsk7hv1stq +ht3OHHV2ynBGVxYx0z2VcBlPXv43+ZVVgd4ZPuZEmVyjrF70VjH3fwkhpNS6BPOtM tYp2n8gqLkjvA3CMoe7hgPOF/bsqrQHYTZj9aez4= Received: by xev.coker.com.au (Postfix, from userid 1001) id D1E8EC3E947; Tue, 8 Jan 2019 19:52:40 +1100 (AEDT) Date: Tue, 8 Jan 2019 19:52:40 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] mls stuff Message-ID: <20190108085240.GA28781@xev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Here are the patches I used last time I tried to get MLS going on Debian. Index: refpolicy-2.20180701/policy/modules/kernel/kernel.te =================================================================== --- refpolicy-2.20180701.orig/policy/modules/kernel/kernel.te +++ refpolicy-2.20180701/policy/modules/kernel/kernel.te @@ -39,6 +39,7 @@ role unconfined_r; ifdef(`enable_mls',` role secadm_r; role auditadm_r; + mls_process_set_level(kernel_t) ') # Index: refpolicy-2.20180701/policy/modules/system/systemd.te =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/systemd.te +++ refpolicy-2.20180701/policy/modules/system/systemd.te @@ -251,7 +251,13 @@ systemd_log_parse_environment(systemd_gp allow systemd_cgroups_t self:capability net_admin; -kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t) +ifdef(`enable_mls',` + kernel_ranged_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t, s0 - mls_systemhigh) + mls_fd_use_all_levels(systemd_cgroups_t) +',` + kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t) +') + kernel_dgram_send(systemd_cgroups_t) # for /proc/cmdline kernel_read_system_state(systemd_cgroups_t) Index: refpolicy-2.20180701/policy/modules/system/init.te =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/init.te +++ refpolicy-2.20180701/policy/modules/system/init.te @@ -191,6 +191,7 @@ mls_file_read_all_levels(init_t) mls_file_write_all_levels(init_t) mls_process_write_all_levels(init_t) mls_fd_use_all_levels(init_t) +mls_process_set_level(init_t) # the following one is needed for libselinux:is_selinux_enabled() # otherwise the call fails and sysvinit tries to load the policy @@ -384,6 +385,8 @@ ifdef(`init_systemd',` # systemd_socket_activated policy mls_socket_write_all_levels(init_t) + # read from systemd-journal and similar + mls_socket_read_to_clearance(init_t) selinux_unmount_fs(init_t) selinux_validate_context(init_t) Index: refpolicy-2.20180701/policy/modules/system/logging.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/logging.if +++ refpolicy-2.20180701/policy/modules/system/logging.if @@ -422,6 +422,9 @@ interface(`logging_domtrans_syslog',` corecmd_search_bin($1) domtrans_pattern($1, syslogd_exec_t, syslogd_t) + ifdef(`enable_mls',` + range_transition $1 syslogd_exec_t:process mls_systemhigh; + ') ') ########################################