Archive for the ‘Open Source’ Category

OS X Lion Macports

Friday, July 22nd, 2011

OS X Lion Macports, Can I upgrade from Snow Leopard?

With the new release of Apple Mac OS X Lion, there are a lot of changes on the kernel and backends. Therefore I don’t think it’s possible to do port upgrade on Macports in order to upgrade your existing or installed ports in OS X Snow Leopard. (more…)

How to Change MySQL Data Directory in Linux Centos

Saturday, July 2nd, 2011

By default Linux CentOS or other Linux Distro installation, MySQL data directory is stored in /var/db/mysql, how can I change it to other directory in example /db/mysql?

It is always better to have MySQL Data Directory store in a specific partition/drive. It will help on performance and better management and scalability. You change change the data store directory in Linux by editing /etc/my.cnf file.

Edit /etc/my.cnf file


# vi /etc/my.cnf

Change the data directory structure


datadir=/db/mysql
socket=/db/mysql/mysql.sock

After the file has been updated, restart MySQL service.

How to Find Your Closest Anycast DNS Server with Dig

Wednesday, February 23rd, 2011

Most ISP deploys Anycast DNS server on their network and bring the closest DNS server to their user for DNS resolver. You may see a DNS server with a single IP Address but there are multiple DNS Servers running on different geographical location.

So which DNS server do you resolve it from? For example we run a query on DNS F Root Server


$ dig @f.root-servers.net hostname.bind  txt ch +short
"lga1a.f.root-servers.org"

On the result, it shows that I am using lga1a.f.root-servers.org as resolver. Some DNS server does reply “chaos” (ch) request but some refuse; for example Google DNS and Open DNS Server. So if your ISP is running Anycast DNS, you can try to lookup where is the DNS server locate.

There is another command perform checking via “id.server” query, it only helpful when the DNS has server-id configured.


dig @k.root-servers.net id.server txt ch +short
"k2.tokyo.k.ripe.net"

Exim: Restrict Authenticated Outgoing Email with Sender Domain

Thursday, January 27th, 2011

Most of the outgoing SMTP server allowed the user to set different sender email address once it is authenticated. But we might be in risk for allowing the user to send outgoing bulk/spam email via authenticated SMTP with different sender email address.

In Exim mail MTA, it can restricts at the SMTP authenticated transport.


accept  authenticated = *
          sender_domains = < the_domain_name_1 > : < the_domain_name_2 >
          control       = submission
          control       = dkim_disable_verify

Usually local_domains is the list of the domain hosted on Exim mail server, it can be configured as below too.


accept  authenticated = *
          sender_domains = +local_domains
          control       = submission
          control       = dkim_disable_verify

Detect DDoS Source & Destination IP Address with OURMON

Thursday, June 26th, 2008

We have OURMON running on one of network segment for quite some time, it is very helpful and resourceful when DDoS attack happened, especially to help our customer to find out which destination is targeted on the attack and from which sources. Below is the graph that we previously captured while running OURMON version 2.70.

OURMON Version 2.81

On the recent released of OURMON, the topn graphs didn’t show the traffic by Mbit/s instead of bit/s. The long no. is confusing when the NOC engineer is doing the monitoring(minimal 7 digits will show up). I have made some changes on omupdate.pl, one of OURMON script that generate html static page, to show extra value – Mbit/s. Our current OURMON graph looks something like below;

Below will show you how to add extra Mbit/s value on your OURMON Topn section;

edit omupdate.pl file

vi /usr/local/mrourmon/bin/omupdate.pl

On line 3137, add the code looks like below;


my $uappf = $items[$i+2];       # old hw app flags
my $uappl = $items[$i+3];       # app lower case
my $uapph = $items[$i+4];       # app upper case
my $bps = int(($items[$i+1] * 8)/30);
my $mbps = sprintf("%.2f", ($bps/1024)/1024); # convert bits to mbits
my $uaf = get_appflag($uappf, $uappl, $uapph);

this line of code my $mbps = sprintf(“%.2f”, ($bps/1024)/1024); is to declare the new variable $mbps and convert the bit/s value to Mbit/s by dividing 1024*1024.

Next is to display the value on the page, do something on line of code 3146;


"bits/sec: $bps, Mbits/sec: $mbps, "

Done, wait for a few second for the web page to refresh with extra Mbit/s value. Btw, you can remove bit/s if you want to, to save some extra space ;)