Postfix Smtp Outgoing IP Rotator using iptables

This is the scheme

e.g:

I got 5 Public IPs. i’m Gonna configure them, so Postfix can use multiple interfaces/ips for outgoing smtp connections.

First we need creating Interface aliases for those 5 public IPs.

In my system, using fedora:

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-eth0:1

Edit ifcfg-eth0:1

# vi ifcfg-eth0\:1

DEVICE=eth0 <-- default device
HWADDR=XX:XX:XX:XX:XX:XX
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
IPADDR=202.XXX.XX.2 <-- default eth0 IP address
PREFIX=24
GATEWAY=202.XXX.XX.1
DNS1=202.XXX.XX.XX

Change DEVICE and IPADDR parameters

Centos 5 Compile Postfix With Tcp Table Support

I've seen someone asking for postfix TCP_TABLE support on centos at mailing list.Actually that was easy to achieved.I'm gonna explain how to build postfix rpm package with TCP_TABLE support.There's great tutorial on how to build postfix RPM package maintain by Simon J Mudd.

I'm gonna used Simon J mud's postfix source RPM package to build the binary.

First download the latest postfix SRPM package

$ rpm -Uvh postfix-2.6.5-1.src.rpm
$ cd `rpm --eval '%{_sourcedir}'`

$ export POSTFIX_SMTPD_MULTILINE_GREETING=1
$ export POSTFIX_LDAP=1
$ export POSTFIX_MYSQL_REDHAT=1
$ export POSTFIX_PCRE=1
$ export POSTFIX_PGSQL=1
$ export POSTFIX_RBL_MAPS=1
$ export POSTFIX_SASL=2
$ export POSTFIX_TLS=1
$ export POSTFIX_VDA=1
$ export POSTFIX_DB=4

Zombie Process

A zombie, or defunct, process is a process that has terminated, but its parent process has not taken it out of the process table with the wait() family of system calls. This typically happens when a program forks/execs another program, but then doesn’t reap it properly. The easiest way to write the parent to properly reap its children is to setup a signal handler for SIGCHLD that calls wait().

See the man pages on your local system for signal and wait(2).

Zombie and defunct states of a process are different things. Zombie is created when a child dies and parent didn’t call wait. Defunct is created when parent dies before the child finishes.

Defunct processes can’t be killed since they are already dead. To make them disappear you have to kill their parent process…

It’s not possible to kill defunct processes.

A good way to kill lists of processes is:

$ ps axf | grep name-of-process | grep -v -grep | awk '{print "kill -9 ",$1}' | sh

Connect to office vpn using speedy + linksys DD-WRT

Sometimes, i need to access to my computers/servers at office Local Area Network from home. i used to dialed vpn connection from windows XP home.but here, i'll share how to automatically connect to vpn server via linksys dd-wrt pptp client.

  • Connect to linksys/dd-wrt management via browser, point it to http://192.168.1.1 (default ip management)
  • Login and go to Services -> PPTP tab -> PPTP Client section

speedy linksys dd-wrt vpn pptp

  • Adjust Server IP or DNS Name, Remote Subnet, Remote Subnet Mask User and Password according to your network configuration.

Upgrade Centos 5.2 to Centos 5.4

It was easier upgrading from disc than unstable network :D Download DVD ISO Centos 5.4 from centos.org Upgrade from DVD [bash] # mount /dev/dvd /media/cdrom # yum upgrade --disablerepo=\* --enablerepo=c5-media [/bash] Be patient and wait until it finished [bash] # reboot [/bash] Now you've got a nice fresh centos 5.4…

Found 20 files with the largest size

e.g. [bash] # find /var/log -type f -exec du -sm {} \; | sort -n -r | head -20 [/bash] [bash] 41 /var/log/cabal/WorldSvr_10_01.log 35 /var/log/cabal/DBAgent_10.log 34 /var/log/cabal/WorldSvr_10_10.log 5 /var/log/maillog.4 5 /var/log/maillog.3 5 /var/log/cabal/WorldSvr_10_05.log 5 /var/log/cabal/WorldSvr_10_04.log 5 /var/log/cabal/WorldSvr_10_02.log 4 /var/log/cabal/WorldSvr_10_03.log 4 /var/log/cabal/LoginSvr_01.log 3 /var/log/maillog.2 3 /var/log/maillog.1 1 /var/log/yum.log 1 /var/log/Xorg.0.log.old 1…

Colouring MOTD

Terminal should be ANSI compliant and support colour escape sequences. Modern terminal should do the job.

The following is a list of escape sequences

The ^[ is produced by pressing Ctrl-V then ESC

I’m using vi as text editor and there’s no problem with ctrl-V ESC, i’m not test it on other text editor.

^[[0m    - Reset the terminal characteristics
^[[1m    - emphasis (bold)

^[[30m    - Foreground black
^[[31m    - Foreground red
^[[32m    - Foreground green
^[[33m    - Foreground yellow
^[[34m    - Foreground blue
^[[35m    - Foreground magenta
^[[36m    - Foreground cyan
^[[37m    - Foreground white