Zentyal Forum, Linux Small Business Server
Zentyal Server => Email and Groupware => Topic started by: nickpiggott on May 25, 2020, 11:01:27 pm
-
Running Zentyal 6.2, Samba Active Directory enabled.
In smb.conf, these values are set
workgroup = mydomain (in lower case)
realm = mydomain.com
From the Linux command line on the server running Zentyal,
MYDOMAIN\myuser@dc:\home\myuser$ mail touser@gmail.com
Subject: Test Email
Test Email
The mail is rejected by GMail with this error
: host aspmx.l.google.com[108.177.15.27] said: 553-5.1.7 The sender address <MYDOMAIN\myuser@dc.mydomain.com> is not a valid 553 5.1.7 RFC-5321 address.
If I send an email myself, I see TWO mailboxes in /var/mail
MYDOMAIN\myuser
mydomain\myuser
When I open mail to read mail, it says there is no mail for MYDOMAIN\myuser
If I cat the file of mydomain\myuser I can see the email
Looking in /var/log/mail.log I can see
postfix/pickup[29633]: 0532F1403E4: uid=1000 from=<MYDOMAIN\myuser>
So it seems that post fix is doing two things:
- Not removing the MYDOMAIN part of my username from the outbound "from address"
- Changing the reply back to all lowercase (including the mydomain section)
Any thoughts what I can do to resolve this?
-
:)
Google is telling you:
: host aspmx.l.google.com[108.177.15.27] said: 553-5.1.7 The sender address <MYDOMAIN\myuser@dc.mydomain.com> is not a valid 553 5.1.7 RFC-5321 address.
MYDOMAIN\myuser@dc.mydomain.com isn't a valid e-mail address.
Try this command:
perl -e '$from = "youruser\@youraddress.lan";$to = "someuser\@gmail.com";$subject = "Test Email";$message = "Testing mail";open(MAIL, "|/usr/sbin/sendmail -t") or die $!;print MAIL "To: $to\n";print MAIL "From: $from\n";print MAIL "Subject: $subject\n\n";print MAIL $message ;close(MAIL);'
Yo could test it through the Zentyal webmail too.
Cheers!
PS: I tested it from Zentyal 6.1 and 6.2
-
Posting this so future readers can see the problem and the fix.
Samba 4.7.6 ignores the setting for "winbind use default domain" on the machine running the AD-DC.
That means all usernames are now in the format "DOMAIN\username" on the AD-DC machine - you'll also notice this logging into the Zentyal webadmin. This cannot be changed.
The fix I had to put in place:
Copy the postfix configuration stub into /etc/zentyal/stubs/mail if it doesn't already exist there.
mkdir /etc/zentyal/stubs/mail
cp /usr/share/zental/stubs/mail/main.cf.mas /etc/zentyal/stubs/mail/
Edit /etc/zentyal/stubs/mail/main.cf.mas to add this line
sender_canonical_maps = regexp:/etc/postfix/sender_canonical
Create a file /etc/postfile/sender_canoncial with the content
# remove DOMAIN segment of DOMAIN\username sender
/([A-Z]+)\\(.*)/ $2
Restart Zentyal Mail
sudo zs mail restart
This re-writes outbound usernames as "username", stripping the DOMAIN section.
You also have to create symlinks in /mail/var. For each mailbox "username", create a hard symlink to DOMAIN\username
cd /mail/var
sudo ln username "DOMAIN\username"
otherwise the mail command won't work for you users.