From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id MJIJFl8Kd2PqlwAAbAwnHQ (envelope-from ) for ; Fri, 18 Nov 2022 05:30:23 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id QETeFV8Kd2PjDAEAauVa8A (envelope-from ) for ; Fri, 18 Nov 2022 05:30:23 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BCF588972 for ; Fri, 18 Nov 2022 05:30:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovt0w-0000d3-P3; Thu, 17 Nov 2022 23:30:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovt0t-0000cA-EM for guix-patches@gnu.org; Thu, 17 Nov 2022 23:30:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovt0t-00049I-2w for guix-patches@gnu.org; Thu, 17 Nov 2022 23:30:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovt0s-0007MR-RI for guix-patches@gnu.org; Thu, 17 Nov 2022 23:30:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59336] [PATCH v2 0/3] gnu: Add apparmor. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Nov 2022 04:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59336 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59336@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166874574928198 (code B ref -1); Fri, 18 Nov 2022 04:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Nov 2022 04:29:09 +0000 Received: from localhost ([127.0.0.1]:34861 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovt01-0007Kj-3A for submit@debbugs.gnu.org; Thu, 17 Nov 2022 23:29:09 -0500 Received: from lists.gnu.org ([209.51.188.17]:37278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovszw-0007KU-VG for submit@debbugs.gnu.org; Thu, 17 Nov 2022 23:29:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovszw-0000YC-PB for guix-patches@gnu.org; Thu, 17 Nov 2022 23:29:04 -0500 Received: from mail.boiledscript.com ([144.168.59.46]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovszu-00042p-LM for guix-patches@gnu.org; Thu, 17 Nov 2022 23:29:04 -0500 Date: Fri, 18 Nov 2022 12:28:17 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1668745737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZeL7eyjOHPFmZqoAvaH715IMMD2j2PmWR4nRzCN4Uy4=; b=G8DzoxiAKEnsp5iRlxIiA0XS1n94Vz44jkqBNoh8En74dZvXDoOBtX+eQtmHpLN4uazulf jtgv7x2hRRYfFmWhmTdlyAVtPzY+lsEQZ7wjwWFYCwzf0lqMkz7P0ZKj/M5W/nFWD5igyr natX/yjAmx8/co926PG5DHX40iwrlwnFa1t2XDd0jtvPrn8OLLPLewhpvzgLHbLMeCYYOm JaENwleNzRqiivf0GUTVMdOBQDnZF3jnim895zQ8hVZgybHrzuLuA280CLaNwpk5jtN2RU bO1iouwBuVErnFhUssMjTv/TvnPtTfD6/mQ659BVDa5nQ5XTazxdHs5ErEj+Lw== Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit X-Spamd-Bar: / Received-SPF: pass client-ip=144.168.59.46; envelope-from=hako@ultrarare.space; helo=mail.boiledscript.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches From: Hilton Chain via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1668745823; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=ZeL7eyjOHPFmZqoAvaH715IMMD2j2PmWR4nRzCN4Uy4=; b=fnhtfVVsCIH1ONOqAmwJvqxkdnKYP8gWn2suaUbq9y4R7YtyciFAcWAxb+kHnTFCpYSR/Y w+Gk/ehqDbEZ/hZWgsBoh4dWhRB+429b46ga1XeXAZ+cZUaJDbPeVOAaTkZAxhiSBSHGI6 fv0NHktdXDdICaohxOG8KxYK15wTVeajj+cdY+35dbi3ZKXM9vZnP2gMEyObpKBOCnHLk1 MzfuYcVbbNytnBeAlIi575tqmd8kJs3RzNeNlVfS2nQuTvEp/k9Gazdm9nTDg2Abs0sOb7 Z9CU5/khix68qkN7k9v3KiWaq0uIuja3F18fn3vcrz53GzWCrHMMR0qL2aVgkA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1668745823; a=rsa-sha256; cv=none; b=E0NWYR0b0plcyjUUfAJyTFOAbkJXuubGYqQQe0ajUrTjNrX7EtR8m5RzhzPim/SxSYtAFL iYPGWx/01vzeTJNVXwwv3+1r4AadIRHCOL2CeLBBpKuW0tVyBQJy+7iUFg0cAlvvp6ebLe f4ZsvMHaDyb4l5gdPH6eUpg9Nu7qfjzViS30vM9v4sqJ3oo7lusLu9tMaymLvYm3mPwmlI ltQq8tGxGc8NdanEBA0jS7Hx8FYavBTdIQJUtTP98reh+FEXVq+VCPEuAy6+zHp5ay7+oy 9VbSQIgwo4DMl7sOFH0aUqIfd/ZzNbtjEAr+y2TLRE4MlQwjniriG4UpBL94nA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b=G8DzoxiA; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.23 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b=G8DzoxiA; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BCF588972 X-Spam-Score: -2.23 X-Migadu-Scanner: scn1.migadu.com X-TUID: Gix5buk2zYPk v1 -> v2: 1. Build Ruby bindings for libapparmor. 2. Build the original apparmor, apparmor-parser, apparmor-utils, apparmor-profiles into a single package, apparmor. 3. Fix paths in aa-easyprof's config file. Hilton Chain (3): gnu: Add libapparmor. gnu: Add apparmor. gnu: Add pam-apparmor. gnu/local.mk | 1 + gnu/packages/apparmor.scm | 196 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 197 insertions(+) create mode 100644 gnu/packages/apparmor.scm The following is the diff range from v1 to v2: diff --git a/gnu/packages/apparmor.scm b/gnu/packages/apparmor.scm index 85f3e9c6ae..3136091747 100644 --- a/gnu/packages/apparmor.scm +++ b/gnu/packages/apparmor.scm @@ -55,10 +55,31 @@ (define-public libapparmor (arguments (list #:configure-flags #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib") - "--with-perl" "--with-python") + "--with-perl" "--with-python" "--with-ruby") #:phases #~(modify-phases %standard-phases - (add-after 'unpack 'change-directory + (add-after 'unpack 'fix-paths + (lambda* (#:key inputs #:allow-other-keys) + (for-each patch-shebang + '("common/list_af_names.sh" + "common/list_capabilities.sh")) + (for-each (lambda (file) + (substitute* file + (("/usr") "") + (("/bin/\\<(pod2man|pod2html|podchecker|prove)\\>" path) + (search-input-file inputs path)) + (("/include/linux/capability.h" path) + (search-input-file inputs path)))) + '("common/Make-po.rules" + "common/Make.rules" + "binutils/Makefile" + "parser/Makefile" + "parser/tst/Makefile" + "profiles/Makefile" + "utils/Makefile" + "utils/python-tools-setup.py" + "utils/vim/Makefile")))) + (add-after 'fix-paths 'change-directory (lambda _ (chdir "libraries/libapparmor")))))) (native-inputs @@ -70,6 +91,7 @@ (define-public libapparmor libtool perl python-minimal + ruby swig which)) (home-page "https://apparmor.net") @@ -90,112 +112,67 @@ (define-public libapparmor (license license:lgpl2.1))) (define-public apparmor - (package - (inherit libapparmor) - (name "apparmor") - (arguments - (list #:make-flags - #~(list (string-append "CC=" #$(cc-for-target)) - (string-append "DESTDIR=" #$output) - "USE_SYSTEM=1") - #:phases - #~(modify-phases %standard-phases + (let ((base libapparmor)) + (package + (inherit base) + (name "apparmor") + (arguments + (append + (list #:make-flags + #~(list (string-append "CC=" #$(cc-for-target)) + (string-append "DESTDIR=" #$output) + "USE_SYSTEM=1" + ;; No need to run the linter + "PYFLAKES=true")) + (substitute-keyword-arguments (package-arguments base) + ((#:phases phases) + #~(modify-phases #$phases (delete 'configure) - (add-after 'unpack 'fix-makefile-paths - (lambda _ - (for-each patch-shebang - '("common/list_af_names.sh" - "common/list_capabilities.sh")) - (for-each (lambda (file) - (substitute* file - (("/usr/bin/\\<(pod2man|pod2html|prove)\\>" all cmd) cmd) - (("/usr") ""))) - '("common/Make-po.rules" - "common/Make.rules" - "binutils/Makefile" - "parser/Makefile" - "parser/tst/Makefile" - "profiles/Makefile" - "utils/Makefile" - "utils/python-tools-setup.py" - "utils/vim/Makefile")))) - (add-after 'fix-makefile-paths 'change-directory + ;; apparmor-binutils + (replace 'change-directory (lambda _ - (chdir "binutils")))))) - (native-inputs (list gettext-minimal perl which)) - (inputs (list libapparmor)) - (license license:gpl2))) + (chdir "binutils"))) -(define-public apparmor-parser - (let ((base apparmor)) - (package - (inherit base) - (name "apparmor-parser") - (arguments - (substitute-keyword-arguments (package-arguments base) - ((#:phases phases) - #~(modify-phases #$phases - (replace 'change-directory - (lambda _ - (chdir "parser"))) - (add-after 'change-directory 'fix-kernel-header-path - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "Makefile" - (("/include/linux/capability.h" path) - (search-input-file inputs path))))))))) - (native-inputs - (modify-inputs (package-native-inputs base) - (append bison flex python-minimal)))))) + ;; apparmor-parser + (add-after 'install 'chdir-parser + (lambda _ + (chdir "../parser"))) + (add-after 'chdir-parser 'patch-source-shebangs-parser + (assoc-ref %standard-phases 'patch-source-shebangs)) + (add-after 'patch-source-shebangs-parser 'build-parser + (assoc-ref %standard-phases 'build)) + (add-after 'build-parser 'check-parser + (assoc-ref %standard-phases 'check)) + (add-after 'check-parser 'install-parser + (assoc-ref %standard-phases 'install)) -(define-public apparmor-utils - (let ((base apparmor)) - (package - (inherit base) - (name "apparmor-utils") - (arguments - (append - ;; FIXME: Tests required Python library from this package (itself). - (list #:tests? #f) - (substitute-keyword-arguments (package-arguments base) - ((#:phases phases) - #~(modify-phases #$phases - (replace 'change-directory + ;; apparmor-utils + ;; FIXME: Tests required Python library from this package + ;; (itself). + (add-after 'install-parser 'chdir-utils (lambda _ - (chdir "utils"))) - (add-after 'change-directory 'fix-paths - (lambda* (#:key inputs #:allow-other-keys) - ;; Fix kernel header path - (substitute* "Makefile" - (("/include/linux/capability.h" path) - (search-input-file inputs path))) - ;; Fix apparmor_parser path - (for-each (lambda (file) - (substitute* file - (("/sbin/apparmor_parser" path) - (search-input-file inputs path)))) - '("apparmor/aa.py" - "apparmor/easyprof.py" - "logprof.conf"))))))))) - (native-inputs - (modify-inputs (package-native-inputs base) - (append python-minimal))) - (inputs - (modify-inputs (package-inputs base) - (append apparmor-parser)))))) + (chdir "../utils") + ;; Fix paths to installed policygroups and templates for + ;; easyprof. + (substitute* "easyprof/easyprof.conf" + (("/usr") #$output)))) + (add-after 'chdir-utils 'build-utils + (assoc-ref %standard-phases 'build)) + (add-after 'build-utils 'install-utils + (assoc-ref %standard-phases 'install)) -(define-public apparmor-profiles - (let ((base apparmor)) - (package - (inherit base) - (name "apparmor-profiles") - (arguments - (append - (list #:tests? #f) ;Needs an AppArmor-enabled system. - (substitute-keyword-arguments (package-arguments base) - ((#:phases phases) - #~(modify-phases #$phases - (replace 'change-directory + ;; apparmor-profiles + ;; FIXME: Tests need an AppArmor-enabled system. + (add-after 'install-utils 'chdir-profiles (lambda _ - (chdir "profiles")))))))) - (native-inputs (list which)) - (inputs '())))) + (chdir "../profiles"))) + (add-after 'chdir-profiles 'build-profiles + (assoc-ref %standard-phases 'build)) + (add-after 'check-build 'install-profiles + (assoc-ref %standard-phases 'install))))))) + (propagated-inputs + (list libapparmor)) + ;; Python module `readline' needed + (native-inputs + (list bison flex gettext-minimal perl python which)) + (license license:gpl2)))) (define-public pam-apparmor (let ((base apparmor)) base-commit: 8e42bfaffa3ecee4c3f0ee6ff257f4fcd90d4677 -- 2.38.1