saltstack / saltstack/salt

smtp returner: encryption via gpgowner option not working

Open
#54,721 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed good first issue severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

The smtp.gpgowner option is not working (anymore).

First error is that gpg will not accept the option "--trust-model always" this way:

2019-09-23 15:53:19,567 [salt.utils.event :1249][ERROR   ][28910] Could not store events - returner 'smtp.event_return' raised exception: Error invoking gpg: 2: [GNUPG:] FAILURE option-parser 33554433
gpg: invalid option "--trust-model always"

When changing the code so it reads "--trust-model=always" (added the "=") then it seems to work, but then this error occurs:

2019-09-23 16:23:02,499 [salt.utils.event :1249][ERROR   ][20550] Could not store events - returner 'smtp.event_return' raised exception: StringIO instance has no attribute 'encode'

Setup

GnuPG Version: 2.2.17
python gnupg: 0.4.3

master config snipped

event_return: smtp

event_return_whitelist:
  - salt/job/*/ret/*

smtp.fields: id,fun
...
smtp.gpgowner: /etc/salt

Anf with a valid gnupg home being in /etc/salt/.gnupg

Steps to Reproduce Issue

salt-call state.highstate

Versions Report
 # salt --versions-report
Salt Version:
           Salt: 2019.2.0

Dependency Versions:
           cffi: 1.11.4
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.2
          ioflo: Not Installed
         Jinja2: 2.10.1
        libgit2: 0.28.3
        libnacl: 1.6.1
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.1
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 3.6.6
   pycryptodome: Not Installed
         pygit2: 0.28.2
         Python: 2.7.15 (default, Aug 11 2019, 03:43:36)
   python-gnupg: 0.4.3
         PyYAML: 5.1
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2

System Versions:
           dist: gentoo 2.6
         locale: UTF-8
        machine: x86_64
        release: 4.9.74-grsecurity
         system: Linux
        version: Gentoo Base System 2.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the smtp.event_return returner and reproduce the reported failure with the shown smtp.gpgowner configuration and salt-call state.highstate. Trace the GnuPG option handling and StringIO encoding path; done means the returner can store events without either reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.