summaryrefslogtreecommitdiffstats
path: root/kernel/Makefile
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 15:41:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 15:41:25 -0400
commitb793c005ceabf6db0b17494b0ec67ade6796bb34 (patch)
tree080c884f04254403ec9564742f591a9fd9b7e95a /kernel/Makefile
parent6f0a2fc1feb19bd142961a39dc118e7e55418b3f (diff)
parent07f081fb5057b2ea98baeca3a47bf0eb33e94aa1 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris: "Highlights: - PKCS#7 support added to support signed kexec, also utilized for module signing. See comments in 3f1e1bea. ** NOTE: this requires linking against the OpenSSL library, which must be installed, e.g. the openssl-devel on Fedora ** - Smack - add IPv6 host labeling; ignore labels on kernel threads - support smack labeling mounts which use binary mount data - SELinux: - add ioctl whitelisting (see http://kernsec.org/files/lss2015/vanderstoep.pdf) - fix mprotect PROT_EXEC regression caused by mm change - Seccomp: - add ptrace options for suspend/resume" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (57 commits) PKCS#7: Add OIDs for sha224, sha284 and sha512 hash algos and use them Documentation/Changes: Now need OpenSSL devel packages for module signing scripts: add extract-cert and sign-file to .gitignore modsign: Handle signing key in source tree modsign: Use if_changed rule for extracting cert from module signing key Move certificate handling to its own directory sign-file: Fix warning about BIO_reset() return value PKCS#7: Add MODULE_LICENSE() to test module Smack - Fix build error with bringup unconfigured sign-file: Document dependency on OpenSSL devel libraries PKCS#7: Appropriately restrict authenticated attributes and content type KEYS: Add a name for PKEY_ID_PKCS7 PKCS#7: Improve and export the X.509 ASN.1 time object decoder modsign: Use extract-cert to process CONFIG_SYSTEM_TRUSTED_KEYS extract-cert: Cope with multiple X.509 certificates in a single file sign-file: Generate CMS message as signature instead of PKCS#7 PKCS#7: Support CMS messages also [RFC5652] X.509: Change recorded SKID & AKID to not include Subject or Issuer PKCS#7: Check content type and versions MAINTAINERS: The keyrings mailing list has moved ...
Diffstat (limited to 'kernel/Makefile')
-rw-r--r--kernel/Makefile97
1 files changed, 0 insertions, 97 deletions
diff --git a/kernel/Makefile b/kernel/Makefile
index 718fb8afab7a..330387cfb730 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -45,7 +45,6 @@ ifneq ($(CONFIG_SMP),y)
45obj-y += up.o 45obj-y += up.o
46endif 46endif
47obj-$(CONFIG_UID16) += uid16.o 47obj-$(CONFIG_UID16) += uid16.o
48obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
49obj-$(CONFIG_MODULES) += module.o 48obj-$(CONFIG_MODULES) += module.o
50obj-$(CONFIG_MODULE_SIG) += module_signing.o 49obj-$(CONFIG_MODULE_SIG) += module_signing.o
51obj-$(CONFIG_KALLSYMS) += kallsyms.o 50obj-$(CONFIG_KALLSYMS) += kallsyms.o
@@ -112,99 +111,3 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
112targets += config_data.h 111targets += config_data.h
113$(obj)/config_data.h: $(obj)/config_data.gz FORCE 112$(obj)/config_data.h: $(obj)/config_data.gz FORCE
114 $(call filechk,ikconfiggz) 113 $(call filechk,ikconfiggz)
115
116###############################################################################
117#
118# Roll all the X.509 certificates that we can find together and pull them into
119# the kernel so that they get loaded into the system trusted keyring during
120# boot.
121#
122# We look in the source root and the build root for all files whose name ends
123# in ".x509". Unfortunately, this will generate duplicate filenames, so we
124# have make canonicalise the pathnames and then sort them to discard the
125# duplicates.
126#
127###############################################################################
128ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y)
129X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
130X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += $(objtree)/signing_key.x509
131X509_CERTIFICATES-raw := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
132 $(or $(realpath $(CERT)),$(CERT))))
133X509_CERTIFICATES := $(subst $(realpath $(objtree))/,,$(X509_CERTIFICATES-raw))
134
135ifeq ($(X509_CERTIFICATES),)
136$(warning *** No X.509 certificates found ***)
137endif
138
139ifneq ($(wildcard $(obj)/.x509.list),)
140ifneq ($(shell cat $(obj)/.x509.list),$(X509_CERTIFICATES))
141$(warning X.509 certificate list changed to "$(X509_CERTIFICATES)" from "$(shell cat $(obj)/.x509.list)")
142$(shell rm $(obj)/.x509.list)
143endif
144endif
145
146kernel/system_certificates.o: $(obj)/x509_certificate_list
147
148quiet_cmd_x509certs = CERTS $@
149 cmd_x509certs = cat $(X509_CERTIFICATES) /dev/null >$@ $(foreach X509,$(X509_CERTIFICATES),; $(kecho) " - Including cert $(X509)")
150
151targets += $(obj)/x509_certificate_list
152$(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list
153 $(call if_changed,x509certs)
154
155targets += $(obj)/.x509.list
156$(obj)/.x509.list:
157 @echo $(X509_CERTIFICATES) >$@
158endif
159
160clean-files := x509_certificate_list .x509.list
161
162ifeq ($(CONFIG_MODULE_SIG),y)
163###############################################################################
164#
165# If module signing is requested, say by allyesconfig, but a key has not been
166# supplied, then one will need to be generated to make sure the build does not
167# fail and that the kernel may be used afterwards.
168#
169###############################################################################
170ifndef CONFIG_MODULE_SIG_HASH
171$(error Could not determine digest type to use from kernel config)
172endif
173
174signing_key.priv signing_key.x509: x509.genkey
175 @echo "###"
176 @echo "### Now generating an X.509 key pair to be used for signing modules."
177 @echo "###"
178 @echo "### If this takes a long time, you might wish to run rngd in the"
179 @echo "### background to keep the supply of entropy topped up. It"
180 @echo "### needs to be run as root, and uses a hardware random"
181 @echo "### number generator if one is available."
182 @echo "###"
183 openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
184 -batch -x509 -config x509.genkey \
185 -outform DER -out signing_key.x509 \
186 -keyout signing_key.priv 2>&1
187 @echo "###"
188 @echo "### Key pair generated."
189 @echo "###"
190
191x509.genkey:
192 @echo Generating X.509 key generation config
193 @echo >x509.genkey "[ req ]"
194 @echo >>x509.genkey "default_bits = 4096"
195 @echo >>x509.genkey "distinguished_name = req_distinguished_name"
196 @echo >>x509.genkey "prompt = no"
197 @echo >>x509.genkey "string_mask = utf8only"
198 @echo >>x509.genkey "x509_extensions = myexts"
199 @echo >>x509.genkey
200 @echo >>x509.genkey "[ req_distinguished_name ]"
201 @echo >>x509.genkey "#O = Unspecified company"
202 @echo >>x509.genkey "CN = Build time autogenerated kernel key"
203 @echo >>x509.genkey "#emailAddress = unspecified.user@unspecified.company"
204 @echo >>x509.genkey
205 @echo >>x509.genkey "[ myexts ]"
206 @echo >>x509.genkey "basicConstraints=critical,CA:FALSE"
207 @echo >>x509.genkey "keyUsage=digitalSignature"
208 @echo >>x509.genkey "subjectKeyIdentifier=hash"
209 @echo >>x509.genkey "authorityKeyIdentifier=keyid"
210endif