Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp94841pxp; Tue, 8 Mar 2022 21:29:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyuxAdKNNqY51ZcF2BisHCN2BjYbc64rdaNvtbjFF24a+C/yZneygzQtJGnWou8OBJ3c8M X-Received: by 2002:a17:906:edbd:b0:6b6:bd54:235c with SMTP id sa29-20020a170906edbd00b006b6bd54235cmr16395585ejb.363.1646803791744; Tue, 08 Mar 2022 21:29:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646803791; cv=none; d=google.com; s=arc-20160816; b=BeQW6cXFDo6fInYTyW6u6/lUmvl3C7aUd6Hi7KWUZ+jNFs2mO/Ilb6s3EaJepukg+4 O61Mzups5krSX83qvJ4/fte8yWWZhxsGqQGiryw1yNbvkHcALB/zXF8/rAm4Qw/aYRq0 hoQaoTWKBI36V/SwX2K3GehAiCLuoDKUKyTP/ukPeB/pJkSXxhUQprCYNCUny/ADXfvu vQ08ayvfYDMB+Rs7bXn9heBgGoVWzUfhSWx+xdjc0nmDPESysMQPf0+jFeUIgMW2TYYW u5x6xY2zEuYTVObJmGiJKksQ5+mymjj6lnICQff7OGYCkmr9EYOb0Wn3dbg9oQ0Ru/Fh w47Q== 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=1r/VJGjfxi4nlS0hFQYjBqadmlDe0ZXg2sA7T4b2uog=; b=L4i8lC4O3GXwF6pgf01AyAcL0wPkwD0YnQEFbA+a/cBc1RiymIOo/GfQ8Vo+MK5TMw pT5JecUD274WAG1MRmvN6MZtJQPj4Zu/RpNHzLb/0VffVdJim8g+It5PSZdOb5iWTJ9p yyN9h06w9kE8ZGbtXoU7uSJvMwZgHmriwS2gWpqVkmuj26dFj2/53WoBMM34TBYSO68S y8RwvCAsrtzIDL3L/4VII1QHIjTEqi8X4A0k5iBfx+DhermHQewP+CCRORuumg4/iu0s rE1aA+C4f1dUvPPDU1rbIS8+wPP6t2XqM/UTJNumGO3EhZeczo/9k80u1jZCEhHEkyEd TRFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@coker.com.au header.s=2008 header.b=f5CNRe4A; 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=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g4-20020a17090669c400b006cfea60027bsi563888ejs.903.2022.03.08.21.29.45; Tue, 08 Mar 2022 21:29:51 -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=@coker.com.au header.s=2008 header.b=f5CNRe4A; 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=REJECT sp=REJECT dis=NONE) header.from=coker.com.au Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229606AbiCIFU4 (ORCPT + 23 others); Wed, 9 Mar 2022 00:20:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbiCIFUz (ORCPT ); Wed, 9 Mar 2022 00:20:55 -0500 Received: from smtp.sws.net.au (smtp.sws.net.au [IPv6:2a01:4f8:201:1e6::dada:cafe]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB3D7145620 for ; Tue, 8 Mar 2022 21:19:57 -0800 (PST) Received: from xev.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id 47038EDC0 for ; Wed, 9 Mar 2022 16:19:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1646803194; bh=1r/VJGjfxi4nlS0hFQYjBqadmlDe0ZXg2sA7T4b2uog=; l=3441; h=Date:From:To:Subject:From; b=f5CNRe4AHtaVrb3xUd9CbVf+XNH8tha18odXICTfOwIG8cyAuqLDILRA9CiGryC9m edXsgQPgPadTAdcHLgipQrwVFox+mmUVFI6egIMsbFTrd+G2Zx9gbSJ1HCUmMVoGfN pL2AHWakWKqmduLSYsp7lujelGYTDR7/mCdavcLY= Received: by xev.coker.com.au (Postfix, from userid 1001) id 96A3B1763634; Wed, 9 Mar 2022 16:19:49 +1100 (AEDT) Date: Wed, 9 Mar 2022 16:19:49 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] certbot V2 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 Same as the last one but with the relabelto removed. I think it's ready for merging. Signed-off-by: Russell Coker Index: refpolicy-2.20220309/policy/modules/services/apache.if =================================================================== --- refpolicy-2.20220309.orig/policy/modules/services/apache.if +++ refpolicy-2.20220309/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.20220309/policy/modules/services/certbot.te =================================================================== --- refpolicy-2.20220309.orig/policy/modules/services/certbot.te +++ refpolicy-2.20220309/policy/modules/services/certbot.te @@ -43,7 +43,7 @@ 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) @@ -62,7 +62,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 +80,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 +114,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) ')