logrotate, cron and gpg
Marco Ricci
m at the13thletter.info
Thu Apr 8 13:51:15 CEST 2021
Hi mj.
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/
>> compress
>> 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.
Cheers,
Marco
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20210408/eda4093a/attachment.sig>
More information about the Gnupg-users
mailing list