Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3133817pxm; Mon, 28 Feb 2022 12:46:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBUwF9fPIfRwVl4m4X/IYbmuWvjWOUIrnZ/hw2CuiV1aAUgYpgYGxfgV+EtVJnWKMO9lDD X-Received: by 2002:aa7:cb18:0:b0:413:3a7a:b5d6 with SMTP id s24-20020aa7cb18000000b004133a7ab5d6mr21275041edt.254.1646081186788; Mon, 28 Feb 2022 12:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646081186; cv=none; d=google.com; s=arc-20160816; b=udTiv/59uMXWslCjkspOCVP6AUQrsoHtEWKWeh4N26Z5gwSlVXxHZHBrrZcSnw4LDY j8gRh9pCvoWC8qRTXFcKzyPxfgQES+ymX71VfC1gsCzu2TNkNTKkRDveORA0CQOLCNNr DbAVfxUCzMGbnyT8Dp4Tke05Akhx+HL25sZvadHQkCE6cDQl4HFLCwboJGSt+rLGKnJi UVu9di9ouPfX8oxD4xFRYNuzmnRxlny+ZTMt5jY+8pAuCdWb6VCLvo2JpeQgxRUCVpuf W3aRMEmxcRDZAbdXu9zwqJf5wwqK2XyegcPlnw46dDfVxqfPRmvAjHIL4BBF4xeGo+ly L/nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=+im7DIeiUtaGKg4RALBDVaDivlCOkTtaegKD0ooPRcQ=; b=s+QAVTQHmFRNsk6XKFHBfAf3RhsYEewQkOABpy/6BgeQTvPXsU+nNkCdO9bcnhDjMC rdN/X32MrbqmqF/mj8h+lbDjefgMoSA1cX4KcFXLdHKy46eqdGmeKJpMk58Hjb7u9UzK MWFKJ2WFCtNiw42AAfFgPEyg/csb78FOIcB/3Uv/0RBYONVgQbhQunoUyXIGosoF/g+S S2xhtEgqzKEhbYa7T2RgfO7w5jxZ17CA0bV95fODcx/r6Ah3oamfp1qHbIkOonvZL2xB 1wpSDod1vFAqTyKDbQzz7uDW/oRqho4GIqi6U3uc10mUEAxFJOoiA+cJc5YoA1ph6kKj xnEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b="Hs1aqbd/"; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ieee.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id le12-20020a170907170c00b006b7d3cc81b5si6759795ejc.942.2022.02.28.12.46.18; Mon, 28 Feb 2022 12:46:26 -0800 (PST) Received-SPF: pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ieee.org header.s=google header.b="Hs1aqbd/"; spf=pass (google.com: domain of selinux-refpolicy-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ieee.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229617AbiB1Upb (ORCPT + 22 others); Mon, 28 Feb 2022 15:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbiB1Upa (ORCPT ); Mon, 28 Feb 2022 15:45:30 -0500 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 538FD24BC4 for ; Mon, 28 Feb 2022 12:44:50 -0800 (PST) Received: by mail-qv1-xf2e.google.com with SMTP id a1so14661408qvl.6 for ; Mon, 28 Feb 2022 12:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=+im7DIeiUtaGKg4RALBDVaDivlCOkTtaegKD0ooPRcQ=; b=Hs1aqbd/lKRbOzr/EHqYiZN8zaHDOMz6/UWyNyOngjVljgM2jegFR6DRPn01p5Kr51 2X/DSXSP5vNWE2rFoEaDfW9YBF29dQXciuzrHOjFAfyT/R1Cd7BlPRitZna+A1bktNch yZ/zkN23l3fC6ZFvGc4Z8/SXR+xL0+wNYUl/0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=+im7DIeiUtaGKg4RALBDVaDivlCOkTtaegKD0ooPRcQ=; b=5Sbt11pAJazq08iEy31/fdtrXHwiSMYhO+lOAMcpQZns+U7u4l8MX6nOlTfifP5HjQ SdGmT1XcqqOclvvV/uWfNbe1+xAwBMmOqRxsNVb6V3eq9n3zs5EeOudooyEIL30QlGld 3SOVYSIav/shKGHF7u3gKxru2QVc2IPEF7Njl61YuRscA0HcL7UkuCK028Vc2fxV2jXw /OE3FacRkj9XRqOJear0SNVZrBmoKf3SYGxOxHWLn3Q4zPR3XhXFGmrSH03gfEWgzzSv 4ubOWYXfErWVWwSZunczADiPcpOhyTOaJAKljn/QO/YC8AwxKaZa0+daIKQm1X3XqVWC pnmA== X-Gm-Message-State: AOAM532tJvFMmTLSaYXf/mw27P0sztgU3DLepC2N7qSx/mrEerpYVWoi w/cOBsOaGbSKYsWBW6F1XzK0lzMXpZ8D691x X-Received: by 2002:ad4:41cc:0:b0:432:849c:7ff9 with SMTP id a12-20020ad441cc000000b00432849c7ff9mr15338713qvq.127.1646081089461; Mon, 28 Feb 2022 12:44:49 -0800 (PST) Received: from [192.168.1.126] (pool-68-134-25-67.bltmmd.fios.verizon.net. [68.134.25.67]) by smtp.gmail.com with ESMTPSA id p7-20020a05622a13c700b002de9f3894c2sm7776427qtk.50.2022.02.28.12.44.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Feb 2022 12:44:48 -0800 (PST) Message-ID: <88f8ee15-9cc5-e42e-42bf-4b940c0eee0d@ieee.org> Date: Mon, 28 Feb 2022 15:44:47 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] certbot Content-Language: en-US To: Russell Coker , selinux-refpolicy@vger.kernel.org References: From: Chris PeBenito In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 2/18/22 21:45, Russell Coker wrote: > Allow certbot to create /var/lib/letsencrypt and /var/og/letsencrypt with > the correct contexts. > > Allow it to read /dev/urandom, dontaudit attempts to write python cache files > (would be good to fix python for this), and reload web server to get new > keys. > > I think this is good to merge. > > Signed-off-by: Russell Coker > > Index: refpolicy-2.20220106/policy/modules/services/apache.if > =================================================================== > --- refpolicy-2.20220106.orig/policy/modules/services/apache.if > +++ refpolicy-2.20220106/policy/modules/services/apache.if > @@ -238,6 +238,24 @@ interface(`apache_domtrans',` > > ######################################## > ## > +## Execute httpd > +## > +## > +## > +## Domain allowed to execute it. > +## > +## > +# > +interface(`apache_exec',` > + gen_require(` > + type httpd_t, httpd_exec_t; > + ') > + > + can_exec($1, httpd_exec_t) > +') > + > +######################################## > +## > ## Execute httpd server in the httpd domain. > ## > ## > @@ -1430,3 +1448,21 @@ interface(`apache_admin',` > apache_run_all_scripts($1, $2) > apache_run_helper($1, $2) > ') > + > +######################################## > +## > +## rw httpd_runtime_t files > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`apache_rw_runtime_files',` > + gen_require(` > + type httpd_runtime_t; > + ') > + > + allow $1 httpd_runtime_t:file rw_file_perms; > +') > Index: refpolicy-2.20220106/policy/modules/services/certbot.te > =================================================================== > --- refpolicy-2.20220106.orig/policy/modules/services/certbot.te > +++ refpolicy-2.20220106/policy/modules/services/certbot.te > @@ -43,9 +43,10 @@ allow certbot_t self:udp_socket all_udp_ > allow certbot_t self:tcp_socket all_tcp_socket_perms; > allow certbot_t self:netlink_route_socket create_netlink_socket_perms; > > -files_search_var_lib(certbot_t) > +files_var_lib_filetrans(certbot_t, certbot_lib_t, dir, "letsencrypt") > manage_dirs_pattern(certbot_t, certbot_lib_t, certbot_lib_t) > manage_files_pattern(certbot_t, certbot_lib_t, certbot_lib_t) > +allow certbot_t certbot_lib_t:file relabelfrom; There is no relabelto. What is happening here? > manage_dirs_pattern(certbot_t, certbot_tmp_t, certbot_tmp_t) > manage_files_pattern(certbot_t, certbot_tmp_t, certbot_tmp_t) > @@ -62,7 +63,7 @@ allow certbot_t certbot_tmp_t:file mmap_ > allow certbot_t certbot_tmpfs_t:file mmap_exec_file_perms; > allow certbot_t certbot_runtime_t:file mmap_exec_file_perms; > > -logging_search_logs(certbot_t) > +logging_log_filetrans(certbot_t, certbot_log_t, dir, "letsencrypt") > allow certbot_t certbot_log_t:dir manage_dir_perms; > allow certbot_t certbot_log_t:file manage_file_perms; > > @@ -80,11 +81,15 @@ corenet_tcp_connect_dns_port(certbot_t) > # bind to http port for standalone mode > corenet_tcp_bind_http_port(certbot_t) > > +dev_read_urand(certbot_t) > + > domain_use_interactive_fds(certbot_t) > > files_read_etc_files(certbot_t) > files_read_usr_files(certbot_t) > > +# dontaudit for attempts to write python cache files > +libs_dontaudit_write_lib_dirs(certbot_t) > libs_exec_ldconfig(certbot_t) > # for /usr/lib/gcc/x86_64-linux-gnu/8/collect2 > libs_exec_lib_files(certbot_t) > @@ -110,5 +115,17 @@ optional_policy(` > # for writing to webroot > apache_manage_sys_content(certbot_t) > > - apache_search_config(certbot_t) > + apache_append_log(certbot_t) > + apache_exec(certbot_t) > + apache_exec_modules(certbot_t) > + > + # for certbot to create nginx config > + apache_manage_config(certbot_t) > + > + apache_rw_runtime_files(certbot_t) > + apache_signal(certbot_t) > +') > + > +optional_policy(` > + xdg_search_config_dirs(certbot_t) > ') -- Chris PeBenito