I have installed Gitlab 8.15 and Exim 4.84 on CentOS 7
Whenever Gitlab sends a message, it should come from '[email protected]' which is correctly set in config/gitlab.yml.
If I look in the log, I see the following:
2016-12-21 21:50:02 cwd=/ 6 args: /usr/sbin/sendmail -i -f [email protected] -- [email protected]
2016-12-21 21:50:02 1cJnpq-0001ZR-NG <= [email protected] U=git P=local S=3859 [email protected] T="Reset password instructions" from <[email protected]> for [email protected]
Note that between those 2 lines, the from address changed from [email protected] to [email protected] which is based on user@FQDN.
My external SMTP server then does a DKIM and SPF lookup on vps.mydomain.nl, instead of mydomain.nl, which fails and the mail is rejected.
I am not sure where this change happens and how I should fix this. Is this something on Gitlab side or something on Exim side?
The relevant parts from my exim configuration:
begin routers
mysmtphost_email:
driver = manualroute
domains = ! +local_domains
ignore_target_hosts = 127.0.0.0/8
transport = mysmtphost_relay
route_list = * vps.mysmtphost.email::587
no_more
(...)
begin transports
mysmtphost_relay:
driver = smtp
port = 587
hosts_require_auth = <; $host_address
hosts_require_tls = <; $host_address
Just found out the user
gitwas not part of thetrusted_usersdirective in theexim.conffile. I changed it to include the user as follows:trusted_users = mail:apache:passenger:gitI came to this conclusion since mails sent by other Rails applications running as user
passengerwere being sent correctly as specified by the from address. Then I noticedpassengerbeing part of this directive andgitnot.From the Exim documentation:
http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html#SECTtrustedadmin