On Tue, Feb 04, 2014 at 12:37:14AM +0100, Alexander Hall wrote:
> On 02/04/14 00:27, Simon Drewitz wrote:
> >Hi misc@,
> >
> >I have set up mail(1) so that it forwards mails such as the output of
> >/etc/daily to my mail account and now I want to encrypt these mails
> >using my public gpg-key. The best solution I have come up with is
> >changing these two lines at the end of /etc/daily:
> >
> >- } 2>&1 | mail -s "`hostname` daily output" root
> >+ } 2>&1 | gpg2 --encrypt -r <key-ID> --armor | mail -s "`hostname` daily 
> >output" root
> >
> >...
> >
> >- [ -s $MAINOUT ] && mail -s "`hostname` daily insecurity output" root < 
> >$MAINOUT
> >+ [ -s $MAINOUT ] && gpg2 --encrypt -r <key-ID> --armor < $MAINOUT | mail -s 
> >"`hostname` daily insecurity output" root
> >
> >While it perfectly does what I want, I consider it bad habit to change
> >/etc/daily itself and would like to know if there is any preferred
> >solution to this issue?
> 
> add it to ~root/.forward file?
> 

or even better, add an alias for root to an unprivileged user and add it to
that user's ~/.forward so that gpg2 doesn't get executed as root :-)


-- 
Gilles Chehade

https://www.poolp.org                                          @poolpOrg

Reply via email to