Cannot Send/Receive Mail after Reinstalling Postfix

11 posts / 0 new
Last post
#1 Wed, 11/15/2017 - 04:01
dheuring

Cannot Send/Receive Mail after Reinstalling Postfix

I did an apt-get dist-upgrade for my Ubuntu 14.04 server. At one point, a message box opened asking about the Postfix configuration for the upgrade. I selected "No Configuration" thinking to keep the existing one which was working fine. After that I started getting Internet 500 errors when trying to send emails from my Drupal website. So I went ahead and did apt-get purge postfix and apt-get install postfix from a putty terminal window where I then had to enter all the configuration settings. I no longer get the 500 Internet error but I can only send mail from the email user settings on Virtualmin. I am not able to receive or send mail from the website. Also when I run "Re_check Configuration from Virtualmin, it says everything is set up correctly. When I check the mail.log file, nothing shows there is a problem.

Below is my main.cf file. I've been trying to fix this for days with not luck so I'd really really appreciate some help.

See /usr/share/postfix/main.cf.dist for a commented, more complete version

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no

appending .domain is the MUA's job.

append_dot_mydomain = no

Uncomment the next line to generate "delayed mail" warnings delay_warning_time = 4h

readme_directory = no

TLS parameters

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination myhostname = ts1.thaistocks.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydomain = thaistocks.com myorigin = $mydomain mydestination = $myhostname, $mydomain, localhost.localdomain, localhost mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

mailbox_command = procmail -a "$EXTENSION"

mailbox_size_limit = 0 recipient_delimiter = + virtual_alias_maps = hash:/etc/postfix/virtual sender_bcc_maps = hash:/etc/postfix/bcc sender_dependent_default_transport_maps = hash:/etc/postfix/dependent home_mailbox = Maildir/ smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination allow_percent_hack = no milter_default_action = accept milter_protocol = 2 smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891 relayhost = inet_interfaces = all inet_protocols = all notify_classes = resource, software relay_domains = $mydestination

Wed, 11/15/2017 - 20:59
dheuring

Update: So I'm narrowing this down to a problem with my mailbox_command. It may also be related to my procmail set up. But I sure need some help with this! Here are three

1) If I use "mailbox_command = procmail -a "$EXTENSION", and then I "Re-check Configuration" in Virtualmin I get this message - "The procmail command /usr/bin/procmail is owned by group mail, when it should be owned by root. Email may not be properly delivered or checked for spam." But when I check the users email box, see that the messages were sent and received. They show up in the main MAILDir. But nothing shows up in the sent folder. The emails from/to the server also show up in the mail.log. But I am not able to send/receive emails from the website.

2) Similarly, when I use "mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/" the same thing happens. Virtualmin says the system is not ready, but I am able to send/receive email from Virtualmin's user email account. The emails show in the MailDir but not in the sent folder. I am not able to send/receive from the website. The emails from/to the server show up in the mail.log.

3) When I use "mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME", Virtualmin's Recheck Configuration says everything is fine and the system is ready, but I cannot send/receive emails from the user's email nor from the website. Nothing shows up in the mail.log either.

Once again, here is my main.cf file contents

See /usr/share/postfix/main.cf.dist for a commented, more complete version Debian specific: Specifying a file name will cause the first line of that file to be used as the name. The Debian default is /etc/mailname. myorigin = /etc/mailname

myorigin = $mydomain myhostname = ts1.thaistocks.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydomain = thaistocks.com mydestination = $myhostname, $mydomain, localhost.localdomain, localhost mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 MAILDIR=$HOME/Maildir

mailbox_command = procmail -a "$EXTENSION" mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/ mailbox_size_limit = 0 recipient_delimiter = + virtual_alias_maps = hash:/etc/postfix/virtual sender_bcc_maps = hash:/etc/postfix/bcc sender_dependent_default_transport_maps = hash:/etc/postfix/dependent home_mailbox = Maildir/ smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu) biff = no

appending .domain is the MUA's job.

append_dot_mydomain = no

Uncomment the next line to generate "delayed mail" warnings delay_warning_time = 4h

readme_directory = no

TLS parameters

smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key smtpd_use_tls=yes smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination allow_percent_hack = no milter_default_action = accept milter_protocol = 2 smtpd_milters = inet:localhost:8891 non_smtpd_milters = inet:localhost:8891 inet_protocols = all relay_domains = $mydestination

Mon, 11/20/2017 - 09:28
dheuring

Okay, I think I have it narrowed down to a problem with the getting postfix into saslauth. I orginally set up the server using Virtualmin. But when I re-installed postfix I used terminal so I think I still need to get postfix into saslauth. I tried usermod -a -G sasl postfix" and got this response: "usermod: existing lock file /etc/passwd.lock with an invalid PID '1208' usermod: cannot lock /etc/passwd; try again later". Does this make sense to anyone and, if I'm right, how can I get postfix authenticated again? I've spent a week getting main.cf set up properly. I can send and receive emails from the server and receive emails from Roundmail. Can't send and keep getting a "SASL authentication failure" warning in the mail.log. I know dovecot and saslauth are configured correctly because I only purged and re-installed postfix from terminal. Is Virtualmin preventing me from getting postfix into saslauth db? Help, please?

Mon, 11/20/2017 - 12:12
Mon, 11/20/2017 - 19:48
dheuring

Thanks for the suggestions. I reviewed them each carefully but they do not resolve my sasl authentication problem with sending email from the website or RoundCube. There is no error in mail.err. Here is what mail.log shows when I try to send an email.

postfix/smtpd[10245]: warning: SASL authentication failure: cannot connect to saslauthd server: Permission denied Nov 21 08:40:26 ts1 postfix/smtpd[10245]: warning: unknown[191.96.249.199]: SASL LOGIN authentication failed: generic failure.

Tue, 11/21/2017 - 07:38
Jfro

Then ask support here for that part, i don't know sorry.

But you have to put here what you have done after, to install/set the postfix and so on after the false reinstall. So did you reinstalled/configured with the virtualmin after?

With these commands: virtualmin config-system --include......... for postfix sasl and so on ?

Tue, 11/21/2017 - 07:58
dheuring

My thinking is that when I purged and re-installed postfix on a Virtualmin system, postfix did not get added as a user to saslauthd so that is why I'm getting the SASL login authentication failure. But when I try to add postfix to saslauthd (adduser postfix sasl), I get this error: gpasswd: existing lock file /etc/group.lock with an invalid PID '1208' gpasswd: cannot lock /etc/group; try again later. adduser: `/usr/bin/gpasswd -a postfix sasl' returned error code 1. Exiting.

Can anyone tell me how to fix this?

Tue, 11/21/2017 - 08:03
dheuring

No, I haven't done anything with Virtualmin. I've been trying to fix this in terminal. I don't want to do a fresh install. I wasn't aware that you could use Virtualmin as part of a reinstall. I don't know how to use "virtualmin config-system --include". Can you tell me explain or point me in the right direction. I'm in need of some help after a week of trying to figure this out.

Tue, 11/21/2017 - 09:08
Jfro

These are in the links i posted also search should help i don;t have all in mind, also don;t know which you all needed

docs wiki and so on https://www.virtualmin.com/documentation/developer/cli/config-system

https://github.com/virtualmin/Virtualmin-Config

Tue, 11/21/2017 - 20:40
dheuring

Thank you!

From what I can see, I do not have Virtualmin-Config installed on my server. You've given me the links above to do so, but could you also show me the Ubuntu terminal commands to install it? I want to be sure I do this correctly. I've searched and can't find the actual commands that will get Virtualmin-Config working on my server.

Once it is installed, I understand that I can try the command "virtualmin config-system --include SASL" and hopefully that will fix the authentication problem I'm having. I'm also wondering if I should purge/remove Postfix and then re-install it using "virtualmin config-system --postfix". What do you advise?

The lesson for me in all of this is to never install a system from the terminal command window if you are using Virtualmin. Sorry to be such a bother. I am most grateful for you help.

Wed, 11/22/2017 - 12:08
Jfro

"" The lesson for me in all of this is to never install a system from the terminal command window if you are using Virtualmin""

UH metoo while just after Virtualmin v6 release august september some installs where BUGGY / have / had errors, so i did command line things also, yea you have to learn. ;)

BUT i have only experience with 1 Virtualmin BOX for a few months and only on CENTOS 7, so i can't help you further sorry. Also not advising while my knowledge UBUNTU is 0

If you have the control panel VIRTUALmin you can do there a check recheck, sometimes that give a clue

Topic locked