Promote free software - DUMP VISTA!

The free software foundation has started up a campaign to promote free software and oppose the adoption of Microsoft Windows Vista. Its about time someone thought of this. I would encourage everyone to support the FSF and sign the petition at http://www.badvista.org. So gohead, support a righteous cause.

DUMP VISTA!

db2move import utf-8

Well it starts off as a simple export/import of an UTF-8 database from AIX to Windows. I have an UTF-8 database on an AIX box and I created a UTF-8 database on the windows to replicate the setup on AIX with 

db2 create db MYUTFDB codeset UTF-8 territory US

and did the following to export the schema and the data from the AIX box

db2look -d MYUTFDB -ea -o mydbddl.sql
db2move AMUTF export

 

and on the windows box did this to import it on my newly created UTF-8 DB.

db2 -tvf mydbddl.sql
db2move MYUTFDB IMPORT

 

Now comes the time for a 2 day long struggle to find out why the utf-8 data inside the tables are all messed up, and all I could see are characters looking like "–>–>". When i opened up the ixf file for the imported tables using Notepad++ Instead of seeing actual characters (ex: in Japanese) i could only find "SUB" (Hex: 1A1A). To keep the long story short this is what i used to solve the problem

db2set DB2CODEPAGE=1208
db2 terminate
db2 force applications all
db2stop
db2start

I did this both on the AIX and Windows box. 

 The reason being, for some reason the db2move export on the AIX box, always exported the IXF files in the codepage 819 instead of 1208, eventhough my database was set to codepage 1208. Hence problem solved!

World Peace! 

catch that ESB! - ServiceMix the right concoction for all your ESB needs.

Yes i’ve been lazy! as always!. And this latest post is in response to the question "time to update ur blog?" from someone i know. You know who you are :D , and i know you are the only one reading it :p
So here goes, educate yourself :D . Go back to your Maths and Physics after ur done, ok?

What is ESB?

ESB (Enterprise Service Bus) is not just a fancy name used in the Java world, Its become an iconic term when people talk about "Integration". Imaging 10 different applications wanting to communicate with each other by some means, and lets say each application has some form of communication link between them, the end result? a mesh of communication links running across each of the individual applications resulting in CHAOS! The way ESB solves this problem is providing a single interface to for application to communicate to each other, synonymous to a line and different components connected to the same line at different places. Something like a BUS? :D

Now for some technical jargon….. 

The purpose of an ESB is to facilitate application and process integration by providing distributed processing, intelligent routing, security, and dynamic data transformation. In an ESB these services are infrastructure services so each application does not have to implement these requirements independently and in a proprietary manner. The ESB addresses the disadvantages of existing solutions by creating a standard infrastructure for integration. Point-to-point solutions, where each of n components requires n-1 interfaces for full communication, are replaced by a bus solution where each component requires a single interface to the bus for global communication. An ESB provides distributed messaging, routing, business process orchestration, reliability and security. It also provides pluggable services and, because of the standard bus, these pluggable services can be provided by third parties and still interoperate reliably with the bus.

ServiceMix - Whats it all about?

ServiceMix was an Apache incubator project which finally graduated and is now an Apache top level project. Apache ServiceMix is an Open Source ESB (Enterprise Service Bus) that combines the functionality of a Service Oriented Architecture (SOA) and an Event Driven Architecture (EDA)  to create an agile, enterprise ESB. Its an open source distributed ESB built from the ground up on the  Java Business Integration (JBI) specification JSR 208 and released under the Apache license. The goal of JBI is to allow components and services to be integrated in a vendor independent way, allowing users and vendors to plug and play. 

Why ServiceMix?

There are many vendors that provide ESB solutions (like Oracle ESB and IBM Websphere ESB), but there is no universal agreement as to the best design or architecture for an ESB. ServiceMix has a design that is based on the JBI (JSR 208) specification in order to create a standards based ESB and the ServiceMix ESB combines the functionality of both a Service Oriented Architecture (S0A) and Event Driven Architecture (EDA) to achieve an agile, enterprise ESB.As previously stated, ServiceMix is an open source ESB that is based on the Java Business Integration (JBI) standard. These two factors, open source and open standards-based, allow for low entry cost, maximum flexibility, reuse, and investment protection.

ServiceMix uses yet another Apache project ActiveMQ to provide remoting, clustering, reliability and distributed failover. Iam not going to go into any details on using ServiceMix, there are already plenty of resource for it on the project’s homepage. So goahead and give it a try.

OpenWRT on ASUS WL500gP - Router on Steroids!

I was tired of my old Netgear wireless router, since i had to reset it every…hmm lemme think…1hr!! and i used to go crazy walking to it on the other room and reset it. But finally its all over, i got myself a nice and shiny new ASUS WL500g Premium. Trying to find it at SimLim Square was kinda pain in the arse, considering only one shop had it. The primary reason i wanted to get this particular router was, it had 2 USB ports (called Storage Link in Linksys terminology) making it somewhat of a NAS (Network Attached Storage). The firmware provided was all good, but i needed something better and what better than OpenWRT (http://www.openwrt.org), the open-source linux os for the router initially made for the Linksys WRT series routers but was later ported to routers made by ASUS, Buffalo etc. To make it more clear, this is what the creator of OpenWRT have to say about it.

"OpenWrt is described as a Linux distribution for embedded devices.

Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For developer, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned."

What makes OpenWRT so great?

Well it depends on how much you love the word "Freedom". It lets you install everything from an OpenVPN Server,Web Server, FTP Server, Samba Server or a simple NAS server. and the best part its worth around 179 SGD and you get a low end server which always stays on. You could even use it as a bittorrent or an emule client to download stuff of P2P without even having to switch on your PC. It comes with all the goodies provided by the Linux 2.4 kernel.

Another project that complements OpenWRT is X-Wrt (http://www.x-wrt.org ) which is a web interface to configure OpenWRT based systems.

To get started I used the image http://downloads.x-wrt.org/xwrt/firmware_images/whiterussian/ 0.9/latest-daily-build/openwrt-brcm-2.4-squashfs.trx
which comes pre-built with x-wrt packages. And i used the TFTP method mentioned in OpenWRT Wiki to update the firmware

1. Connect your PC to the routers with one of the LAN ports on the routers.

2. Set your PCs IP to a static IP (ex: 192.168.1.10)

3. Unplug the power cord on the router

4. Push the RESTORE (not the red EZsetup!!!!) button on the router using a pen or such, and keep the button pushed down.

5. Plug the power on the router while keeping the (black) RESTORE button pushed for few seconds.

If you see a slowly blinking power light, you’re in diag mode. Now the router should accept an image via tftp.

6. On the PC open up a cmd window.

7. Type "tftp -i 192.168.1.1 PUT openwrt-brcm-2.4-squashfs.trx" and press enter in the command window.

8. After the tftp upload is complete, wait at least 6 minutes. Asus WL-500gP doesn’t seem to reboot automatically after the upgrade is complete. You need to plug off the power, and plug it back on to make the router alive again.

after the router is back up. goto http://192.168.1.1 to get access to the x-wrt management interface.

and don’t forget to use the mighty SSH to login to the router and let your imagination run wild!

 

IPv6 and Reverse DNS (an IRC addicts paradise)

Like always, lazy and sleepy all thanks to KFC’s cheese fries. I’ve been in hibernation for too long. And now that i’ve finally woken up to write something, i would like to write about something that i’ve always liked IRCing, though iam not into it much these days but it still brings back memories. OK then no more talking, lets get back to the point.

hmm, IPv6……

Well IPv6 is the next generation protocol for the Internet. IPv6 is already being tested by a lot of organizations and universities. And for the answer to the first question "Why?", well we are running out of address space. The current internet protocol IPv4 can support a maximum 232 (approx 4.3 billion) distinct addresses and even with things like NAT (Network Address Translation) we are still going to run out of addresses someday. Hence all the smart people around the world have come up with something called IPv6 (aka. IP version 6, as in TCP/IP? :) . IPv6 supports 5×1028 addresses for each of the roughly 6.5 billion people alive today. Unlike IPv4 addresses which look something like 192.168.1.2, IPv6 addresses are normally written as eight groups of four hexadecimal digits ex: 2001:0db8:0000:0000:0000:0000:1428:57ab. Well enought talking getting back to our topic. People on IRC would love to show off l33t host names, something like "southpark.kicks-ass.net" (a.k.a Reverse DNS entries for IPs) instead of an IP when they join a channel and as with the case of IPv4, the people who own the rights to set these Reverse DNS entries are most likely your ISPs or if you own a dedicated server, your server provider. But with the case of IPv6, these rights can be all your, and wats better ITS FREE!! :D

Q: what do you need to have to get you started with IPv6? 

A: An IPv6 Tunnel (Which creates dynamic IPv6 tunnels between someone called the Tunnel Broker  (People who provide IPv6 tunnels) and your machine)

These Tunnels route your traffic over the existing IPv4 network and connect you the world of IPv6. So after you have setup an IPv6 tunnel your traffic would be routed something like this

<Your IPv6 Network/Host–>  IPv4 (Your ISP) <— IPV4 Network — > IPv6 Network.

In short all your IPv6 traffic would be tunneled through ur existing IPv4 infrastructure, hence these tunnels are also called "6to4" tunnels and visa versa.

Q: How do you create an IPv6 Tunnel?
A: There are lots of free IPv6 Tunnel providers, to name a few

    1. Hurricane Electric (http://ipv6tb.he.net)
    2. BT-exact (http://tb.ipv6.btexact.com)

refer to http://en.wikipedia.org/wiki/Tunnel_broker to get a list of tunnel brokers.

the easiest way to get started with IPv6 is to download the Gateway6 Client from http://www.go6.net/4105/download.asp formally known as freenet6. Register for an account at www.go6.com and install the Gateway6 client and run the client and provide your newly created account.

Once you startup the client, it would create a IPv6 Tunnel and install an Virtual IPv6 Tunnel adapter and you would instantly be assigned a IPv6 Address. 

To get started with Reverse DNS you must request an IPv6 Subnet by selecting "Enable Routing Advertisemen".  The next step is to assign a DNS Server that would handle reverse dns for you, again there are lots of free DNS provider out there that support creating IPv6 Zones like http://www.afraid.org and http://www.xname.org. In my case i’ve used ns1.afraid.org as the DNS server to represent afraid.org’s nameservers.

 Gateway 6 Client

 after you have requested a subnet and the gateway 6 client is restarted, your virtual ipv6 adapter would have a new address added to it something like 2001:5c0:95ad::1 and in my case i own the subnet 2001:5c0:95ad::/48 so any address from 2001:5c0:95ad::1 to 2001:5c0:95ad:ffff:ffff:ffff:ffff:ffff is all mine to cherish :)

now that you have the subnet we will start by creating a reverse dns zone at afraid.org (keep in mind they have very low tolerance on DNS abuse)
create an afraid.org account and login to it and create a new IPv6 Reverse Zone

 Under the "IPv6 Reverse" create a IPv6 Subnet with something like "2001:5c0:95ad::/48"

now add a new record for  2001:5c0:95ad::1 inside the subnet, make sure the hostname you specify has already an AAAA record pointing back to 2001:5c0:95ad::1 (Which can be setup from "Subdomain" section at afraid.org). So once the reverse DNS entry is setup you can start using your brand new host name to login to any irc network and when the irc server queries the reverse dns record for your IPv6 IP it will get hold of the hostname you just specified. PWNAGE!!

w00tw00t.at.ISC.SANS.DFind

Well i’ve been having this problem for a long time, with script kiddies trying to run scans on my server with Dfind (http://class101.org ).

These are some of these request from the apache server logs

/var/log/httpd/access_log.2:80.237.172.185 - - [05/Mar/2007:09:20:47 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.2:83.71.188.242 - - [05/Mar/2007:16:25:40 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.2:213.254.226.49 - - [06/Mar/2007:05:11:47 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.2:216.30.246.14 - - [09/Mar/2007:08:56:12 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.3:80.237.211.76 - - [25/Feb/2007:07:46:16 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.3:83.71.188.242 - - [25/Feb/2007:17:51:23 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400 299 “-” “-”
/var/log/httpd/access_log.3:80.237.172.185 - - [27/Feb/2007:05:42:20 -0800] “GET /w00tw00t.at.ISC.SANS.DFind:) HTTP/1.1″ 400

 

All this while i’ve been lazy :D , but today i felt like trying something to fix it. What i’ve come up with is this

grep “w00tw00t” /var/log/httpd/access_log*|awk ‘{print $1}’|sed ’s/\(.*\)://g’|sort|uniq|cat /etc/apf/deny_hosts.rules -|sort|uniq

 

This is one of the things i wrote to get all the list of IPs from the Apache access logs who have been running these scans. Well the purpose of this is to feed these IPs to APF (http://www.rfxnetworks.com/apf.php ) the output of this is pumped to /etc/apf/deny_hosts.rules to block any of these lamers from further accessing my server ^_^

Only problem is for some strange reason, I couldn’t pipe the output of the command directly to /etc/apf/deny_hosts.rules. The file always ended up with output of "grep "w00tw00t" /var/log/httpd/access_log*|awk ‘{print $1}’|sed ’s/\(.*\)://g’|sort|uniq". Well maybe i’ll figure it out sometime later. SLEEPP!! awaits!!

Django for Python

Django is a web-framework similar to Rails for Ruby, i’ve not worked on rails much thought but my friend vivek seems to be the "GURU" of rails =), but when he mentioned Django i just wanted to give it a try. From what i can say Django has been a no pain and all gain framework. Easy to setup and code. In the world of Web 2.0, isn’t that want we want. I had an old friend who ones said "Good Programmers are Lazy Programmers".I still remember your words, Hats-off to you Jacob!. That said, Django is pretty easy to get things started with, I won’t start with providing a tutorials for it, the site already has a great set of tutorials. You can also check out www.djangobook.com  which is a book in making for Django. One other interesting thing to check out is a video on Django at http://video.google.com/videoplay?docid=-70449010942275062&q=Django
 

If you have trouble figuring out Django you can also drop in at the IRC channel #django at irc.freenode.net 

Well thats it from me for a while, I’ve been feeling lazy lately :b 

My very own 360°s

I finally got my XBOX 360, without a doubt the best console eva!

mmm, what have i been playing? 

  • Project Gotham Racing III (aka PGR III)
  • Dead or Alive 4
  • Crackdown
  • GRAW 2
  • Burnout Revenge
  • Kameo
  • Gears of War (My Favourite) :b
  • Ninety-Nine Nights

and now my very own gamecard, though iam still a n00b :(

IP VPN with Hamachi

Want to setup a VPN? but don’t have the time, or you are just plain old lazy to setup something like OpenVPN? Well then Hamachi is for you!.  Hamachi is a zero-configuration virtual private networking application with an open security architecture and NAT-to-NAT traversal capabilities. Ok, why a VPN? u ask. An IP VPN is a partitioned private network constructed over a shared IP-based backbone that utilizes technologies to ensure privacy of data, so you can setup your own private network over the internet and still communicate with the peers securely. You can setup a VPN just to do something very simple as playing a multi-player game over the internet and simulate a local LAN. Setting up Hamachi is a piece of cake!. Just download the windows installer if you use windows or get the tarball of the binaries for linux. Setup is as simple as running the installer and you are all set to go :b

But Hamachi is not a replacement for something like OpenVPN it still has some disadvantages

- dependends on a third party mediation server - if necessary, you can firewall your Hamachi connection (although this sort of negates the convenience of not having to open up ports on your computer for certain games that you would have if you don’t firewall your Hamachi-NIC: the regular NIC would still be firewalled without problems as things are being tunneled), but firewalling your connection is global for ALL Hamachi networks you have joined whereas OpenVPN creates a separate virtual NIC for each "network" that you and your peers create

- some games act up with the predefined 5.0.0.0 mask 255.0.0.0 network, which in Hamachi you cannot change, although a workaround would be IPX on all Hamachi clients if the game supports it. In OpenVPN you decide any IP ranges and settings yourself

- so far, Hamachi cannot be "bridged" with other NIC’s on your system like you can with OpenVPN or at least I haven’t been able to

- perhaps Hamachi cannot be forced into promiscuous mode which is necessary for this to work or simply refuses to use static IP addresses if you manually enter the 5.0.0.0 address

- no Windows 98 support, which some gamers still use especially with older games that require IPX or even NetBEUI.

You can get Hamachi from http://www.hamachi.cc/

So what are you waiting for? go, give it a try! :D  

Groovy - Dynamic Language for Java Platform

Well i know its been a long time since i posted somethin, and yes shame on me :p

I came across somethin today which is pretty amazing for what it can do for you, Its like a small scripting engine for java or you may just call it a seperate language of its own. The best part is the amount of code you would write in groovy compared to java to perform the same task. For most part groovy sounds more like "Ruby for Java". For a quick start install the groovy eclipse plugin from http://groovy.codehaus.org/Eclipse+Plugin. Groovy scripts are compiled to Java Class files and they are nothing different than normal class file. So in your application you could write some portions in Groovy and some in Java, since compiled Groovy class files can be used in Java and Java classes can be used in Groovy without doin anything extra. You will know what I am talkin about once you start coding in it, so stop wasting time and get to work!

Resources:

http://groovy.codehaus.org/
http://www-128.ibm.com/developerworks/java/library/j-pg09196.html 

Next Page »