aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2021-03-20 14:54:14 +0100
committerPapoteur <papoteur@mageia.org>2021-03-20 14:54:14 +0100
commite82e78593fa490fe3829c36e4d2199b031fb4003 (patch)
treeb25676da6cee27f4fac8abb47d4265bc8fb179cb /backend
parentf7eb28ed86ede5f0f75f400351a652683b937c95 (diff)
parentace8a168e50c6608ffc0a88bf78f306182815365 (diff)
downloadisodumper-e82e78593fa490fe3829c36e4d2199b031fb4003.tar
isodumper-e82e78593fa490fe3829c36e4d2199b031fb4003.tar.gz
isodumper-e82e78593fa490fe3829c36e4d2199b031fb4003.tar.bz2
isodumper-e82e78593fa490fe3829c36e4d2199b031fb4003.tar.xz
isodumper-e82e78593fa490fe3829c36e4d2199b031fb4003.zip
Merge branch 'master' into topic/newgui
Diffstat (limited to 'backend')
-rwxr-xr-xbackend/raw_write.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/backend/raw_write.py b/backend/raw_write.py
index fefa9b1..03405bd 100755
--- a/backend/raw_write.py
+++ b/backend/raw_write.py
@@ -27,6 +27,7 @@ import gettext
import hashlib
import io
import logging
+import datetime
###########
# imports #
###########
@@ -137,11 +138,18 @@ class Dumper(object):
self.sum_type = 'sha3'
sig_file = "{}.{}.gpg".format(source, self.sum_type)
self.source_file = "{}.{}".format(source, self.sum_type)
+ keys_list = gpg.list_keys()
+ key_present = False
+ for entry in keys_list:
+ if (mageia_keyid == entry['keyid']):
+ if entry['expires'] and (datetime.datetime.now().timestamp() > float(entry['expires'])):
+ logging.info("Mageia key expired, reloading")
+ else:
+ logging.info("Mageia key already present")
+ key_present = True
+ break
try:
- keys_list = gpg.list_keys()
- if mageia_keyid in [entry['keyid'] for entry in keys_list]:
- logging.info("Mageia key already present")
- else:
+ if not key_present:
gpg.recv_keys('pool.sks-keyservers.net', mageia_keyid)
self.sum_check_searched = True
with open(sig_file, 'rb') as g:
@@ -159,10 +167,11 @@ class Dumper(object):
logging.debug("Detached signature is OK")
else:
self.signature_checked = False
- logging.debug("Signature is false")
- except:
+ logging.warning("Signature is false")
+ except Exception as e:
self.signature_found = False
- logging.info(_("Signature file {} not found\n").format(sig_file))
+ logging.error(str(e))
+ logging.info(_("Signature file {} not found\n" + _("or key expired")).format(sig_file))
try:
# Look for sum files in the same directory as source
with open(self.source_file,'r') as fs:
@@ -197,7 +206,7 @@ class Dumper(object):
block = f.read(b-ncuts*1024)
sha512func.update(block)
sha512sumcalc=sha512func.hexdigest().upper()
- f.close()
+ #f.close()
self.return_state = True
if self.signature_found and not self.signature_checked:
#, keep the pourcent, this is the place for source file name
@@ -212,7 +221,7 @@ class Dumper(object):
self.return_message +="\n" + _("The {} sum check is OK and the sum is signed").format(self.sum_type)
else :
if self.signature_found:
- self.return_message +="\n" + _("The signature of the sum is false !").format(self.sum_type)
+ self.return_message +="\n" + _("The validation of the GPG signature failed !") + "\n" + _("The integrity of the ISO image could not be verified.")
self.return_state = False
else:
#, keep the bracket, this is the place for sum type