Joined: 22 May 2007
|Posted: Wed Jul 12, 2017 6:46 pm Post subject: Getting automysqlbackup and duplicity to work
I'm posting this in case someone faces the same issue and for my self to find the solution in case I forget how I fixed it.
Also it seems that there aren't any problems when not using SELinux (though I could be wrong).
Aside from the usual policy problems (which I fixed by using audit2allow -a and compiling my own policy), there seems to be an issue with cron when using SELinux.
When you launch automysqlbackup and duplicity from command line, it will execute properly, but it won't execute properly from cron, even when running the cronjob as root.
For some reasons when you specify in your /etc/crontab "HOME=/", then the cron daemon will try to find some needed files in "/" not "/root".
For most cronjobs this is not an issue, but duplicity needs to find the PGP key files, which are inside /root/ if you created them as root.
Also if you are using login path instead of plain text login in automysqlbackup, then it will try to locate the .mylogin.cnf file, which is created in /root/, again if you ran mysql_config_editor as root.
Some other cronjobs require to use "HOME=/", so my solution is very simple:
|cp /root/.gnupg /.gnupg -r
cp /root/.mylogin.cnf /.mylogin.cnf
cp /root/.passphrase /.passphrase
Also I changed the duplicity cronjob to the new .passphrase location:
(in /etc/cron.daily/duplicity and /etc/cron.weekly/duplicity.full)
And everything starts working!
Home this helps someone!
If someone has some comments, I would like to hear them, since this might not be the safest nor best solution.