2017-01-09 03:13:42 +00:00
|
|
|
From 5a1ce004b60d449f82d5f4a950ef3255024e1c1c Mon Sep 17 00:00:00 2001
|
2016-04-21 00:29:09 +00:00
|
|
|
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
|
|
|
|
<marmarek@invisiblethingslab.com>
|
|
|
|
Date: Thu, 21 Apr 2016 13:46:33 +0200
|
2017-01-09 03:13:42 +00:00
|
|
|
Subject: [PATCH 2/3] verify packages signature
|
2016-04-21 00:29:09 +00:00
|
|
|
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
|
2017-01-09 03:13:42 +00:00
|
|
|
index 429c1c1..28b7ff9 100644
|
2016-04-21 00:29:09 +00:00
|
|
|
--- a/src/pylorax/ltmpl.py
|
|
|
|
+++ b/src/pylorax/ltmpl.py
|
2017-01-09 03:13:42 +00:00
|
|
|
@@ -624,6 +624,24 @@ class LoraxTemplateRunner(object):
|
2016-04-21 00:29:09 +00:00
|
|
|
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()
|
|
|
|
--
|
2017-01-09 03:13:42 +00:00
|
|
|
2.7.4
|
2016-04-21 00:29:09 +00:00
|
|
|
|