LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Disable Postfix completely ? (https://www.linuxquestions.org/questions/linux-server-73/disable-postfix-completely-4175537635/)

mike2010 03-23-2015 02:40 PM

Disable Postfix completely ?
 
I'm having an issue trying to keep Postfix grounded completely.

I'll run

postfix stop (from root)

and it'll successfully stop without any errors. But only for like 5 minutes...then it starts again on it's own. Seems like the Plesk install on it might be the culprit, and making it restart.

I read a site just now that a guy uninstalled postfix completely, and it caused his plesk install to fail. So I guess I don't want to uninstall it. Just to stop it completely.

I don't use email on the server.

I'm running a Linux/Unix - Centos .

my postfix starts at /etc/rc.d/init.d/postfix

config file is at /etc/postfix/master.cf and main.cf are both located there.

I have root access to whole server.

any help is much appreciated.

YankeePride13 03-23-2015 02:57 PM

I can't speak to Plesk, but to stop the service from running on startup you can do:

Code:

chkconfig postfix off

T3RM1NVT0R 03-23-2015 02:58 PM

Like you said your plesk install keeps starting postfix and if that is the case then you have got two options:

1. Misconfigure postfix configuration file so that plesk is not able to start it at all. However, if plesk depends on or checks the exit status whether it was able to start postfix successfully or not then you have to go with option 2.

2. Create a watch dog script which will check postfix and put it in cron to run every minute (you can configure the script to check every 30 seconds with a little tweak that is adding sleep command). Example script to put it in cron:

Code:

#!/bin/bash
#Script to check postfix
service postfix status
    if [ $? -eq 0 ]
    then
    {
        service postfix stop
    }
    else
    {
        echo "Service postfix already stopped" > /dev/null
    fi


YankeePride13 03-23-2015 03:06 PM

You could also use iptables to block traffic (incoming and outgoing) on the SMTP ports so that postfix is effectively off.

mike2010 03-23-2015 03:21 PM

Quote:

Originally Posted by YankeePride13 (Post 5336561)
You could also use iptables to block traffic (incoming and outgoing) on the SMTP ports so that postfix is effectively off.

Yankee, I tried this first. But all the postfix processes still ran.

Quote:

chkconfig postfix off
This command seemed to run without a problem. Rebooting server now to see what's up.

To turn back on, i'm guessing
Quote:

chkconfig postfix on
and then another reboot ?

^ the rest of you guys, I appreciate the advice as well.

YankeePride13 03-23-2015 03:27 PM

If the Plesk application launches the Postfix daemon, the chkconfig line won't stop that.

IPtables rules wouldn't stop the Postfix daemon from running, but it would prevent e-mail from coming in and going out. That's not enough in this situation (not being snarky, just asking)?

YankeePride13 03-23-2015 03:28 PM

Also yes, to allow the service to be booted on start up you'd do:

Code:

chkconfig postfix on

T3RM1NVT0R 03-23-2015 03:36 PM

chkconfig postfix off or chkconfig postfix on here is irrelevant the reason being postfix is triggered by plesk as you said. So if I will keep it off during startup eventually it will be turned on by plesk.

mike2010 03-23-2015 03:36 PM

after running chkconfig postfix off and a reboot.

I see a few Postfix processes still running like

Postfix Cleanup

Postfix - PSA-PC-Remote (plesk related crap)

Postfix Smtp

Postfix Pickup

but their far and few between....like once every 3 minutes, and their not taking up any CPU. Is it normal for them to still show up on Top even though it's suppose to be disabled? It's taking up like no CPU, so that's good.

friggin process seems unstoppable, unless it's uninstalled.

blocking the firewall ports, might be why it's taking up no cpu now.


All times are GMT -5. The time now is 10:48 PM.