logrotate, cron and gpg
m at the13thletter.info
Thu Apr 8 13:51:15 CEST 2021
Thus spoke mj:
> We are trying to encrypt log files via logrotate & cron, and I hope
> someone here can help out a bit.
> Our logrotate configuration file contains:
>> olddir gpg/
>> compresscmd /usr/bin/gpg
>> compressoptions -vv --verbose --encrypt --default-key A4DB7xxxD98
>> compressext .gpg
> Now, when logrotates runs the above from cron, we're getting:
>> gpg: cannot open '/dev/tty': No such device or address
>> error: failed to compress log /logrotate/gpg//test.log.1
When I run the command
gpg -vv --verbose --encrypt --default-key 0x... < /dev/null
GnuPG prompts me for a recipient. Without a TTY, such a prompt would
fail, of course. So presumably, instead of --default-key, you actually
want -r instead...?
Also: why are you using both -vv and --verbose at the same time?
> We know --no-tty exists, but it doesn't help in this case, because
> when using that:
>> gpg: Sorry, no terminal at all requested - can't get input
See above. You probably also want --batch as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 228 bytes
Desc: OpenPGP digital signature
More information about the Gnupg-users