Rake task with login and password in crontab

Added by Vincent B almost 6 years ago

It concerns this wiki page : RedmineReceivingEmails
I run a cron job like :

*/30 * * * * redmineuser rake -f /path/to/redmine/appdir/Rakefile redmine:email:receive_imap RAILS_ENV="production" host=imap.foo.bar username=redmine@somenet.foo password=xxx

Can you hide the password and put it in a file for example? It would be more secure, the login/password is in clear in logs.

My environment : Redmine 2.3.3, Ruby 1.9.4

Replies (1)

RE: Rake task with login and password in crontab - Added by Jean-Baptiste Barth almost 6 years ago

Nothing to do on the redmine side, you can already do something like this with subshells, but I don't know how it will be logged :

rake redmine:email:receive_imap RAILS_ENV="production" host=imap.foo.bar username=redmine@somenet.foo password=$(cat /etc/redmine_password)

Or you can source /etc/redmine.env; before the command, and put in "/etc/redmine.env" something like :

export username=john
export password=secret

so you can ommit all this on the command-line.

(1-1/1)