Latest Publications

useful postfix one liners

Postfix is a very good MTA (mail transport agent), here are some quick commands that help with queue management:

sudo mailq|wc -l – give an approximation of the number of emails in the mailq in the number at the beginning of the line
sudo postconf -e defer_transports=smtp;sudo postfix reload : pause email delivery but still accept email. May be useful when needing to queue a large number of mail at once or when a mail needs to be deleted from the mail queue without stopping the mail server
sudo postconf -e defer_transports=;sudo postfix reload;sudo postfix flush : unpause mail delivery… resume email delivery after it has been paused (previous tip)
postsuper -d ALL : clear all emails in the mail queue
postsuper -d [msgid] : delete one email with id [msgid]; previously obtained with a command such as mailq|grep -i [string] or mailq|more
postfix reload : after any changes to the configuration the server has to be reloaded to read the new configuration
postfix -f : flush the mail queue… to help postfix resume delivery faster after it has been paused such as after the computer reconnected

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare

Forum

Useful tool to analyze network traffic on Linux

is a simple packet sniffer, runs in the background and gives you basic information about the traffic on your network.

apt-get install darkstat

After installation,

darkstat -i eth0

The data is displayed in the browser (http://localhost:667/)

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare

How to install and load module ipt_set

Download and install the following packages

aptitude install xtables-addons-source xtables-addons-common

then do this

m-a -v -t auto-install xtables-addons

and then

ipset --create trustedip nethash
ipset --add trustedip 100.100.100.100
ipset --add trustedip 100.100.100.0/24
iptables -A input -m set --match-set trustedip src -j ACCEPT

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare

Remove Amavis Content Filter From Postfix Configuration, Requeue All Postfix Email Messages

Disable Postfix Amavis Configuration

First you will need to comment out the content_filter line which will look similar to the below. In my case it is telling Postfix to send local mail through port 10024 on the localhost or 127.0.0.1. The Postfix configuration file is named main.cf and located in the /etc/postfix directory.

Active Postfix Amavis Configuration Using content_filter:

1 content_filter = amavis:[127.0.0.1]:10024

Now the below shows the same configuration line updated with a comment in front of it so it is not processed.

Disabled Postfix Amavis Configuration Using content_filter:

1 #content_filter = amavis:[127.0.0.1]:10024

You may also have reference to amavis in master.cf also located in the /etc/postfix directory. If you do locate it, open in your favorite editor such as vi, and comment it out as shown below.

Comment Out Amavis Reference In The Postfix Configuration File master.cf:

1 #amavis unix - - - - 2 smtp
2 #        -o smtp_data_done_timeout=1200
3 #        -o smtp_send_xforward_command=yes

Restart Postfix To Enable Configuration Changes:

Now use the syntax below to load the new configuration files. This will disable content_filter and not require all email to be filtered when it is sent from the local server.

Reload The Postfix Server Using The Below Syntax:

1 [root@server postfix]# postfix reload
2 postfix/postfix-script: refreshing the Postfix mail system
3 You have new mail in /var/spool/mail/root

Requeue Postgix Email Without Content Filter:

After you have removed the content_filter configuration you may need to put emails back into the queue. Regardless after the content_filter setting has been modified you will want to run the below queue so no emails are stuck in the queue forever. Issue the below command to put emails back into the queue to be sent. For instance in my case I shut down amavis before removing the content_filter configuration line which caused numerous emails to be stuck in the Postfix queue.

Syntax To Requeue Postfix Email Messages:

1 [root@server postfix]# postsuper -r ALL
2 postsuper: Requeued: 42 messages

If you watch the maillog, located in the /var/log directory, when running the above command you will see the email being sent from the server if there are any emails that were requeued. All outgoing mail will no longer be filtered.

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare
 
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera