Postfix configuration - how to change user.user@hostname.fqdn.com to user@domain.com

When I sent my email account an email I got the following in wormly:

Resolving hostname... Connecting... Connection: opening to mydomain.com:25, timeout=300, options=array ( ) Connection: opened SERVER -> CLIENT: 220 host1.myMasterDomain.net ESMTP Postfix (Ubuntu) CLIENT -> SERVER: EHLO tools.wormly.com SERVER -> CLIENT: 250-host1.myMasterDomain.net 250-PIPELINING 250-SIZE 10240000 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN CLIENT -> SERVER: STARTTLS SERVER -> CLIENT: 220 2.0.0 Ready to start TLS CLIENT -> SERVER: EHLO tools.wormly.com SERVER -> CLIENT: 250-host1.myMasterDomain.net 250-PIPELINING 250-SIZE 10240000 250-ETRN 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN CLIENT -> SERVER: MAIL FROM: SERVER -> CLIENT: 250 2.1.0 Ok CLIENT -> SERVER: RCPT TO: SERVER -> CLIENT: 250 2.1.5 Ok CLIENT -> SERVER: DATA SERVER -> CLIENT: 354 End data with . CLIENT -> SERVER: Date: Tue, 15 Oct 2019 22:46:03 +0000 CLIENT -> SERVER: To: email.address@mydomain.com CLIENT -> SERVER: From: Wormly SMTP Test CLIENT -> SERVER: Subject: Wormly SMTP Test Message CLIENT -> SERVER: Message-ID: CLIENT -> SERVER: MIME-Version: 1.0 CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1 CLIENT -> SERVER: CLIENT -> SERVER: This message was sent using the Wormly SMTP testing tool by this user: CLIENT -> SERVER: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36 CLIENT -> SERVER: 77.97.223.249 CLIENT -> SERVER: CLIENT -> SERVER: . SERVER -> CLIENT: 250 2.0.0 Ok: queued as B79383CEDD CLIENT -> SERVER: QUIT SERVER -> CLIENT: 221 2.0.0 Bye Connection: closed Message completed successfully.

In the /var/log/mail.log a second or 2 after I got:

Oct 15 23:46:04 host1 postfix/smtpd[5530]: connect from tools.wormly.com[96.126.113.160] Oct 15 23:46:05 host1 policyd-spf[6022]: None; identity=helo; client-ip=96.126.113.160; helo=tools.wormly.com; envelope-from=test@tools.wormly.com; receiver=email.address@mydomain.com Oct 15 23:46:05 host1 policyd-spf[6022]: None; identity=mailfrom; client-ip=96.126.113.160; helo=tools.wormly.com; envelope-from=test@tools.wormly.com; receiver=email.address@mydomain.com Oct 15 23:46:05 host1 postfix/smtpd[5530]: B79383CEDD: client=tools.wormly.com[96.126.113.160] Oct 15 23:46:05 host1 dovecot: imap-login: Login: user=, method=PLAIN, rip=52.97.128.109, lip=178.79.170.138, mpid=6028, session=<9Ajov/qUBu80YYBt> Oct 15 23:46:06 host1 postfix/cleanup[6023]: B79383CEDD: message-id= Oct 15 23:46:06 host1 postfix/qmgr[1635]: B79383CEDD: from=, size=874, nrcpt=1 (queue active) Oct 15 23:46:06 host1 postfix/smtpd[5530]: disconnect from tools.wormly.com[96.126.113.160] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7 Oct 15 23:46:06 host1 spamd[27920]: spamd: connection from ::1 [::1]:44712 to port 783, fd 5 Oct 15 23:46:06 host1 spamd[27920]: spamd: setuid to email.address@mydomain.com succeeded Oct 15 23:46:06 host1 spamd[27920]: spamd: processing message for email.address@mydomain.com:1012 Oct 15 23:46:06 host1 spamd[27920]: spamd: clean message (-1.9/6.0) for email.address@mydomain.com:1012 in 0.3 seconds, 1051 bytes. Oct 15 23:46:06 host1 spamd[27920]: spamd: result: . -1 - BAYES_00,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE scantime=0.3,size=1051,user=email.address@mydomain.com,uid=1012,required_score=6.0,rhost=::1,raddr=::1,rport=44712,mid=,bayes=0.000000,autolearn=ham autolearn_force=no Oct 15 23:46:06 host1 postfix/local[6029]: B79383CEDD: to=, orig_to=, relay=local, delay=1.5, delays=0.82/0.01/0/0.67, dsn=2.0.0, status=sent (delivered to command: /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME) Oct 15 23:46:06 host1 postfix/qmgr[1635]: B79383CEDD: removed Oct 15 23:46:06 host1 spamd[27919]: prefork: child states: II

the mail.log shows just the last 20 lines by default. You may need to either increase the nbr to say 200 or search for wormly - and once you’ve established the time of the “connect from tools.wormly.com” then remove the search term and increase the nbr of lines displayed to isolate the initial wormly connection & associated lines.

My logs are simply filled with thousands of authentication failures…its too many to find to be honest.
i am wondering if I can start from scratch with postfix and dovecot on a server with existing websites?

If you put

connect from tools.wormly.com

in the search box - it should find you the time of the connection from wormly - i.e. when that site made the initial SMTP connection. The 5 or 6 lines that followed will tell you what postfix/procmail are subsequently doing. Otherwise you may end up trying a ton of things and end up with a non functional server.

p.s. I’ve increased the nbr of lines displayed to 2000 and had no issues.

It’s also why I was suggesting having 2 tabs open in a browser & as soon as you hit the “Test this SMTP Server” button, then switch to the other browser tab and hit Refresh on the mail log - 99% sure you’ll have the relevant lines on the display.

are we able to private message each other on this forum?

LOL - I don’t think you can. Do you want me to contact you via the email button on your domain?

Not that one cause its on the same server which is playing up.

can you provide me a url for me to send you my personal one?

message deleted.

ok delete it now…email sent

Righto…so for the sake of helping others who may stumble across this thread, i have found my way back to a 75% working mail server again (after it stopped working completely).

The solution, i went through the webmin postfix basic configuration and setup everything as shown in that tutorial. I have not yet gone to the Postfix Virtual domains section at this point in time.

Next, i noticed in postfix mail queue that the status of messages had a common error…all network protocols are disabled. After a bit of googling and then checking my posfix/main.conf had an error…

inet_protocols =

This needs to have a network protocol…so i changed it to read

inet_protocols = ipv4

now i have a working mail server again. It is still not 100%, the only issue with the new user email account i created on one of the virtual servers is that postfix wont deliver emails to this particular new account president@domain.com (although it is now delivering emails to all other accounts on the mail server, which is a huge relief)

I think somewhere along the line that got changed from inet_protocols = all which was in your main.cfg you posted in Post #21, that probably killed all mail.

I think the real cause of the error is a mis-config of Postfix (somehow) around “What domain to use in outbound mail” setting to to $myhostname as opposed to “/etc/mailname” may have prevented Virtualmin from adding the user\alias in the /etc/postfix/virtual file - hence the error of unknown virtual user (thereabouts).

Hopefully the OP having corrected these, updated his /etc/postfix/virtual file for this one user and regenerated the hash should resolve his issue. (Could have also deleted the problematic user & re-created it too).

I think the key thing to take away from this is BE VERY CAREFUL CHANGING DEFAULT VALUES (unless they look blindingly simple & a read up on the docs & postfix docs say so). Most of all take a backup of your config files & (obviously) change one thing at a time & test. Don’t go for the scattergun approach of making multiple changes and then getting stuck not knowing which one\s are the problematic ones. And worse still - not knowing what they were, as you didn’t back them up.[NOTE: I’m not saying the OP made multiple changes - but I’ve seen folk do it.] :wink:

[NOTE: I’m not saying the OP made multiple changes - but I’ve seen folk do it.] :wink:

Please don’t look over my shoulder next time :wink:

YUP i do / did , but with backup and testing afterwards hmm should be ok, only for debuging a error / failure not the best way as you say hard to find the buggy parts then. ( though much is connected to settings elsewhere , so you have todo more then one change sometimes)

Look at the rules for the parts network / myinetinterfaces , receipients, adn so some more.

A example don’t know this is a good one: ?
# Recipient restrictions:
smtpd_recipient_restrictions =
permit_mynetworks,
permit_inet_interfaces,
permit_sasl_authenticated,
reject_unknown_recipient_domain,
reject_unauth_destination,
reject_unauth_pipelining,
reject_non_fqdn_recipient

You have then if mynetworks for that part to set the right stuff.

Some problems with network and also php-fpm are after update virtualmin . See issues

This is a good read for someone wanting to know what are good restrictions and what are bad.

http://www.postfix.org/SMTPD_ACCESS_README.html

And how to use the other ones too.

Thanks if reply was for me mine ? was to let readers know that these settings from me are not for everybody the same … :wink:

But to take a look at those to and your link explains more to the readers here.

I still cannot understand why Virtualmin would not add the new email user i created properly? (hence all of the changes)

For example, I have just logged into the primary domain virtual server (ie the domain for the host itself) and created a new user email account (email only). Virtualmin creates the user, however, look at what happens when i log into Usermin…

https://drive.google.com/file/d/1mdjnZRSai47KdEX2_aBmOOF29QeN232F/view?usp=sharing

and this

https://drive.google.com/file/d/15ZGfC3s1mcd2m5bmVXmKE5ZubjqRr9cb/view?usp=sharing

logs below

Use of uninitialized value $mailbox::in{“start”} in int at /usr/share/usermin/mailbox/index.cgi line 106.
Use of uninitialized value in addition (+) at /usr/share/usermin/mailbox/index.cgi line 107.
Use of uninitialized value in numeric eq (==) at /usr/share/usermin/mailbox/index.cgi line 29.
Use of uninitialized value $mailbox::in{“jump”} in pattern match (m//) at /usr/share/usermin/mailbox/index.cgi line 77.
Use of uninitialized value $mailbox::in{“start”} in int at /usr/share/usermin/mailbox/index.cgi line 85.
Use of uninitialized value $mailbox::in{“folder”} in concatenation (.) or string at /usr/share/usermin/mailbox/index.cgi line 378.
Use of uninitialized value $mailbox::in{“start”} in int at /usr/share/usermin/mailbox/index.cgi line 85.
Use of uninitialized value in addition (+) at /usr/share/usermin/mailbox/index.cgi line 382.
Use of uninitialized value in addition (+) at /usr/share/usermin/mailbox/index.cgi line 385.
Use of uninitialized value in subtraction (-) at /usr/share/usermin/mailbox/index.cgi line 387.
Use of uninitialized value in subtraction (-) at /usr/share/usermin/mailbox/index.cgi line 388.
Use of uninitialized value $mailbox::in{“start”} in int at /usr/share/usermin/mailbox/index.cgi line 106.
Use of uninitialized value in addition (+) at /usr/share/usermin/mailbox/index.cgi line 107.
Use of uninitialized value in numeric eq (==) at /usr/share/usermin/mailbox/index.cgi line 29.
Use of uninitialized value $mailbox::in{“jump”} in pattern match (m//) at /usr/share/usermin/mailbox/index.cgi line 77.
Use of uninitialized value $mailbox::in{“start”} in int at /usr/share/usermin/mailbox/index.cgi line 85.
Use of uninitialized value $mailbox::in{“start”} in int at /usr/share/usermin/mailbox/index.cgi line 85.
[17/Oct/2019:08:13:25 +1100] [120.146.145.157] /404.cgi : File not found
Use of uninitialized value in numeric ge (>=) at /usr/share/usermin/mailbox/index.cgi line 86.
Use of uninitialized value in numeric ge (>=) at /usr/share/usermin/mailbox/index.cgi line 86.

Now Usermin is not working for users on the postfix server. I have checked this for 2 domains, neither of them are working properly even though they are receiving and sending emails (i have checked the email in webmin for new user adamjedgar@domain.com…the email sent to it contains my test email sent from hotmail)

Also, why is the url when accessed from virtualmin link, the host.fqdn.com:20000 instead of domain.com:20000?

in the first image and user mailbox, the url is also missing the link “/mailbox/index.cgi?id=INBOX&xnavigation=1”

@Jfro - no worries. Reply wasn’t really for you - for everyone. LOL

Ok thanks have non worries about your posts, nice and so… :wink:

Worries i have for such ADMINS as here http://regi.plusonline.nl/ you see the version. :frowning:

They even don’t want to come to the phone or reply by mail about that SSL v3 and much more dangerous stuff with that old box.
Sorry is offtopic.

But also for forumusers important if someone takes the time to warn you as serveradmin for some insecure things please take note for that , and if important have it asap on your todo list. :wink:
AND don’t be BRUTE or unpolite please.

@adamjedgar - Glad your emails are working correctly, as in send\receive now. The “new” issues:

usermin - try the suggestions in the following post - https://www.virtualmin.com/node/54601

hostname - alter your DNS A record & remove the Host part from it, leaving it at just the domain. It shouldn’t be there. Instead add an additional CNAME for it, much like for www, ftp, mail, etc.

HIH

Dibs

I think somewhere along the line that got changed from inet_protocols =
did i post my postfix conf file?
Some lignes seems to be missing :
myhostname = hostname.domaine.com
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = hostname.domaine.com alias_maps = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases
and more lignes are missing...
Try to get the original file (main.cf) of postfix to be sure...

The solution can be here to separate each domain name and get the right smtp banner when you are sending emails and not the "hostname" of your server which will give a bad deliverability.

http://www.postfix.org/postconf.5.html#inet_interfaces
http://www.postfix.org/postconf.5.html#myhostname

Good luck !!!

For anyone interested - the core issue got resolved today after a few hours with the OP.

Crux of the issues was

  1. DNS entries need correcting. 1 A record to the root domain and multiple CNAMe’s for the sub-domains, i.e. mail, www, ftp, etc. and 1 MX record.

  2. Incorrect hostnames or not all of them in the hostnames for the LE SSL certs. Once corrected and new certs requested from LE, they needed copying to Postfix, webmin & usermin to overwrite the previous ones which referenced a host (subdomin) no longer in use.

  3. The change suggested in post 5 from https://www.virtualmin.com/node/52271 - changing default_mail_env to mail_location.

  4. Deleting & recreating a user.

Everything started working after that.

I personally think everything was installed (Virtualmin & everything else inclusing SSL certs) when the host/subdomain perhaps had a different name and then the subdomain was dropped.

All the changes done thru the UI’s.