qubes-installer-qubes-os/lorax/0002-verify-packages-signature.patch

49 lines
1.8 KiB
Diff
Raw Normal View History

From 5a1ce004b60d449f82d5f4a950ef3255024e1c1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
<marmarek@invisiblethingslab.com>
Date: Thu, 21 Apr 2016 13:46:33 +0200
Subject: [PATCH 2/3] verify packages signature
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
src/pylorax/ltmpl.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/pylorax/ltmpl.py b/src/pylorax/ltmpl.py
index 429c1c1..28b7ff9 100644
--- a/src/pylorax/ltmpl.py
+++ b/src/pylorax/ltmpl.py
@@ -624,6 +624,24 @@ class LoraxTemplateRunner(object):
logger.error("Failed to download the following packages: %s", e)
raise
+ try:
+ for po in pkgs_to_download:
+ # before doing anything with the package, verify its signature
+ result, errmsg = self.dbo.sigCheckPkg(po)
+ if result == 0:
+ # Verified ok, or verify not req'd
+ pass
+ elif result == 1:
+ # keys are provided through kickstart, so treat this as consent
+ # for importing them
+ self.dbo.getKeyForPackage(po, lambda x, y, z: True)
+ else:
+ # Fatal error
+ raise dnf.exceptions.Error(errmsg)
+ except dnf.exceptions.Error as e:
+ logger.error("Failed to verify signature: %s", e)
+ raise
+
logger.info("Preparing transaction from installation source")
try:
display = LoraxRpmCallback()
--
2.7.4