| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 19 | (define-module (gnu packages apparmor)
|
| 20 | #:use-module ((guix licenses) #:prefix license:)
|
| 21 | #:use-module (gnu packages autotools)
|
| 22 | #:use-module (gnu packages base)
|
| 23 | #:use-module (gnu packages bison)
|
| 24 | #:use-module (gnu packages dejagnu)
|
| 25 | #:use-module (gnu packages compiler-tools)
|
| 26 | #:use-module (gnu packages gawk)
|
| 27 | #:use-module (gnu packages gettext)
|
| 28 | #:use-module (gnu packages linux)
|
| 29 | #:use-module (gnu packages perl)
|
| 30 | #:use-module (gnu packages pkg-config)
|
| 31 | #:use-module (gnu packages python)
|
| 32 | #:use-module (gnu packages python-build)
|
| 33 | #:use-module (gnu packages python-xyz)
|
| 34 | #:use-module (gnu packages ruby)
|
| 35 | #:use-module (gnu packages swig)
|
| 36 | #:use-module (guix build-system gnu)
|
| 37 | #:use-module (guix gexp)
|
| 38 | #:use-module (guix git-download)
|
| 39 | #:use-module (guix packages)
|
| 40 | #:use-module (guix utils))
|
| 41 |
|
| 42 | (define-public libapparmor
|
| 43 | (package
|
| 44 | (name "libapparmor")
|
| 45 | (version "4.1.2")
|
| 46 | (source (origin
|
| 47 | (method git-fetch)
|
| 48 | (uri (git-reference
|
| 49 | (url "https://gitlab.com/apparmor/apparmor")
|
| 50 | (commit (string-append "v" version))))
|
| 51 | (file-name (git-file-name name version))
|
| 52 | (sha256
|
| 53 | (base32
|
| 54 | "0p3vq0awvn4ar6sblmhcs0i9m7zc9kbwm3f3zcggx4lqgmy8s18b"))))
|
| 55 | (build-system gnu-build-system)
|
| 56 | (arguments
|
| 57 | (list #:configure-flags
|
| 58 | #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
|
| 59 | "--with-perl" "--with-python" "--with-ruby")
|
| 60 | #:phases
|
| 61 | #~(modify-phases %standard-phases
|
| 62 | (add-after 'unpack 'fix-paths
|
| 63 | (lambda* (#:key inputs #:allow-other-keys)
|
| 64 | (for-each patch-shebang
|
| 65 | '("common/list_af_names.sh"
|
| 66 | "common/list_capabilities.sh"))
|
| 67 | (for-each (lambda (file)
|
| 68 | (substitute* file
|
| 69 | (("/usr") "")
|
| 70 | (("/bin/\\<(pod2man|pod2html|podchecker|prove)\\>" path)
|
| 71 | (search-input-file inputs path))
|
| 72 | (("/include/linux/capability.h" path)
|
| 73 | (search-input-file inputs path))))
|
| 74 | '("common/Make-po.rules"
|
| 75 | "common/Make.rules"
|
| 76 | "binutils/Makefile"
|
| 77 | "parser/Makefile"
|
| 78 | "parser/tst/Makefile"
|
| 79 | "profiles/Makefile"
|
| 80 | "utils/Makefile"
|
| 81 | "utils/python-tools-setup.py"
|
| 82 | "utils/vim/Makefile"))))
|
| 83 | (add-after 'fix-paths 'change-directory
|
| 84 | (lambda _
|
| 85 | (chdir "libraries/libapparmor"))))))
|
| 86 | (native-inputs
|
| 87 | (list autoconf
|
| 88 | autoconf-archive
|
| 89 | automake
|
| 90 | bison
|
| 91 | dejagnu
|
| 92 | flex
|
| 93 | libtool
|
| 94 | perl
|
| 95 | python-minimal
|
| 96 | python-setuptools
|
| 97 | ruby
|
| 98 | swig-4.4
|
| 99 | which))
|
| 100 | (home-page "https://apparmor.net")
|
| 101 | (synopsis "Linux kernel security module")
|
| 102 | (description
|
| 103 | "AppArmor is an effective and easy-to-use Linux application security
|
| 104 | system.
|
| 105 |
|
| 106 | AppArmor proactively protects the operating system and applications from
|
| 107 | external or internal threats, even zero-day attacks, by enforcing good
|
| 108 | behavior and preventing both known and unknown application flaws from being
|
| 109 | exploited.
|
| 110 |
|
| 111 | AppArmor supplements the traditional Unix discretionary access control (DAC)
|
| 112 | model by providing mandatory access control (MAC). It has been included in
|
| 113 | the mainline Linux kernel since version 2.6.36 and its development has been
|
| 114 | supported by Canonical since 2009.")
|
| 115 | (license license:lgpl2.1)
|
| 116 | (supported-systems (filter (lambda (system)
|
| 117 | (string-suffix? "-linux" system))
|
| 118 | %supported-systems))))
|
| 119 |
|
| 120 | (define-public apparmor
|
| 121 | (let ((base libapparmor))
|
| 122 | (package
|
| 123 | (inherit base)
|
| 124 | (name "apparmor")
|
| 125 | (arguments
|
| 126 | (append
|
| 127 | (list #:make-flags
|
| 128 | #~(list (string-append "CC=" #$(cc-for-target))
|
| 129 | (string-append "DESTDIR=" #$output)
|
| 130 | "USE_SYSTEM=1"
|
| 131 | |
| 132 | "PYFLAKES=true"))
|
| 133 | (substitute-keyword-arguments arguments
|
| 134 | ((#:phases phases)
|
| 135 | #~(modify-phases #$phases
|
| 136 | (delete 'configure)
|
| 137 | |
| 138 | (replace 'change-directory
|
| 139 | (lambda _
|
| 140 | (chdir "binutils")))
|
| 141 |
|
| 142 | |
| 143 | (add-after 'install 'chdir-parser
|
| 144 | (lambda _
|
| 145 | (chdir "../parser")))
|
| 146 | (add-after 'chdir-parser 'patch-source-shebangs-parser
|
| 147 | (assoc-ref %standard-phases 'patch-source-shebangs))
|
| 148 | (add-after 'patch-source-shebangs-parser 'build-parser
|
| 149 | (assoc-ref %standard-phases 'build))
|
| 150 | (add-after 'build-parser 'check-parser
|
| 151 | (assoc-ref %standard-phases 'check))
|
| 152 | (add-after 'check-parser 'install-parser
|
| 153 | (assoc-ref %standard-phases 'install))
|
| 154 |
|
| 155 | |
| 156 | |
| 157 | |
| 158 | (add-after 'install-parser 'chdir-utils
|
| 159 | (lambda _
|
| 160 | (chdir "../utils")
|
| 161 | |
| 162 | |
| 163 | (substitute* "easyprof/easyprof.conf"
|
| 164 | (("/usr") #$output))))
|
| 165 | (add-after 'chdir-utils 'build-utils
|
| 166 | (assoc-ref %standard-phases 'build))
|
| 167 | (add-after 'build-utils 'install-utils
|
| 168 | (assoc-ref %standard-phases 'install))
|
| 169 |
|
| 170 | |
| 171 | |
| 172 | (add-after 'install-utils 'chdir-profiles
|
| 173 | (lambda _
|
| 174 | (chdir "../profiles")))
|
| 175 | (add-after 'chdir-profiles 'build-profiles
|
| 176 | (assoc-ref %standard-phases 'build))
|
| 177 | (add-after 'build-profiles 'install-profiles
|
| 178 | (assoc-ref %standard-phases 'install)))))))
|
| 179 | (propagated-inputs
|
| 180 | (list libapparmor))
|
| 181 | |
| 182 | (native-inputs
|
| 183 | (list bison flex gettext-minimal perl python python-setuptools which))
|
| 184 | (license license:gpl2))))
|
| 185 |
|
| 186 | (define-public pam-apparmor
|
| 187 | (let ((base apparmor))
|
| 188 | (package
|
| 189 | (inherit base)
|
| 190 | (name "pam-apparmor")
|
| 191 | (arguments
|
| 192 | (append
|
| 193 | (list #:tests? #f) |
| 194 | (substitute-keyword-arguments arguments
|
| 195 | ((#:phases phases)
|
| 196 | #~(modify-phases #$phases
|
| 197 | (delete 'chdir-parser)
|
| 198 | (delete 'chdir-utils)
|
| 199 | (delete 'chdir-profiles)
|
| 200 | (replace 'change-directory
|
| 201 | (lambda _
|
| 202 | (chdir "changehat/pam_apparmor"))))))))
|
| 203 | (native-inputs (list pkg-config perl which))
|
| 204 | (inputs (list libapparmor linux-pam))
|
| 205 | (license license:bsd-3))))
|