Disable phpinfo() on Apache Web Server

Information displays from phpinfo() may provide resourceful information to attacker, such as file patch, web server environment, php modules, web server modules and etc. It’s better to disable phpinfo() function on your webserver.

exim, playing with mail queue in server

there are over thousand emails queue in our mail server, even though I have configured email frozen more than 10 days automatically delete/remove, but it seem like doesn’t work as expected.

here is the work around if you plan to do it manually.

start with listing email queue in the server, by using the command exim -bp, it will list all the email currently queue in the server. but my only concern is frozen email in the server, which I would like to manually clean it from the queue. let try something here,

exim -bp | grep frozen

18d 24K 1JhiI4-00096B-OW <> *** frozen ***
18d 2.3K 1JhiII-00097Y-8s <> *** frozen ***
16d 2.8K 1JhiKM-0009AL-9M <> *** frozen ***
15d 2.3K 1JhiLO-0009Bs-EF <> *** frozen ***
15d 2.5K 1JhiLS-0009Bx-O2 <> *** frozen ***
12d 2.7K 1JhiNm-0009S5-AQ <> *** frozen ***
10d 3.3K 1JhiPv-0009aN-Vu <> *** frozen ***
10d 24K 1JhiQ9-0009as-4R <> *** frozen ***

There are the emails currently queue in the server, and now you might want to check why did the email was queue in the server by exim -Mvl

2008-04-02 15:58:52 Received from <> H=(xxx.xxx.net) [202.76.234.132] P=esmtp S=2143 id=20080402075613.8287E22E8BB@xxx.xxx.net
2008-04-02 15:58:52 routing failed for rsvundet_2002@xxxx.com.my: User account not exist
*** Frozen (delivery error message)

If you want to remove all the email from queue more than 18 days, try this command;

exim -bp | grep 18d | awk ‘{ print $3 }’ | xargs exim -Mrm

Message 1JhiI4-00096B-OW has been removed
Message 1JhiII-00097Y-8s has been removed
Message 1JhiKM-0009AL-9M has been removed
Message 1JhiLO-0009Bs-EF has been removed
Message 1JhiLS-0009Bx-O2 has been removed
Message 1JhiNm-0009S5-AQ has been removed

some usefull queue commands:

-bp : Queue email in Server
-bpc : Count Queue email in Server
-M : Force delivery
-Mar : Add recipient
-Meb : Edit message body
-Mes : Edit sender
-Mf : Freeze message
-Mg : Give up (and bounce message)
-Mmad : Mark all recipients as delivered
-Mmd : Mark recipient as delivered
-Mrm : Remove message (no bounce)
-Mt : Thaw message
-Mvb : View message body
-Mvh : View message header
-Mvl : View message log

enjoy and happy cleaning queue email!

Links

Exim Cheat Sheet by bratthemad
Last update: 20080721

Changing File’s Date and Time on Unix Systems

Change Data and Time of a File

At times, we might want to change date and time of a file, for record purposes. For example, when you copying log file from remote machine, when it’s extract on local machine, the date and time will reflect to current date time.

touch Command

To update the date and time of file, run;

touch -t ccyymmddhhMMSS filename

For more info, run;

man touch

How to Use Wget to Download Manual from Website

Most of the time, we would prefer to read manual offline instead of browsing online, sometime we do not have internet access, and in the boredom, we can read the manual OFFLINE! Example below will show you how to grab the manual online to your machine.

Using wget to Download Website for Offline Reading

If you have wget installed on your machine, you can do the command below to download a website for offline read.


shell> wget --no-parent --mirror -p --convert-links -P ~/Documents/local-browsing http://www.some-website.com/howto/

Above command will download the entire website into your machine in your home directory Document/local-browsing. Now you can read while you are offline!

How do I Start Application Services with launchctl When Apple Mac Leopard Boot Up

If you have MySQL, PostgreSQL, Apache2 or other application installed from Macports, you might want the services auto start during machine start up. You can use launchctl to do it, it’s similar to start up script on FreeBSD on /usr/local/etc/rc.d or /etc/rc.d

The start up script is located at /Library/LaunchDaemons, this is what I have on my machine;

In order to add the services into launchctl, do it with below command;

Auto start MySQL

sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist

Auto start PostgreSQL

sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql82-server.plist

Auto start Apache2 Web Server

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

To disable the service auto start;

sudo launchctl unload -w /Library/LaunchDaemons/org.macports.apache2.plist

For more information, do man launchctl