|
|
07a10e |
diff -up yum-3.4.3/docs/yum.conf.5.orig yum-3.4.3/docs/yum.conf.5
|
|
|
07a10e |
--- yum-3.4.3/docs/yum.conf.5.orig 2017-03-23 13:48:19.700471026 +0100
|
|
|
07a10e |
+++ yum-3.4.3/docs/yum.conf.5 2017-03-23 13:48:21.455461060 +0100
|
|
|
07a10e |
@@ -105,6 +105,31 @@ signature check on the repodata. When th
|
|
|
07a10e |
default for all repositories. The default is `0'.
|
|
|
07a10e |
|
|
|
07a10e |
.IP
|
|
|
07a10e |
+\fBpayload_gpgcheck\fR
|
|
|
07a10e |
+Either `1' or `0'. This tells yum whether or not it should also perform a GPG
|
|
|
07a10e |
+signature check on the payload (part of a package holding the actual files that
|
|
|
07a10e |
+comprise the package).
|
|
|
07a10e |
+
|
|
|
07a10e |
+By default, yum only performs GPG signature checks on package headers.
|
|
|
07a10e |
+Thus, if the payload data has been tampered with or corrupted, yum will fail in
|
|
|
07a10e |
+the middle of the transaction due to an RPM unpacking error, after some
|
|
|
07a10e |
+unverified scriptlets might have already run, and possibly leave the package in
|
|
|
07a10e |
+question partly installed.
|
|
|
07a10e |
+
|
|
|
07a10e |
+To prevent all of that, you can enable this option to extend the signature
|
|
|
07a10e |
+check to also include the payload, so that yum can avoid running the
|
|
|
07a10e |
+transaction in case of payload corruption.
|
|
|
07a10e |
+This slightly improves security, however at the expense of significantly
|
|
|
07a10e |
+increased transaction time, so you may want to only use this option when
|
|
|
07a10e |
+package corruption is a concern.
|
|
|
07a10e |
+
|
|
|
07a10e |
+For this option to have effect, make sure to also enable gpgcheck (or
|
|
|
07a10e |
+localpkg_gpgcheck for local packages).
|
|
|
07a10e |
+
|
|
|
07a10e |
+When this option is set in the [main] section it sets the default for all
|
|
|
07a10e |
+repositories. The default is `0'.
|
|
|
07a10e |
+
|
|
|
07a10e |
+.IP
|
|
|
07a10e |
\fBskip_broken\fR
|
|
|
07a10e |
Either `1' or `0'. Resolve depsolve problems by removing packages that
|
|
|
07a10e |
are causing problems from the transaction.
|
|
|
07a10e |
diff -up yum-3.4.3/rpmUtils/miscutils.py.orig yum-3.4.3/rpmUtils/miscutils.py
|
|
|
07a10e |
--- yum-3.4.3/rpmUtils/miscutils.py.orig 2011-06-28 22:27:22.000000000 +0200
|
|
|
07a10e |
+++ yum-3.4.3/rpmUtils/miscutils.py 2017-03-23 13:48:21.455461060 +0100
|
|
|
07a10e |
@@ -58,11 +58,16 @@ def compareVerOnly(v1, v2):
|
|
|
07a10e |
"""compare version strings only using rpm vercmp"""
|
|
|
07a10e |
return compareEVR(('', v1, ''), ('', v2, ''))
|
|
|
07a10e |
|
|
|
07a10e |
-def checkSig(ts, package):
|
|
|
07a10e |
- """Takes a transaction set and a package, check it's sigs,
|
|
|
07a10e |
+def checkSig(ts, package, payload=False):
|
|
|
07a10e |
+ """Takes a transaction set and a package, check it's sigs.
|
|
|
07a10e |
+
|
|
|
07a10e |
+ By default, only RPMv4 sigs (header-only) will be verified (faster). By
|
|
|
07a10e |
+ setting payload to True, RPMv3 sigs (header+payload) will also be verified
|
|
|
07a10e |
+ (slower).
|
|
|
07a10e |
+
|
|
|
07a10e |
return 0 if they are all fine
|
|
|
07a10e |
return 1 if the gpg key can't be found
|
|
|
07a10e |
- return 2 if the header is in someway damaged
|
|
|
07a10e |
+ return 2 if the header or payload is in someway damaged
|
|
|
07a10e |
return 3 if the key is not trusted
|
|
|
07a10e |
return 4 if the pkg is not gpg or pgp signed"""
|
|
|
07a10e |
|
|
|
07a10e |
@@ -89,6 +94,24 @@ def checkSig(ts, package):
|
|
|
07a10e |
else:
|
|
|
07a10e |
del hdr
|
|
|
07a10e |
|
|
|
07a10e |
+ # Don't perform the payload check if the header check failed, otherwise we
|
|
|
07a10e |
+ # could mask the reason stored in "value" (we only return one integer from
|
|
|
07a10e |
+ # this function and shouldn't change that).
|
|
|
07a10e |
+ if payload and value == 0:
|
|
|
07a10e |
+ os.lseek(fdno, 0, 0)
|
|
|
07a10e |
+ # We don't want the OK message to pollute the output but we do want the
|
|
|
07a10e |
+ # BAD message (verbose version) in case of a failure, which is only
|
|
|
07a10e |
+ # possible by running _verifySigs() twice (temporary hack until we have
|
|
|
07a10e |
+ # the proper API for payload verification in RPM).
|
|
|
07a10e |
+ rpm.setVerbosity(rpm.RPMLOG_WARNING)
|
|
|
07a10e |
+ valid = ts._verifySigs(fdno, package)
|
|
|
07a10e |
+ if not valid:
|
|
|
07a10e |
+ value = 2
|
|
|
07a10e |
+ os.lseek(fdno, 0, 0)
|
|
|
07a10e |
+ rpm.setVerbosity(rpm.RPMLOG_INFO)
|
|
|
07a10e |
+ ts._verifySigs(fdno, package)
|
|
|
07a10e |
+ rpm.setVerbosity(rpm.RPMLOG_NOTICE)
|
|
|
07a10e |
+
|
|
|
07a10e |
try:
|
|
|
07a10e |
os.close(fdno)
|
|
|
07a10e |
except OSError, e: # if we're not opened, don't scream about it
|
|
|
07a10e |
diff -up yum-3.4.3/rpmUtils/transaction.py.orig yum-3.4.3/rpmUtils/transaction.py
|
|
|
07a10e |
--- yum-3.4.3/rpmUtils/transaction.py.orig 2017-03-23 13:48:19.441472497 +0100
|
|
|
07a10e |
+++ yum-3.4.3/rpmUtils/transaction.py 2017-03-23 13:48:21.455461060 +0100
|
|
|
07a10e |
@@ -35,7 +35,8 @@ class TransactionWrapper:
|
|
|
07a10e |
'setProbFilter',
|
|
|
07a10e |
'hdrFromFdno',
|
|
|
07a10e |
'next',
|
|
|
07a10e |
- 'clean']
|
|
|
07a10e |
+ 'clean',
|
|
|
07a10e |
+ '_verifySigs']
|
|
|
07a10e |
self.tsflags = []
|
|
|
07a10e |
self.open = True
|
|
|
07a10e |
|
|
|
07a10e |
diff -up yum-3.4.3/yum/config.py.orig yum-3.4.3/yum/config.py
|
|
|
07a10e |
--- yum-3.4.3/yum/config.py.orig 2017-03-23 13:48:19.701471020 +0100
|
|
|
07a10e |
+++ yum-3.4.3/yum/config.py 2017-03-23 13:48:21.456461055 +0100
|
|
|
07a10e |
@@ -46,6 +46,7 @@ from misc import get_uuid, read_in_items
|
|
|
07a10e |
# Alter/patch these to change the default checking...
|
|
|
07a10e |
__pkgs_gpgcheck_default__ = False
|
|
|
07a10e |
__repo_gpgcheck_default__ = False
|
|
|
07a10e |
+__payload_gpgcheck_default__ = False
|
|
|
07a10e |
__main_multilib_policy_default__ = 'all'
|
|
|
07a10e |
__main_failovermethod_default__ = 'roundrobin'
|
|
|
07a10e |
__main_installonly_limit_default__ = 0
|
|
|
07a10e |
@@ -786,6 +787,7 @@ class YumConf(StartupConf):
|
|
|
07a10e |
gpgcheck = BoolOption(__pkgs_gpgcheck_default__)
|
|
|
07a10e |
repo_gpgcheck = BoolOption(__repo_gpgcheck_default__)
|
|
|
07a10e |
localpkg_gpgcheck = BoolOption(__pkgs_gpgcheck_default__)
|
|
|
07a10e |
+ payload_gpgcheck = BoolOption(__payload_gpgcheck_default__)
|
|
|
07a10e |
obsoletes = BoolOption(True)
|
|
|
07a10e |
showdupesfromrepos = BoolOption(False)
|
|
|
07a10e |
enabled = BoolOption(True)
|
|
|
07a10e |
diff -up yum-3.4.3/yum/__init__.py.orig yum-3.4.3/yum/__init__.py
|
|
|
07a10e |
--- yum-3.4.3/yum/__init__.py.orig 2017-03-23 13:48:19.731470850 +0100
|
|
|
07a10e |
+++ yum-3.4.3/yum/__init__.py 2017-03-23 13:48:21.456461055 +0100
|
|
|
07a10e |
@@ -2755,7 +2755,9 @@ much more problems).
|
|
|
07a10e |
|
|
|
07a10e |
if check:
|
|
|
07a10e |
ts = self.rpmdb.readOnlyTS()
|
|
|
07a10e |
- sigresult = rpmUtils.miscutils.checkSig(ts, po.localPkg())
|
|
|
07a10e |
+ sigresult = rpmUtils.miscutils.checkSig(
|
|
|
07a10e |
+ ts, po.localPkg(), payload=self.conf.payload_gpgcheck,
|
|
|
07a10e |
+ )
|
|
|
07a10e |
localfn = os.path.basename(po.localPkg())
|
|
|
07a10e |
|
|
|
07a10e |
if sigresult == 0:
|