I am using gpg to encrypt my email password that I pass on to msmtp in order to send email.
I initially ran gpg --full-gen-key
to generate a pair of keys. During the process, it asked me for a passphrase. The process has completed successfully.
Secondly, I encrypted my email password by running gpg --encrypt --output ~/.msmtp/msmtp-myaccount-pass.gpg --recipient my@gpg-email -
I configured msmtp to use passwordeval
and tried a to send a test email. While sending, gpg asked me to enter the passphrase. This was done and the email was sent successfully.
Now, I would like to send system reports email to myself from this headless raspberry pi server and in order to do that I am building a script which will be run by cron
. Given that the server will be unattended, the passphrase needs to be cached and I understood that the safest way to do that is by using gpg-agent
.
In order to use gpg-agent
, I need to edit ~/.gnupg/gpg.conf
and add use-agent
. I also need to edit gpg-agent.conf
to customise the caching period. This is where I have reached a dead-end.
I cannot find the file gpg-conf
nor the file gpg-agent.conf
.
When I list the .gnupg
directory, I get:
drwx------ 2 pi pi 4096 Apr 5 22:11 crls.d
drwx------ 2 pi pi 4096 Apr 5 22:15 openpgp-revocs.d
drwx------ 2 pi pi 4096 Apr 5 22:15 private-keys-v1.d
-rw-r--r-- 1 pi pi 2475 Apr 5 22:15 pubring.kbx
-rw------- 1 pi pi 32 Apr 5 22:11 pubring.kbx~
-rw------- 1 pi pi 600 Apr 5 22:43 random_seed
-rw------- 1 pi pi 1280 Apr 5 22:18 trustdb.gpg
I confirm that gpg-agent
is running as a process.
I looked for a solution online and some suggest to copy skeleton files from /usr/share/gnupg
but no skeleton files available as per below:
distsigkey.gpg help.de.txt help.fi.txt help.it.txt help.pt_BR.txt help.tr.txt
help.be.txt help.el.txt help.fr.txt help.ja.txt help.ro.txt help.zh_CN.txt
help.ca.txt help.eo.txt help.gl.txt help.nb.txt help.ru.txt help.zh_TW.txt
help.cs.txt help.es.txt help.hu.txt help.pl.txt help.sk.txt sks-keyservers.netCA.pem
help.da.txt help.et.txt help.id.txt help.pt.txt help.sv.txt
I would be grateful if you could assist me in configuring gpg-agent
regarding the cache time for the passphrase.
For reference, I am using Raspbian Buster on a Raspberry Pi 2 Model B.
Thanks in advance.