Bug 841588

Summary: symmetric encryption exits with non-zero exit code
Product: Red Hat Enterprise Linux 7 Reporter: Ondrej Moriš <omoris>
Component: gnupg2Assignee: Tomas Mraz <tmraz>
Status: CLOSED DEFERRED QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0CC: rcritten
Target Milestone: betaKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-02 12:12:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1110706, 1191020    

Description Ondrej Moriš 2012-07-19 13:49:24 UTC
Description of problem:

Symmetric encryption in GnuPG2 exits with non-zero exit code (2) even though ecryption itself proceeds correctly (text is encrypted well). Whenever one tries to encrypt a text using a trusted key, the side-effect is as follows:

gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running

And exit code is 2.

Asymmetric encryption / decryption works fine (exit code 0).

Version-Release number of selected component (if applicable):

gnupg2-2.0.18-3.el7

How reproducible:

100%

Steps to Reproduce:
gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running

1. Import some key into gnupg2 and make sure it is trusted
2. Encrypt some file, eg.:

   gpg2 --homedir ./.gnupg --batch --local-user bob-rsa-1024 --passphrase
     password --output binary.msg-rsa-1024-3DES --cipher-algo 3DES 
     --symmetric binary.msg

Actual results:

gpg: can't connect to the agent: Invalid value passed to IPC
gpg: problem with the agent: No agent running
[exit code 2]


Expected results:

[exit code 0]

Additional info:

Comment 1 Tomas Mraz 2012-07-19 14:05:09 UTC
Reported upstream as https://bugs.g10code.com/gnupg/issue1427

Comment 2 Tomas Mraz 2012-07-19 14:36:51 UTC
Actually not a bug.

The command line arguments do not make much sense. The proper line is:

gpg2 --batch --passphrase password --output binary.msg.encrypted --cipher-algo 3DES --symmetric binary.msg

The incorrect specification of --homedir is what causes the problem.

Comment 3 Ondrej Moriš 2012-07-24 06:20:22 UTC
(In reply to comment #2)
> Actually not a bug.
> 
> The command line arguments do nThis is confusing? ot make much sense. The proper line is:
> 
> gpg2 --batch --passphrase password --output binary.msg.encrypted
> --cipher-algo 3DES --symmetric binary.msg
> 
> The incorrect specification of --homedir is what causes the problem.

This is confusing - is "--homedir" prohibited in RHEL7? I do not want to use the default homedir on purpose. Moreover, this worked fine on RHEL6...

Comment 4 Tomas Mraz 2012-07-24 09:06:21 UTC
You're right that with RHEL-6 it worked fine. But there was failure running agent as well just unreported in the exit code.

I'll reopen the upstream bug report with more details.

What works for me:

1. start the gpg-agent with the homedir specified as absolute path:
gpg-agent --homedir $(pwd)/.gnupg --use-standard-socket --daemon
2. run gpg2 as you need
gpg2 --homedir $(pwd)/.gnupg --batch --passphrase password --output binary.msg.encrypted --cipher-algo 3DES --symmetric binary.msg

So there are 2 problems:
1. homedir must be absolute path not relative
2. homedir is not forwarded to the gpg-agent when it is started up by gpg2

Comment 5 Ondrej Moriš 2012-07-24 11:41:25 UTC
Thanks a lot for this explanation, I have corrected my tests and they work now. Nevertheless, it would be nice to have both points you mentioned corrected even though they actually might not be "real" bugs. Let's see what the upstream will tell us.

Comment 6 Tomas Mraz 2012-07-24 11:53:43 UTC
Well at least the item 2. from above is a real bug. The item 1. might be considered as missing feature.

Comment 9 Tomas Mraz 2012-11-12 13:39:14 UTC
Unfortunately there is no reaction from upstream yet.

Comment 10 Tomas Mraz 2012-12-05 21:59:50 UTC
*** Bug 884264 has been marked as a duplicate of this bug. ***

Comment 11 Tomas Mraz 2013-08-09 13:45:42 UTC
Still no reaction from upstream https://bugs.g10code.com/gnupg/issue1427