Skip to content
Snippets Groups Projects
Commit 74e04b7e authored by Greg Becker's avatar Greg Becker Committed by Peter Scheibel
Browse files

Config option to allow gpg warning suppression (#13744)

Add a configuration option to suppress gpg warnings during binary
package verification. This only suppresses warnings: a gpg failure
will still fail the install. This allows users who have already
explicitly trusted the gpg key they are using to avoid seeing
repeated warnings that it is self-signed.
parent 28163cb3
No related branches found
No related tags found
No related merge requests found
...@@ -80,6 +80,14 @@ config: ...@@ -80,6 +80,14 @@ config:
verify_ssl: true verify_ssl: true
# Suppress gpg warnings from binary package verification
# Only suppresses warnings, gpg failure will still fail the install
# Potential rationale to set True: users have already explicitly trusted the
# gpg key they are using, and may not want to see repeated warnings that it
# is self-signed or something of the sort.
suppress_gpg_warnings: false
# If set to true, Spack will attempt to build any compiler on the spec # If set to true, Spack will attempt to build any compiler on the spec
# that is not already available. If set to False, Spack will only use # that is not already available. If set to False, Spack will only use
# compilers already configured in compilers.yaml # compilers already configured in compilers.yaml
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
from llnl.util.filesystem import mkdirp, install_tree from llnl.util.filesystem import mkdirp, install_tree
import spack.cmd import spack.cmd
import spack.config as config
import spack.fetch_strategy as fs import spack.fetch_strategy as fs
import spack.util.gpg as gpg_util import spack.util.gpg as gpg_util
import spack.relocate as relocate import spack.relocate as relocate
...@@ -592,7 +593,8 @@ def extract_tarball(spec, filename, allow_root=False, unsigned=False, ...@@ -592,7 +593,8 @@ def extract_tarball(spec, filename, allow_root=False, unsigned=False,
if not unsigned: if not unsigned:
if os.path.exists('%s.asc' % specfile_path): if os.path.exists('%s.asc' % specfile_path):
try: try:
Gpg.verify('%s.asc' % specfile_path, specfile_path) suppress = config.get('config:suppress_gpg_warnings', False)
Gpg.verify('%s.asc' % specfile_path, specfile_path, suppress)
except Exception as e: except Exception as e:
shutil.rmtree(tmpdir) shutil.rmtree(tmpdir)
tty.die(e) tty.die(e)
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
'source_cache': {'type': 'string'}, 'source_cache': {'type': 'string'},
'misc_cache': {'type': 'string'}, 'misc_cache': {'type': 'string'},
'verify_ssl': {'type': 'boolean'}, 'verify_ssl': {'type': 'boolean'},
'suppress_gpg_warnings': {'type': 'boolean'},
'install_missing_compilers': {'type': 'boolean'}, 'install_missing_compilers': {'type': 'boolean'},
'debug': {'type': 'boolean'}, 'debug': {'type': 'boolean'},
'checksum': {'type': 'boolean'}, 'checksum': {'type': 'boolean'},
......
...@@ -100,8 +100,11 @@ def sign(cls, key, file, output, clearsign=False): ...@@ -100,8 +100,11 @@ def sign(cls, key, file, output, clearsign=False):
cls.gpg()(*args) cls.gpg()(*args)
@classmethod @classmethod
def verify(cls, signature, file): def verify(cls, signature, file, suppress_warnings=False):
cls.gpg()('--verify', signature, file) if suppress_warnings:
cls.gpg()('--verify', signature, file, error=str)
else:
cls.gpg()('--verify', signature, file)
@classmethod @classmethod
def list(cls, trusted, signing): def list(cls, trusted, signing):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment