Posts

Showing posts from April, 2008

Linux From Scratch Results

FAIL. Its a common theme with my attempts to compile almost anything more than a basic app. I made it quite far but who knows where I went wrong. The problem really is that I have no way to know if everything compiled correctly. This time round I feel that I have managed to do all the compilation right but failed somewhere in the configuration steps right at the end. Oh well. The partition I used has once again cleaned out in anticipation of the next bit project. In all it took two evenings to compile everything. Not bad compared to my last attempt on my old computer which took a whole week of evenings. Go DUAL CORE CPU and 2 Gb Ram!!!

Linux From Scratch ( LFS ) - An experience!!!

I have toyed with LFS before, but never on a system where I had any real chance of it actually working. I am now currently half way through chapter 5 of the book. This is the chapter where one compiles ( from source ) all the necessary components so that one might compile the actual components. This process of building a toolchain on the target system is supposed to provide for a fully optimised Linux. The source code used is all released under the GNU license so it's a completely free operating system. There is no real reason for going through this ultimately very boreing and labourious excersise other than to say, "Yes - I too have toyed with and successfully built my own Operating system from source code downloaded off the internet." You can download the binary LFS, or by a CD with a fancy installer. LFS is a book with instructions on how to build an OS. The best way to read it is, of course, online so that the commands which are all nicely laid out in boxes with

Website hacked

My website was hacked and made into a phishing site. Some kind of issue with cross site ajax blah blah. What is a bit unhelpful is that there was no real information regarding this kind of hack ( I mean specifically ) that would help me to fix it. Anyway - The only thing I did find was that I should lock down the file permissions on the web server. I found all these renamed directories and one that didn't belong there at all. The lesson learned here is that even if you make a mistake with file permissions thus opening your web servives and sites open to attack, you should make a point of knowing all th files and folders so that you can spot an anomaly and fix it. Of course this doesn't mean that all attacks of this nature rename your folders and files. They may simply change the content so the result is still a comprimised website. I guess, a preemptive move ie: correcly setting up the website and server, is the best defense. After that be aware of strange things. I rec

Tiny MCE

A couple of days ago, I started preparing for the long and arduous journy where I would teach myself how to integrate a TinyMCE rich text editor on a web page. Here is how it went: Downloaded the source - This is always my first step. Get the source. Nothing to do without the source. Read the readme page which was really just a bunch of examples with the code all nicely rendered on the pages. Tried it out. Easy peazy!!! Went to bed - feeling VERY HAPPY with myself. Getting a TinyMCE rich text editor is so easy to setup its a wonder why we don't see it even more often on websites. I know that every wordpress site and most CMS sites have it by default but a lot dont. So just: upload the javascript files to your webhost. Add the tags to the head section of your site that identifies the source. ( see example below ) Add a small bit of JS to set up the editor. Add a <textarea> </textarea> on your form. Done. <script type='text/javascript' src='lib/jav

Qemu networking part 3

Finally I have worked out how to network multiple guests together. Its done through a socket interface. The first guest listens and the others connect. I havn't tried with more than two guests at this stage but it did work. Add the following net switches to the startup command. start first guest. -net nic,macaddr=52:54:00:12:34:56 -net tap,vlan=0 -net socket,listen=:1234 start second guest. -net nic,macaddr=52:54:00:12:34:57 -net tap,vlan=0 -net socket,connect=localhost:1234 And thats it then. Time to start playing with domain controllers et. al.

Qemu networking

I have been fretting over this issue for a while now. Have finally worked out how to give qemu a network connection that joins with a bridge and thereby a connection to the host. Qemu can create a tap interface that does all this magic networky stuff. It does work... :) Write 2 network scripts as below: ( don't forget the chmod +x on each file. ) [root@sitedesign ~]# cat /etc/qemu-ifdown #!/bin/sh /sbin/ifconfig virbr0 down /sbin/ifconfig down $1 /sbin/ifup eth0 [root@sitedesign ~]# cat /etc/qemu-ifup #!/bin/sh /sbin/ifconfig $1 0.0.0.0 promisc up /usr/sbin/brctl addif virbr0 $1 Then to start the VM: as root: #~> qemu-kvm -net nic,vlan=0 -net,tap,vlan=0 -hda winxp.img -hdb winxp_disk2.img -usb -usbdevice tablet -localtime -daemonize That should start you up with a connection to the default virbr that gets made by fedora at boot time.

Configure Apache for public_html

Apache can be configured to use a folder ( usually public_html ) in any user's home directory. This is relatively straight forward if you don't mind editing the httpd.conf file and changing a few file permissions... A complete guide can be found here . Step 1 - Change httpd.conf In fedora and red-hat the correct configuration is already there. It's just commented out. #> vim /etc/httpd/conf/httpd.conf # # UserDir: The name of the directory that is appended onto a user's home # directory if a ~user request is received. # # The path to the end user account 'public_html' directory must be # accessible to the webserver userid. This usually means that ~userid # must have permissions of 711, ~userid/public_html must have permissions # of 755, and documents contained therein must be world-readable. # Otherwise, the client will only receive a "403 Forbidden" message. # # See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden # # # UserDir

qemu networking fedora 8

Copy the following two files into /etc/ /etc/qemu-ifup #!/bin/sh # qemu-ifup # script to bring up the tun device in QEMU in bridged mode # # This script bridges eth0 and tap0. First take eth0 down, then bring it up with IP 0.0.0.0 # if you do not use eth0 as the primary, change it to your interface name ETHX=eth0 /sbin/ifdown ${ETHX} /sbin/ifconfig ${ETHX} 0.0.0.0 up # # Bring up tap0 with IP 0.0.0.0, create bridge br0 and add interfaces ${ETHX} and tap0 # /sbin/ifconfig tap0 0.0.0.0 promisc up /usr/sbin/brctl addbr br0 /usr/sbin/brctl addif br0 ${ETHX} /usr/sbin/brctl addif br0 tap0 # # As we have only a single bridge and loops are not possible, turn spanning tree protocol off # /usr/sbin/brctl stp br0 off # # Bring up the bridge with IP 192.168.1.2 and add the default route # Change this to your static IP if you want the linux OS to route when the Guest OS is bridged in /sbin/ifconfig br0 10.160.221.163 up /sbin/route add default gw 255.255.255.0 #stop firewalls /sbin/service iptable

Change the data directory in Redhat Linux Enterprise with sellinux on

Today I had to change the data directory for a MySQL database in Redhat 5 Enterprise Edition with selinux set to enforcing mode. This was in a NEW INSTALL so there was no existing data. I stress this because this method is not a method one uses to RELOCATE existing data. Here are the steps: Stop the database => service mysqld stop Edit /etc/my.cnf and change the datadir value to the desired location. Change the selinux user / role and type on the new location. chcon -u system_u -r (cantremember_r) -t mysqld_db_t /full/path/to/mysql/data/dir Change the owner:group on the datadir chown mysql:mysql /full/path/to/mysql/data/dir Change the file permissions on the datadir chmod 755 /full/path/to/mysql/data/dir Start the database => service mysqld start Hold thumbs... :) UPDATE *** 2011-07-21 *** http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Managing_Confined_Services/sect-Managing_Confined_Services-MySQL-Configuration_Examples.html

joomla Abandoned...

Yes it's true. I have had to abandon the Joomla idea for the personal homepage. It turns out that I simply don't have enough space on my ISP Hosting account for it and for emails etc. I am currently loading up a default install of modX. Find details about modX here: http://modxcms.com/ Its a relatively simple CMS System. It has a lot of the same features as Joomla so should be just fine for Tanja to help me keep it up to date.

Send a binary message using netcat on windows

Consider that you need to send an echo message to a service that expects the echo in a binary format. If a correctly formatted binary message is sent to the service it will respond with a correctly formatted response over the same connection. I was tasked with this at work today and here is what I came up with. I used JScript running under the Windows Scripting Host ( WSH ) to: create a WshShell objectexecute a WshShell.Exec to run a shell command on the host machine to use netcat to send the binary file and pipe the output into a receivedData.bin file. execute a WshShell.Exec to use the windows command line tool, "FC" to compare the received file with a known existing file. //JScript - executed under the Windows Scripting Host ( cscript ) //var WshShell = new ActiveXObject("WScript.Shell"); var oExec = WshShell.Exec( "%comspec% /c c:\\myScripts\nc.exe 192.168.0.2 1234 <> c:\\myScripts\\recData.bin" ); //Keep checking for a valid status code and if

Joomla Installation

I have installed Joomla successfully on my localhost ( Fedora 8 ) using the default php and mysql installations with the most recent patches installed. At once point I was asked for FTP information. I was unable to configure ftp for my localhost in the short time I allowed myself. No matter though because FTP is enabled by default on all webservers. The FTP options will not be a problem in my production setup. At some point during the trial of any new software application the testing becomes production if testing takes too long. Testing has taken too long. Watch this space.

New Website

I am thinking of updating my personal home page and migrating the code sections from there to here. That way I can maintain a different focus on each website. It seems that the rest of my friends and family are not all that interessted in new and exciting ways to back up data using bash. I will report my progress here. The first CMS I will try for the personal home page is Joomla. It seems to have gained a lot of support and it's based on Mambo which I have used before.

CakePHP

I was asked to create a very simple application by a work colleague. The application was to maintain a list of members of the office Cake Club. The Cake Club is a group of people that buy / bake a cake on Friday to share with the rest of the members. This application needed an interface to add, edit and remove members of the club. It needed to send an email on Wednesday to the next person on the list for Friday. Then on Friday that person's date would need to be rolled over to the end of the list. After much research I eventually decided on CakePHP as being the best framework to use. CakePHP allows the following benefits: Easy integration with CSS / XHTML templates Rapid development - Ruby on Rails style based on database tables that follow the correct conventions Boilerplate and custom data validation tools MVC design Loads of other tools and hooks that can be programmed in. A large and active user community for help and support. The best place to learn about cake php is her