isislovecruft / python-gnupg

A modified version of python-gnupg, including security patches, extensive documentation, and extra features.
Other
424 stars 172 forks source link

--no-use-agent passed to gpg2 by default #257

Open crashvb opened 5 years ago

crashvb commented 5 years ago

Noticed a comment in gnupg.py for the deprecated use of --[no-]use-agent flags with gpg2; however, they still appear to be used during the initialization of the class:

DEBUG    gnupg:_meta.py:423 GPGBase._homedir_setter(): got directory '/tmp/tmpugw190_r'
DEBUG    gnupg:_meta.py:426 GPGBase._homedir_setter(): Check existence of '/tmp/tmpugw190_r'
DEBUG    gnupg:_meta.py:433 GPGBase._homedir_setter(): checking permissions
INFO     gnupg:_meta.py:442 Setting homedir to '/tmp/tmpugw190_r'
DEBUG    gnupg:_parsers.py:441 Got arg string: --list-config
DEBUG    gnupg:_parsers.py:422 Got groups: {'--list-config': ''}
DEBUG    gnupg:_parsers.py:428 Appending option: --list-config
DEBUG    gnupg:_parsers.py:441 Got arg string: --with-colons
DEBUG    gnupg:_parsers.py:422 Got groups: {'--with-colons': ''}
DEBUG    gnupg:_parsers.py:428 Appending option: --with-colons
DEBUG    gnupg:_meta.py:603 Sending command to GnuPG process:
['/usr/bin/gpg2', '--no-options', '--no-emit-version', '--no-tty', '--status-fd', '2', '--homedir', '/tmp/tmpugw190_r', '--no-default-keyring', '--keyring', '/tmp/tmpugw190_r/pubring.gpg', '--secret-keyring', '/tmp/tmpugw190_r/secring.gpg', '--no-use-agent', '--list-config', '--with-colons']

Code to reproduce:

gpg = gnupg.GPG(homedir=Path(tempfile.mkdtemp()))
passphrase = "testing"
input_data = gpg.gen_key_input(
    name_email="Test", name_real="test@key.com", passphrase=passphrase
)
keyid = str(gpg.gen_key(input_data))
kwargs = {"default_key": keyid}
gpg.sign(
    b"TEST DATA", clearsign=False, detach=True, passphrase=passphrase, **kwargs
)

python-gnupg: gnupg-2.3.1 gnupg: 1.4.20-1ubuntu3.3 gnupg2: 2.1.11-6ubuntu2.1