trident icon indicating copy to clipboard operation
trident copied to clipboard

Trouble adding GPG/PGP key using tcli

Open davedittrich opened this issue 6 years ago • 1 comments

I'm trying to pre-load users with Ansible, including adding the user's GPG/PGP key. It doesn't seem to work and the command help and error messages are unclear about how to proceed.

The help says this:

 pgp_add             <email> <keyring>    Add PGP key

An ASCII armored .asc file is usually not called a "keyring", but "Add PGP key" seems to suggests it wants a key file.

# tcli user email pgp_add [email protected] ~/dittrich.asc
An error occured: openpgp: invalid argument: no armored data found

The error message saying "no armored data found" would seem to confirm that an ASCII armored public key file is what it is expecting. The key is valid, as GPG will import it (and it has the email address as specified):

# gpg --import ~/dittrich.asc
gpg: directory `/root/.gnupg' created
gpg: new configuration file `/root/.gnupg/gpg.conf' created
gpg: WARNING: options in `/root/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: keyring `/root/.gnupg/pubring.gpg' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 945AB127: public key "Dave Dittrich <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

Taking a wild guess that it really does mean "keyring", let's try that.

root@purple:~# tcli user email pgp_add [email protected] /root/.gnupg/pubring.gpg
An error occured: openpgp: invalid argument: no armored data found

Had an idea this could be a line ending problem, so I tried dos2unix on the .asc file. Still no luck.

No idea what to do next or how to debug.

davedittrich avatar Jan 22 '18 23:01 davedittrich