logrotate, cron and gpg

mj lists at merit.unu.edu
Thu Apr 8 11:01:52 CEST 2021


Hi,

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

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

I do see various howto's that use gpg to encrypt their logfiles this 
way, for example: https://www.ctrl.blog/entry/gdpr-web-server-logs.html

So, we're asking the experts here: What could be our issue, and how to 
make this work..?

This is on debian 10.9

Thanks for any pointers!

MJ



More information about the Gnupg-users mailing list