From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934621AbdKBWSx (ORCPT ); Thu, 2 Nov 2017 18:18:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41008 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934607AbdKBWSv (ORCPT ); Thu, 2 Nov 2017 18:18:51 -0400 Subject: Re: [PATCH 03/27] Enforce module signatures if the kernel is locked down From: Mimi Zohar To: David Howells Cc: linux-security-module@vger.kernel.org, gnomes@lxorguk.ukuu.org.uk, linux-efi@vger.kernel.org, matthew.garrett@nebula.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, jforbes@redhat.com Date: Thu, 02 Nov 2017 18:18:43 -0400 In-Reply-To: <14108.1509660067@warthog.procyon.org.uk> References: <1509658881.3416.10.camel@linux.vnet.ibm.com> <1509650031.3507.20.camel@linux.vnet.ibm.com> <1509130095.3716.13.camel@linux.vnet.ibm.com> <150842463163.7923.11081723749106843698.stgit@warthog.procyon.org.uk> <150842465546.7923.6762214527898273559.stgit@warthog.procyon.org.uk> <20240.1509643356@warthog.procyon.org.uk> <12321.1509658211@warthog.procyon.org.uk> <14108.1509660067@warthog.procyon.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 17110222-0016-0000-0000-000004FCEDCE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110222-0017-0000-0000-000028388006 Message-Id: <1509661123.3416.29.camel@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-02_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711020273 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-11-02 at 22:01 +0000, David Howells wrote: > Mimi Zohar wrote: > > > Right, it would never get here if the IMA signature verification > > fails.  If sig_enforce is not enabled, then it will also work.  So the > > only case is if sig_enforced is enabled and there is no key. > > > > eg. > >          else if (can_do_ima_check && is_ima_appraise_enabled()) > >                 err = 0; > > I'm not sure where you want to put that, but I can't just do this: > > /* Not having a signature is only an error if we're strict. */ > if (err == -ENOKEY && !sig_enforce && > (!can_do_ima_check || !is_ima_appraise_enabled()) && The above IMA checks aren't needed here. > !kernel_is_locked_down("Loading of unsigned modules")) > err = 0; > else if (can_do_ima_check && is_ima_appraise_enabled()) > err = 0; > > because that'll print out a message in lockdown mode saying that you're not > allowed to do that and then maybe do it anyway. Then at least for now, document that even though kernel modules might be signed and verified by IMA-appraisal, that in lockdown mode they also require an appended signature. Mimi From mboxrd@z Thu Jan 1 00:00:00 1970 From: zohar@linux.vnet.ibm.com (Mimi Zohar) Date: Thu, 02 Nov 2017 18:18:43 -0400 Subject: [PATCH 03/27] Enforce module signatures if the kernel is locked down In-Reply-To: <14108.1509660067@warthog.procyon.org.uk> References: <1509658881.3416.10.camel@linux.vnet.ibm.com> <1509650031.3507.20.camel@linux.vnet.ibm.com> <1509130095.3716.13.camel@linux.vnet.ibm.com> <150842463163.7923.11081723749106843698.stgit@warthog.procyon.org.uk> <150842465546.7923.6762214527898273559.stgit@warthog.procyon.org.uk> <20240.1509643356@warthog.procyon.org.uk> <12321.1509658211@warthog.procyon.org.uk> <14108.1509660067@warthog.procyon.org.uk> Message-ID: <1509661123.3416.29.camel@linux.vnet.ibm.com> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org On Thu, 2017-11-02 at 22:01 +0000, David Howells wrote: > Mimi Zohar wrote: > > > Right, it would never get here if the IMA signature verification > > fails. ?If sig_enforce is not enabled, then it will also work. ?So the > > only case is if sig_enforced is enabled and there is no key. > > > > eg. > > ? ? ? ? ?else if (can_do_ima_check && is_ima_appraise_enabled()) > > ? ? ? ? ? ? ? ? err = 0; > > I'm not sure where you want to put that, but I can't just do this: > > /* Not having a signature is only an error if we're strict. */ > if (err == -ENOKEY && !sig_enforce && > (!can_do_ima_check || !is_ima_appraise_enabled()) && The above IMA checks aren't needed here. > !kernel_is_locked_down("Loading of unsigned modules")) > err = 0; > else if (can_do_ima_check && is_ima_appraise_enabled()) > err = 0; > > because that'll print out a message in lockdown mode saying that you're not > allowed to do that and then maybe do it anyway. Then at least for now, document that even though kernel modules might be signed and verified by IMA-appraisal, that in lockdown mode they also require an appended signature. Mimi -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html