Sunday, November 1, 2009

BASH: Using untyped variable to get unlimited parameter

I have been working a backup script at work that support MySQL, PostgreSQL and file using mysql_dump, pg_dump and duplicity commands. Since the script will be running parallel, the script will be calling up itself a lot, I need a better parameter parsing. And I absolutely do not want to use 100 lines of code to do such simple task. It will be so hard to maintain. And when I was trying to improve my parameter parsing, I found something called "untyped variable". I am not sure if it's a proper name.

Anyway, the whole point of doing this is: you do not have to use a lot of if conditions or case to sort variable one by one. You can just put the variable name in a loop, and it will parse out all recognized variable names.

I am using 'eval' to assign the values into variables. I was originally using 'export'. And I know there is actually some other way to do some, something like $($OPT)=$FIELDS, but somehow it didn't work for me. :-(


Using 'eval' to assign.
eval $OPT=$FIELDS


Parsing all variables and values

# Define all acceptable variable names here
ALL_OPT=(Type Host Pass User DB Table MaxTry BackupDir Src Dst Port sshUser Period dbExtra)

for WORD in $@ ; do # $WORD is the name of variable,
for OPT in ${ALL_OPT[*]} ; do # Check if I have the option in the list
FIELDS=""
case $WORD in
$OPT=?*) # To make sure it has '=' and at least one character after '='
FIELDS=${WORD:`echo ${#OPT}+1 |bc`} # grap the value
eval $OPT=$FIELDS # Assign the variable to
echo " export $OPT $FIELDS"
;;
Report)
echo "calling up Report"
bkReport
break
;;
esac
[ "$FIELDS" == "" ] || break # no value at all
done
done


Display all variable names and value

for OPT in ${ALL_OPT[*]} ; do
eval aaa=\$$OPT
echo $OPT = $aaa
done



Calling up the function

# Define all function names, which is the accepted variables value in first variable in ALL_OPT
ALL_TYPE=(Mysql File MySql Redmine)
[ $Type == "NULL" ] || for TypeCHK in ${ALL_TYPE[*]} ; do
if [ $Type == $TypeCHK ] ; then
ChkPeriod $Period
[ $? == 0 ] && bk$Type # Of course, you have to have the function, e.g: 'bkFile'.
fi
done


All codes

Sunday, July 5, 2009

The Smallst Linux.. what can it do??



It's such an interesting product. I found it when I was thinking to build my own digital frame. This little guy runs uClinux, build-in web and telnet service. I wonder what else can it do... any one??

The Smallest Linux in the World

Saturday, July 4, 2009

Chris Tyler ROCKZZZZ!!!

Is that a Ronald USB midi guitar?? Hopefully it's Linux based LOL

This is a top secret photo. I think Chris sneaked out when he was supposed to go No Frills to buy milk for next week.. sh... don't tell Diana.. LOL

Chris and other Seneca teachers whom should not be named of...

Just a joke.. Chris.. hope you don't mind... LOL

The easiest way to setup the most unsecure sendmail service in linux

Yes, the easiest way, and yes, the most unsecure, i mean it.

I hope this blog will help you. This is what I've found after 2 days of reading and frustration of trying to set up sendmail server/client for whole day.

And trust me, never setup sendmail on Friday... @@



--- Setup Sendmail ---

-- Server --
#vi /etc/mail/sendmail.mc
= Replace 192.168.168.1 with your mail server's IP.

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=192.168.168.1, Name=MTA')dnl

## and...
= find "relay_based_on_MX" and comment or replace it with "loose_relay_check"

dnl #FEATURE(`relay_based_on_MX')dnl
FEATURE('loose_relay_check')dnl

# then..
echo "Connect:192.168.2 RELAY" >> /etc/mail/access

-- Client --
# find following line in sendmail.mc and change it.
[root@bb ~]# grep mail000 /etc/mail/sendmail.mc
define(`SMART_HOST', `mail0001.test')dnl


-- MAKE SURE --

= check if sendmail is listening to port 25
netstat -ant | grep LISTEN | grep 25

= check local or the service connect by telneting the port
telnet mail0001 25

= check sendmail status
service sendmail status


--- Links ---
-- Howto --
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch21_:_Configuring_Linux_Mail_Servers

-- Masquerading --
http://www.brandonhutchinson.com/Sendmail_masquerading.html

-- Mail Relay --
http://www.sendmail.org/m4/anti_spam.html

PS:
Here is the story be hide this post. Has any one found that the documentation of sendmail is a mess?? I always found it overwhelm, all the tutorial gives you some options that you may not even understand. That's why, I think it's good to setup the most basic one and then build stuffs on top of it. Making a service work is more important than any thing after all. Well... the worst thing about the way I setup is someone may use you mail server to send spam.... well... u lose some resources cos people may use it to send spam but, you can setup other options once you make sure every thing is working.

20090723
When I read this page again, I found that the reason why I could send it, it`s because I have already accept all my internal network. After doing more configuring with sendmail, I realize it wasn`t a fully open relay. I now have SSL configured with sendmail and dovecot. I may post the tutorial later, once I`m sure that`s really working and it`s the simplest way to do.

Tuesday, June 30, 2009

Laziest way to set SSH without password

I've been crazily busy lately, finally got a chance to check our fabulous CDOT planet again. Saw a few nice posts from LUX classmates. As the king of blog in LUX class, of course I have to post something, I'm gonna beat Kezong!! hehe... (see below for Kezhong's blog)

Yesterday I just did public key authentication too. You can actually do the following to minimize all the work. All you have to do is copy and paste following and type your password twice. :-)

===== Commands =====
##### Step: 1 #####
ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
Key=`cat ~/.ssh/id_rsa.pub `
ssh -f -q nestor@bossanesta.ath.cx "echo $Key >> .ssh/authorized_keys"


##### Step: 2 #####
ssh -f -q nestor@bossanesta.ath.cx chmod 600 .ssh/authorized_keys



===== Verify =====
# if dosen't work, you can always use verbose/debug mode to see the ssh process..

ssh -vv bossanesta.ath.cx

# if still dosen't work and you're sure your file and permission is right, you may want to check the server sshd config file and make sure Public Key authentication is enabled. It's enabled by default anyway. Also you may need to create and change the ~/.ssh folder permission by yourself, if you have never ssh "from" the server/target.

##### IF SOMETHING GOES WRONG #####
Just follow the official guide step by step.. :-)


=== LINK ===
OpenSSH Public Key Authentication

A professional article about Public Key Authentication from very profession LUX student

Wednesday, June 3, 2009

Weekend; Toronto Island; Unplug day..




I've been quite busy for work and things that I want to learn in this field. Last week was very busy. So, last weekend, I decided not to do any thing about computer.. well.. i did tried. I went to Toronto Island for photography. I found that's the best way to be away of computer and get some real fresh away. :-)

I did about 300, 400 photos in there, went there around 5pm and start shooting once I was on a boat. I was surprised that view was so good from Toronto Island. Too bad there were a bit of fogs. I should go there one more time when humility was low. Any way, hope you enjoy the photos. Save them as your wallpaper if you want. :-)




hackers; spider; IDS; spam

In last few days, I've been getting a lot of possible attack warning from my IDS. Before, i always get some local port scan, brut force attack. Yesterday, I found one form Hong Kong.. i was like.. how could that be?

Then, I found the reason. 1,2 days ago.. I login to a photography site and post some of my photos, and I updated my profile and put my domain name on it. That site is from HK.. so.. I guess that explain why I got more attacker from HK.

Nes: 20090603:2030
I totally forgot to mention about "spider". I believe after posting that photo site (dcfever.com) I got attack from HK. I believe somehow some hacker use spider program to search every one's profile and see if there is a site. I believe that's how they got my site. I'm putting myself in a hacker's situation, I would do this. Why waste the time to surf every one's profile and see if there is any possible site to attack?:-)

I've been thinking to do something interesting to my possible attacker. I was thinking to hack them back.. but. hehe... i'm not a good hacker and i dun wanna get in big trouble. So, I've been thinking to telnet their mail port (25) and use snmp protocol to send them an email and tell them that there is 'someone' trying to hack other people's network. (hey, if someone trying to login my ssh with root or ssh more than 5 and it's not me, i'm sure that's not accident!!) That would be fun.. but I think i'll have to mangle my IP too. Just send that mail command, i wouldn't care if i got receive back.

Unfortunately, my Rogers broadband block port 25.. sigh.. I've been thinking to switch an other ISP.. found one for $45 with a static IP and all port open!! That seems to be a good choice tho.

Monday, May 18, 2009

My IDS has some Interesting reports.. got attacks from a security blog server

In the LUC course, we wrote an IDS program in perl. After setting up my own server, I put my IDS there and add on some simple features. When ever there is an possible attack, no matter if it's brute force, port scan, I will block the source IP and also port scan back with "nmap -A -PN", then output the result in my apache directory. It's been running for a while. And my IDs has collected quite a lot of interesting reports.

As far as I know, the source IP can be a hacked machine or from a network. Althought I may not able to track down the attacker, but I would like to see where it's from. One of the source has an entry mentioned about an site called "http://echelon.pl/", it blog talk about IT security or.. IPSec... I'm thinking how could it end up attacking my server? haha...

Tne entry:

106/tcp open pop3pw Poppassd 1.8.5 (http://echelon.pl/pubs/poppassd.html)


Anywya, if you're interested, you can see all the nmap result here.. And have some mercy.. don't hack my server.. ;-)

http://bossanesta.ath.cx/NesIds/nmap/

Sunday, May 3, 2009

FREE Photogrphier for Open Source and Seneca!!

Dessert Flower, love the contrast

Just bought a new lens, Nikkor 50mm F1.4. It's super amazing!!! It's not expensive tho, I bought a used one for $320, a new one is around $350. It's actually a mid-priced lens. cos the top one should be 50mm F1.2 or 80mm F1.4. But.. u know what? this is amazing!! When I first saw the photos, i was like.. OMG.. are those really my photos? hahaha..

I would love to dedicate my hobby to all every one involved in open source and Seneca. Let me know if I could help you. And I'll try my best!

PS: look at my tittle, geez.. i should be in media instead of computing. Maybe I've read too much gossip magazine, hahaha..

SHOW TIME!! Great deep of view from my Nikkor 50mm F1.4

Zen, love the colour match and the peaceful sweet scene

CDOT Student Presentation 200904 in Flickr



Finally, I've uploaded it, hehe.. If you want the original, please let me know.



CDOT Student Presentation 200904 in Flickr
(Full Screen, flash required)


CDOT Student Presentation 200904 in Flickr




Thursday, April 30, 2009

Another Andrio Phone, Samsung i7500



Cool.. finally, another Android!! Really looking forward to see the real thing. I actually have been using my iPhone at home when I have problem with my network. It's just so cool and convenience. When every I need to test WLAN or LAN, I would use it.I can run ping, nmap, sniffer, tcpdump, ifconfig, etc networking tool on my phone. And in last few days, on my brother's request, I setup tittering for his brand new Asus 1000HE, so he can connect the internet any where with his 3G network. And he loves it!!

And it should be practical at work also. You know, in some critical production site or some data center, it's quite hard to get internet connection. Using your phone, which allow you connect to the internet without affect the production site network, this is amazing.

When there is a new iPhone coming up(next year?), i may get a new phone, it should be either the new iPhone or an Android. Frankly, mostly i'll get the new iPhone. But if I do use it to type command.. well.. an Linux based smarphone with slide keyboard should be a better choice tho. Although I do love the touch screen on iPhone.. but for typing? A physical keyboard is much more better tho.

Consider Linux SmartPhone is going to be the future, should every Sys admin get a smart phone?


Samsung i7500 in cent

Hands on preview in a Russian site

Friday, April 17, 2009

mNm Release 0.9


mNm Release 0.9

= integrated multi-language support
= progress bar & message
= Existing Code migrate with Fedora First Boot, as a plug-in in 'Create User' Module
= Improved Auto Mount (instead of un-mount every thing, it only mount non-existing one)

Sunday, April 12, 2009

OH.. My gosh... i almost delete all my post in blogger..

I was managing my label/tag of my post to prepare my project presentation.. i click on the 'delete' below 'apply label', it thought it's delete the label. But no!! it deleted my blog. I actually doubt about it already, but as labeling a blog has an undo function, i thought delete a blog should have an undo, right?



NO!!! IT DOSE NOT!!



Lucky that I was playing blogger because my FreeBSD assignment needs to import post from blogger to wordpress. And I did have a backup... that I didn't even remember. Thanks god.. every thing is here.. :-) I still wanna show my blog to my grand children... LOL

Monday, April 6, 2009

Migrate aNd Manager Release 0.8 Progress Update

mNm running as an Firstboot module


So... I've been trying to put mNm to merge with firstboot. Althought I should contact firstboot owner soon.. but I still want to make sure my program will not have big problem when integrate to firstboot. I've been playing around the modules. After 2 days of testing, I finally figure out a way for it.

Instead of using it as a module in Firstboot, mNm should be used as a plug-in (Please correct me if this is not the proper way to call it.). So.. in "Create User" module, user can also choose a 'Network Login' thing.. (honestly, i dun really know what it really dose tho). It calls up '/usr/bin/authconfig-gtk --firstboot' as a process. So... that where mNm should be!!

Let me also talk why it should be a plug-in. I was thinking if mNm should be replacing 'create user' module or should be an alternative module. But the logic is kinda wired. and firstboot dose not run like that. Firstboot will call up modules one by one in sequence. As mNm will do automount, it's kinda silly to mount every thing even mNm will not even being used. I believe running mNm as the Create User plugin is the best way to do. And also.. it seems that calling up mNm as a module in firstboot is not possible. As you can see in the capture that I run mNm as a module and the item list is blank. Maybe there will be some way to do.. but if the plug idea is working.. why bother? :-)

But I will still confirm with my super duper professor Chris Tyler first. Then... multi-language!!


Here is some improvements I've also done in last two days..
1. disable umount when calling up 'AutoMount'.
2. It has a bug that, if the user folder contain file, mNm will crash. This issue has been fixed.

PS:
Finally, I fixed the problem in the tree list when mNm running as a module in firstboot. I've also uploaded the capture as the first image. (Nestor, 200904071200)

mNm running as an plug-in inside Firstboot module 'Create User'

Wednesday, April 1, 2009

Migrate aNd Manager Release 0.8

This version of mNm has a functional GUI that will provide all functions that need to be done for firstboot. Although there are some small improvements need to be made but Since it matches all milestone that I planed before except Multi-Language font part, therefore, I'm posting it here.

Hopefully, I'll have a newer version of 0.8, which would be called 0.8.1 coming this weekend that will have scroll bar and it will a better version of 0.8. The next release 0.9 should be a fully working version. And I'm targeting to do bug fixing and improvement after release 0.9.

Here is a list of things that I've added in this 0.8 release...
* check boxes
* auto mount (add on auto mount to mount all supported types)
* auto search (including OS type and users, default OS User home only)
-- get supported OS type from database
-- put list of supported OS object(classes) in a list
-- find out if the mounted drives (just in all drives except default live CD user) has any user

mNm Program/Source

mNm Main Page in FedoraHosted

Monday, March 23, 2009

Migrate aNd Manager Release 0.71


Welcome to the team
First welcome Kezong Liang, Stephen joing me on this project. Stephen will be concentrating on multi-language support of the program.

What's in 0.71 release?
This release is a preview of 0.8. Several bugs have been fixed in GUI mode. And it could be download with yum from Mohak Dilipbhai Vyas.
The GUI function is only showing ideas of how the GUI may look like.

Instruction:
1. download this rpm package and put vyasrepo in your repo list
http://matrix.senecac.on.ca/~mdvyas/vyasrepo-10-1.fc10.noarch.rpm
2. type in this command..
yum install mnm

How to run...
the program will be saved in your /usr/sbin/. If you do not want to risk you documents, running in virtual machine is strongly recommanded.

Thanks
Thank you for Patty, Milton on helping me testing this program, and Mohak kindly packaged this program and put it in his repository. And of course all the hard work from Stephen Liang. :-)

Wednesday, March 18, 2009

How many VMs can my Asus EEE PC handle?? 2?? no.. 4?? em... hehe..




Intro:
I've been working on my NAD project with vbox's vms.. i'm really curous what this little single core cpu machine can do. Here is the config..

Asus EEE
- 2G Ram (MAX for eee)
- Fedora 10
- fresh boot
- laptop mode (as real ram as much as possible, instead of swap)
VMs
- 4 F10 with 256 ram, 4mb Video ram, text mode (init 3)
- 1 F10 with 512 ram, 12mb Video, X windows

Assumption:
- F10 host (Asus EEE) fresh boot with X running use about 500-700mb
- One F10 VM in text mode use around 250Mb
- idealy
- total 2gb ram means I can use at least 5 Vms.. (700+(250*5))
- when the VM in text mode and idle, it use 5-15% CPU
- start all VMs one by one to reduce run time and chance of crashes

Result:
- IT WORKS!!! 5VMs running smoothly!!
- impressive!!
- it use some swap but.. well.. cos the last one was 512mb F10..
- it may able to run 6 VMs smoothly if I have 2 more 256mb ram F10
- really impressive!!
- if it has service running (httpd, dns).. it may use a bit more memory... and a lot more CPU. using a 'find' command use 60% host CPU already!
- it may able to handle 6VMs or even 7VMs in text mode and still have an acceptable performance. even with some simple service on and those are not busy services..
- it's perfect for testing...
- it's absolutely impressive!!!! ;-p

Adding a bridge NIC(virbr, br, pan) in Fedora 10(F10), purely command lines..

I've been using Virtual Box for a while and love it. But the downside of vbox is you can not use your NIC's alias as the bridge or interface. So, I found out a way to add a bridge NIC in pure command mode. Since there is no such tutorial online, I would love to write this down and share with you. This is just a short tutorial that to show you create a virtual NIC in command lines only.


========================================================================

brctl addbr virbr2
ifconfig virbr2 up
ifconfig virbr2

# now, record the MAC address of your Virtual NIC

vi /etc/sysconfig/network-scripts/ifcfg-virbr2
# and type all following lines in there,
# but modify 'HWADDR' as the MAC address
# and change the IP as you want.

TYPE=Ethernet
DEVICE=virbr2
HWADDR=B6:9F:39:E6:DC:64
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
PEERDNS=yes
IPV6INIT=no
NM_CONTROLLED=no
NETMASK=255.255.255.0
IPADDR=192.200.200.2


# now, check if it's really working
# if it's successfull, the ip you typed before should be assigned
service network restart
ifconfig virbr2


========================================================================
then, your virtual NIC should be up and running after restart.


PS: i put a long title on purpose, so other people can google it. :-)

Monday, March 16, 2009

mNm Update



I've been working on the GUI after 0.7 release. The next release will have a working GUI that automatic mount Fedora supported partitions, and detect all users from supported OS. It will also have a click box that allow user just migrate certain folder, mount or users. And of course, automatically create user if the user is not existing.

And finally, I got my tree working with check box. The next step will be integrating these check box with the migration process. Since I don't have good foundation on python GUI module, this may take me a while.

But i can't help myself to show off my work, hehe.. even there is a lot to work on..so.. here is the capture...

Friday, March 13, 2009

mNm Release 0.7

Finally, GUI can work with out command lines!! :-) right now i'm calling "create and move" function to do file copying and automatic create users. This function will be the foundation of the program and it will be good enough to use in firstboot.

Anyway, here is the code...
mNm Release 0.7 source code

Sunday, March 8, 2009

mNm Release 0.6.3

It's only been few days after release 0.6. This release of 0.6.3 is not for bug fixing, it's actually some internal improvement of 0.6. It is kind of an early release 0.7 I have successfully move every thing into a class. And instead of putting supported OS database in array, i put them in a file and import them when necessary.

The next step of 0.7 will be targeting on calling internal function from GUI instead of using os.system to call up mNm in bash.

If time is allowed, I will also create another function to get all supported OS into a list. So, the GUI could just call up the function and user will be easier to choose.

Soure Code of mNm0.6.3


Some more to share...

It was tough to restructure the whole program. Especially it's about 800 lines of code now. Sometime I've totally forgot what i have and what i was trying to do in the code. So, I try to work on 0.7 as soon as I can, so i don't have to pick up again. ;-p

And surprisingly, every thing go smoother after 0.6 release. I didn't expect having my function use those classes would be so easy. I only spend about 5,6 hours from 0.6 to 0.6.3. That's a relief. :-)

Since the foundation is much more better now. All I have to care is improving the GUI, and build some small functions if necessary.

Wednesday, March 4, 2009

Migrate aNd Manage(mNm) Milestone for Release 0.7

Before adding functions on GUI, I want to build up a better foundation. At this moment it is impossible to have mNm pure GUI mode. Currently, mNm GUI will organise a command line with all parameters and call the line in batch. Which is acceptable but not a perfect GUI if I want this in firstboot. There for, I want to build a better foundation so I don't have to worry about variables in the future.

So, here is the milestone for mNm release 0.7:
= put all supported OS type and directory list in an array which is stored in a class for easier management and calling.
= GUI call up internal functions, instead of calling batch.


Please check the link below for updated milestone.
mNm Milestone Release0.7in FedoraHosted

Migrate aNd Manage(mNm) Release 0.6

After all hours and days of debugging, finally, release 0.6 is here. It sounds easy to put all variables into class, but.. OMG.. i couldn't believe how tough it was.. So I had to change my mile stone. But the brightside is, it's always better to improve the foundation instead of changing it later when its more than 2000 lines of code, right? Luckily... I have only did 800 lines... ;-p

Anyway, here is what I've done for Release 0.6...
- those code of sorting flags and calling function will be put in 2 functions instead of on the upper level lines. It's better for future development.
- put global variables into classes
- fixed all bugs after moving all global variables into classes - added a variable named "ProgMsg?" for easier debugging

mNm Release 0.6 code in FedoraHost

Migrate aNd Manage Release 0.6 Progress (and problems..)

After bug fix of 0.5, which is 0.52. I've moved all the codes into functions. I found there is problem on calling few functions, such as calling help.

After hours of testing and searching, I found the reason. The reason is because the way python handle global is totally different to my other programming language experience. Of course, I can assign global variable in functions then, I can change it in any where, or I can pass the variables. But... I think I'll change all variable in a class, so I can call up any time any where. And I think it's better for future development too.

This release's coding is more than I thought. It's more like restructuring the whole program instead of adding code on it. @@ And I'll have to do a lot of testing to make sure all variables pass successfully too. And I need a little plan on it too.

And the reason why I'm putting every into functions is because it's easier for GUI development. So I can actually call up the functions form GUI instead of just call up mnm in bash command with all parameters.

Thursday, February 19, 2009

CDOT photos - 20090220


Hi, guys.. I've just editing all the photos. and posted it in flicker.com. For some reason, some of the photos in flicker dosen't look so nice. Therefore, I also saved the edited photo in my matrix account. Please see the link below to download. And, yes! facebook.. go tag yourself. ;-)

If you want the original files, please let me know. They are saved in Nikon RAW format (NEF). Make sure you have around 1.5Gb space for them.

LINKS:
flickr
Edited JPEG in zipp format
Facebook

Monday, February 16, 2009

When i'm waiting for my vm to update..

I'm now waiting for my vm F10 to update... Suddenly wanna blog about a little feeling on learning Linux at Seneca.

Last semester, I was struggling about installing wifi and drivers in my fedora. Learning to use all the tools that I need to replace Windows. This semester, we learning more advanced technology. And I really love stuffs that I'm learning in this semester. Especially networking... we're actually doing a networking with all command service: web, DNS, mail, routing, firewall.

It's been tough weeks in last 2 weeks, I was struggling to setup a VM networking with little knowledge on VM and networking. Well... I did learn networking, but when I have to put every things together, I was confused. But I know it's the learning curve, the turning point. It means I'll be making a bigger step!

Some how I feel a bit relax today. Because I've found that I've learn a lot in last few weeks. Just few months, from knowing almost nothing about Linux to right now, I'm able to start understanding Linux.

Since I'm not working this semester, I've been sitting in front of computer at least 10 hours every day. But I always try to spend one day a week with my parents, take them around in the city or have a cup of coffee. And they love one dollar stores. ;-) That's the only entertainment I have every week... beside watching a movie once a while.

I have to thank Raymond Chan has spend a lot of time on teaching us. He even came in to Seneca on Valentine's day to help us on networking. And it was a Saturday!! And of course, Chris Tyler.

There are still a lot to do, few assignments and mid-term... I know it's gonna be tough, but I'll try my best. If 10 hours is not enough, then I'll spend 15 hours! I just can't give up!!

Oh.. yes.. VM's done upgrading.. time to go back to work.. hope I can go to bed before 3am.. cos I need to wake up at 7...

Migrate aNd Manage (mNm) 0.5.1 and milestone

I found a bug right the day after I post my 0.5 release. It had a problem when using GUI to call up mNm in bash. It will be called mNm 0.5.1 Release.

And I've also have my mNm Milestone posted in FedoraHosted. 0.6 Release will be concentrate on bug fixing and restructuring internal functions.

Please links below for details.

mNm 0.5.1 Release
mNm Milestone for Release 0.6

Friday, February 13, 2009

Migrate aNd Manage (mNm) 0.5 Release



This is the GUI release of Migrate aNd Manage. This GUI verion only support single folder migrations. Again, the source can be found in FedorHosted.org

GUI feature:
= Auto typing
= Call up mNm single user migration function

Wednesday, February 11, 2009

The VM CLone War...




= The VM Clone War =
Lately, the LUX team has been using VM a lot. And I think half of us are using Virtual Box. And we have to setup a network with VMs. Instead of installing your system one by one, you can actually clone you hard disk and add another vm. On my beloved LUX-ers requested, here is how your clone your vm HD.


=======================================================================
1. First, clone your hard disk with VBoxManage command
VBoxManage clonehd /media/NesEeeStorage/VMs/vm-Fedora10c.vdi /media/NesEeeStorage/VMs/vm-Fedora10a.vdi

2. Add your new vm with a different name.
=======================================================================
Here is the capture....
=======================================================================
[bossanesta@NesEeeF10 VMs]$ VBoxManage clonehd /media/NesEeeStorage/VMs/vm-Fedora10c.vdi /media/NesEeeStorage/VMs/vm-Fedora10a.vdi
VirtualBox Command Line Management Interface Version 2.1.2
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

0%...10%...20%...30%...40%...
=======================================================================


=== NOTES ===

= if your VM's HDs are in different path =
The VBoxManage is kinda weired. When you run it, it will only search vm's harddisks in default path. So, if you changed your vm location like I do. Use full path just like me.

= creating VM with command
You can do it in GUI mode or.. if you wanna be a VBox-Guru, try "VBoxManage create". "man VBoxManage" is your friend.

= about VM networking
I've been trying to create a VM network. well.. got a lot of trouble.. @@ but i found there is a typo in VBox's office tutorial . It drove me crazy, cos I didn't expect a simple mistake from an official site while a lot of people I know got help from that page. So, I was trying to yum install this and yum install that.. My ubuntu's vbox is not working now, cos somehow I got a wrong version of vbox. Anyway, here is the typo....

PATH=/sbin:/usr/bin:/bin:/usr/bin <== the last one should be "/usr/sbin".

= It's cross platform!
Do not forget that VBox is cross platform! It means, If you have a dual or tri or quad boot like me, you can run your VM in Linux, Windows, Solaris, OSX!! That's the reason why I'm using it instead of KVM althought KVM provide a better control.

= Cloning is good news for lazy sys admin
It's always good to keep a copy of your VM. Because if you don't have enough time to trouble shot your VM and things happened. You can always go back to the one your clone before. I have been using VM for 1 months, created over 10 VMs so far in 3 tri-boot laptops. And I found that sometime the VM's hd got problem if you restart a lot. And I always just use another one, cos it's faster than scanning the HD.

= DO NOT UPGRADE!!! =
I not a big fans of auto update. First newer dosen't mean better, second, you may have a big chance that things are not working. That including linux kernel and vbox. When I was trying to install VBoxManage, I downloaded the package from repo.. and.. my vbox dosen't work any more. I guess it happened to Mohak(vyas) also. And he used the windows way to fix this linux problem --> uninstall and install. And it worked... @@ Looks like I'll do the same thing... I'm putting this in the last point, cos I dun want ppl know that I'm using the "windows way" to trouble shot.. and u know.. ususally people dun even bother read the whole blog. ;-p

Wednesday, February 4, 2009

A Emtional FreeBSD in VM, with bad temper...


I've been trying to install FreeBSD in Virtual Machine since week 1. The first few times, I was stuck in how to install it. Yeah.. i guess I get to used to "next-and-next" installations. The concept in FreeBSD is totally different.

Some how I managed to find a simple installation guide for FreeBSD. Obviously the official guide didn't help me. So, I managed to install in a Toshiba Laptop which runs a Intel Celeron M CPU.

And a hardworking student like me, of course, won't be proud of using a step by step installation. So, I tried to install in another Compaq laptop which has an Intel Dual Core CPU. And I even learned more the installation procedure. In BSD, every thing is manual. If you miss a step, you may end up installing nothing but with an error in your boot loader. And somehow the standard FreeBSD bootloader never work for me. I had to use MBR instead. Of course, I've got no clue why...

Interestingly, FreeBSD crashes all the time in my VM. Even I tried to install few times, because I thought I did something wrong during installations. Anyway, re-installing didn't work. It just shutdown itself during boot. But I could to safe mode.

Then I talked with my classmates, Milton. Miltan said he had simular problem, but it worked after he restarted. Well.. not in my case, I tried restart few times, went to safe mode and restart.. no.. didn't work.

Right now, when I'm just about to turn it on and tried to capture a screen shot of its dead-look and also check the logs. It works!!! @@ tried init 6, restart... still works...

I've got no clue at all. I guess maybe it's because of I changed the NIC and I had to install the driver. I'll try to change the NIC again and see what will happens.

I tried it on Friday for the whole day, 7 hours!!! not mentioning other time I put in. What have I done to deserve this? ;-p

Friday, January 30, 2009

Migrate aNd Manage (mNm) 0.4 Release

In this release, mNm will support space checking with a single command. This will be useful for both command mode and in GUI mode.

And mNm has successfully obtain a space in FedoraHosted. This project's wiki has moved to FedoraHost from zenit's wiki. All the information and source will be found in there. It will be open to public for every one to try out.

Link:
https://fedorahosted.org/mnm/

Thursday, January 29, 2009

What? Linux on iPod??!




Yes, that's right.. and they're working on iPhone also.. They have successfully install kernel 2.6 in iPhone..

I was talking with Chinmay Patel about linux and iPod. I told him that he may able to install linux on his new iPod Nano. And he was interested about it. So, I went home and do some searching.. cool. I am so surprised people has successfully installed linux in different type of iPod...

But.. looks like it dosen't support the new fat iPod Nano yet.. well.. u know, it's fun.. but.. how can you type stuffs there???


Download page from iPodLinux.org

More Screen Shots..

LinuxOniPhone Blog

Monday, January 26, 2009

Disable root ssh...

I've been wanted to run my own testing server. Finally, I set it up today. Sign up an account in DynDNS.com. Set up some setting in my wifi router so it can update my dynamic IP regular. After some configuration, that's it! It was like 10mins work. ssh works, tunneling works, sftp works.. nice!

But of course, having a server that would let people connect to it is quite dangerous. Especially, it's my home network. I was lucky enough to see Professor Raymond Chan online.. oh.. i'm not gonna miss the chance, right? SO, I asked him the best way to setup the iptables. So, I drop all incoming, except ssh port. I'm gonna open port 80 so I can play apache server a bit. ^^ And on my router side, I set more security options in my router. I may setup a VPN or something, just incase if someone hack into my server. They can't access some of my Windows machine.

Then, did some testing from different network... from cdot machines, from my iPhone.. cool.. it worked! But connecting from iPhone needs some trick. The trick is have to make sure the iPhone has an IP first. It's kinda weired...

When I was testing the login, I almost forgot to test if I could ssh with root.. oh.. yeah.. gotta disable it. 30second search on net, found the disable root login. I would love to share with any one...

= First, make sure u have root privilege, u can either use "sudo" or "su -".. then...
vi /etc/ssh/sshd_config
= find the following line.. remove "#" and change "yes" to "no"
PermitRootLogin no
= save and test!!

That's it!

At this point, I'm not sure what I'll be testing on it.. Apache, of course.. I may set up a small Beowulf cluster if it's possible. I hope I'll able to run VM in this machine.. but this machine is only like 700mhz AMD CPU with 512 ram.. it'd be really slow to run VM.

Ideally, I should put this server in front of my home network. Set it as a router with strong firewall protection, put my home network be hide it. I don't have a real plan for this yet... Lets see if I have time for it... ^^

Sunday, January 25, 2009

youtube and my mum.. and.. woodmaking...

I've been doing the lab.. feeling like to relax a bit.. so, let me blog something interesting here...

Recently, my mum just got a new computer, so she can use dictionary with a computer and I can have one more new toy too. ^^ NICE!!

After days of installing and reinstalling... I manage to install Fedora 10.. oh yeah.. but..too bad that the sound card driver dosen't wrok so well.. StarDict dosen't produce some good sound. And Adobe flash dosen't work too.. well.. all expected... SO I just have to let her use XP.. too bad..

Then I showed her youtube.. she loves it. Now, she can watch her favourite show online...looks like.. My dad and I have to eat instance noodle for weeks.. hahaaha..




I read about Comp Study in high school by Chris Tyler few days ago. I woke up in the morning.. day dreaming.. then I thought.. wait.. woodmaking dose related to programing!! hahaha..

Have you guys wiki the story of first PC from Apple? Oh.. yeah.. the hand-made one.. by Stev and Stev (I think "Stev & Stev sounds better than "Apple", more designer feel.. haha..) Common.. maybe one day some Ontario high student can create a hand made computer or robot or something, right?

May Ontario Gov should consider teaching students how to hand draw diagram.. and.. perhaps we should start writing our programming language in papers! Put all your code on the paper.. just like how we did in exams.. ;-p

Of course.. I was joking..



PS: ops.. dunno why the pic appeared so before.. it's fixed now. ^^

Thursday, January 15, 2009

More about Virtual Machine with Sun VirtualBox





I've been working on a little project on Virtual Machine. And I was trying to setup a network for our networking course, so we can do thing like Beowulf clustering. I used VirtualBox, since it's a cross platform. Because I have tri-boot with Vista/OSX/Fedora. So I can turn on my VM in any system and work on it.

After hours of searching and testing. Finally, I can ssh to and from my VMs and even connected to outside world. Thank you John64 and Vyas(Mohak) testing it for me. There are a lot of things that I'm not quite sure too. But since I've gotta stop playing with my VM and go back to my labs works. I can't spend too much time on it.

Anyway, here is the command to enable port fowarding with the build-in command "VBoxManage". This command allow you control VM configuration and even create a VM with one line command...

= enable Foward ports 2222 to 22 in VirtualBox =
# VBoxManage setextradata vm-F10i686 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
# VBoxManage setextradata vm-F10i686 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
# VBoxManage setextradata vm-F10i686 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP

NOte: - vm-F10i686 - is the name in your VirtualBox, not your hostname

= Check configuration with VBoxMange command.
# VBoxManage getextradata vm-F10i686 enumerate

The good thing about using port forwarding is easy. But it has limitation also. Like... if I want to VNC to/from my VM, i'll need to forward another port also. So, instead, my next little project will be working on using DNS server, etc to setup a network (virtual network?) for my VMs. And I'll be using my host (my laptop) as the router, DNS server, etc.

And her are some trick and tips I would like to share with you..
1. If you are setting up same VMs in different machine. You can actually save your image file (.vdi). So you don't have to install again. But it seems a name is writed in the file also. So, I wasn't able to duplicate image file and having two same config VMs running in same host. I may spend sometime to hack about it when I have chance.
2. There is a build-in function called "snapshot" that allow you to capture the system status and recovery it later. But instead, I just copy the image file instead, because it gives me more flexibility when I'm using it in different OS.
3. Install Guest Additions, it's just fun to see a full-screen high resolution Fedora running in your Vista! I was able to have 1440x900 to use my Fedora VM in osx and Fedora host!
4. If you want to have a tri-boot VM with XP, Vista and some Linux. You may want to install XP, Vista and Linux in order. I would suggest to put XP, Vista, Swap as the primary and put all other Linux in your logical drive. Yeah... You can put all different Linux in your vm, Fedora, Ubuntu, FreeBSD... (the list goes on forever)
5. If you have backup, and somehow your vm system is not working. Instead of fixing it, you can just mount the old image file back! It's not a good admin should do, but... if u know the stuffs.. why do it over and over again? ^^

Actually, There are still a lot of things I want to explorer about VM. I could spend a month on it without doing any thing else. But... I'll save this fun later when I'm done the LUX course. Lets put study first. ^^

Nes

Sunday, January 11, 2009

Fedora and my dad..

My dad loves technologies.. but not really brave enough to try new stuffs. I've been asking him to try the Fedora Live CD for months, but he told me there is something wrong to boot. Finally, I got a chance to install F10 for him... hehe..

His desktop is full of virus... no matter his Vista or his XP. You know, once you are using Windows, you don't have to worry about virus, cos you'll get virus for sure, so, why worry? Even if you use it very carefully, you may still need to format and reinstall it after 6 months... well.. in my experience...

Anyway, I setup a Tri-boot for him. He got XP, Linux and Fedora 10 running with a 300Gb big storage for him to spend, since he swap his external 500Gb as the internal now. And I think he kinda like it. I've seen him sometime boot up Fedora and try this and that. Of course, I was a little tricky, I put Fedora if he dosen't press any key at start up, hehe.. so he'll get in Fedora instead of other OS.

And, he always got problem with his video capture card in Vista, cos he couldn't manage to find a driver. Then I found that F10 already support his card. Looks like he's gonna use it more than those Windows....

When my dad really know how to use F10's interface, I think i'll do the same thing to my mum's laptop too. I actually, installed Firefox for her laptop and I think she dosen't even know what's the different tho. If I can manage to find a dictionary with real person speaking... then, she's gonna love it.. ^^

Friday, January 9, 2009

Re-installation for T2107...




On 5th Jan 2009, we all get together and reinstall few different OS in the computers in lab 2107. It was fun and we learned a lot.. here are some photos...

















Since I'm so jealous that people can go to FudCon11, I've gotta post more photos here to cover their news, hahaha.. lol

Objective C developers will like this...


I've been thinking to organize a iPhone and iPod Touch Club since last semester. Finally, I've made my first step, got a form from the office.

It's gonna be a club for end user and developer exchange information and learning together. For regular, they can learn how to use build-in application. For developer, it's a good source to exchange beta softwares, tips and tricks. And you can also let people to try your little code.

Since there are a new objective C class starting coming semester, I think there are a lot of people would be interested. ^^

More detail are coming... if it got approved...

Nes