Thursday, August 19, 2010

Show passwords on Browser page

This handy piece of javascript was written by:
http://www.raymond.cc/blog/archives/2007/07/13/easily-show-the-contents-of-password-fields/


Copy and paste this into your Browser's Address bar (only works on a page where password is saved and hidden)




Definitely works on IE and Firefox.


Cheers (with props to the original author),
-n

Setting up an NFS Share on CentOS 5.x

This outlines on how to setup a NFS Client/Server architecture.Used by myself for Moodle to access Datafiles, as I employ multiple webservers.

0. Package Installation

Login as root and install the following packages on NFS Client(s) and NFS Server
yum install nfs-utils nfs4-acl-tools portmap
chkconfig nfs on
chkconfig portmap on
service nfs start
service portmap start

1. Prep NFS Server
export share
nano /etc/exports
add lines like:
/mount/folder 192.168.0.0/255.255.0.0(rw) 10.0.0.0/255.0.0.0(rw)

allow clients to be able to connect.
nano /etc/hosts.allow
add lines like:
portmap: 192.168.0.0/255.255.0.0
add clients to hosts file
nano /etc/hosts
make sure all relevant hosts are listed in the format:
192.168.x.x server1.domain.com.local server1

restart the nfs and portmap service
service nfs restart
service portmap restart
2. Prep the NFS Client(s)
Repeat this step on each NFS client.
Edit the fstab
nano /etc/fstab

adding line:
server.ip.address:/mount/folder /mnt nfs rw,hard,intr 0 0
Mount the share
mount nfshostname:/mount/folder /mnt

restart services
service netfs restart
chkconfig netfs on

3. Test NFS

Create a file from one client, and it should be automatically available on the other clients.
From Client1
echo "This is an NFS Test" > /mnt/file.txt

Cheers,
-n

Tuesday, August 3, 2010

Sending mail from command line or shell script

How to send mail from the Linux Command line (or shell script) using the mail command.

echo "This is the body of the email" | mail -s "Email Subject" recipient@domain.com -- -f senderaddress@domain.com


The -- -f section is used to plug in a sender address, otherwise the mail will be sent from your root or user account from the actual physical server name - e.g root@server1.domain.com


This comes in handy for notification of script execution, for example, jobs in the crontab. Placing this code immediately after the last command in a shell script will ensure relevant person(s) are notified when the script is called.

-n

Friday, July 30, 2010

Load Balancing - Never a dull moment

Currently doing some research into implementing an updated version of session aware loadbalancing for a specialized Moodle installation.

The solution I inherited with the system was Ultramonkey in a High Availability setup, but I figure I'm gonna throw in some dedicated loadbalancing in the new equation.

Updates to follow soon, as well as some more scripting!

Tuesday, July 20, 2010

Adding a virtual disk to a Linux Virtual Machine.

Needed to add another Virtual Disk to an existing machine in VMWare ESXi. Adding the disk to the VM Settings was the easy part and fairly straightforward. This particular guide is to get the Disk recognized on the actual Linux Server and mount it.


0. Login as root (Seeing a pattern yet?)

1. Identify the drive.
df -h  and take note of the entries.
cd /dev/
ls

By the process of elimination, the one in the list in /dev/ that is not part of the df -h listing is the culprit.


2. Create the filesystem
/sbin/mkfs -t ext3 /dev/xxx  where xxx is the drive identified in Step 1.


3. Mount the filesystem
 mount -t ext3 /dev/xxx /mnt/myfoldername where my folder name is - you guessed it!


4. Check to make sure it is there!
df -h


Woohoo!

-n

Monday, July 19, 2010

Backup, Backup Backup - never underestimate the value of it.

There I was, bitching about non-geek stuff, when *poof*, suffice it to say, never underestimate the value of a good backup strategy.


Situation:
One of the Moodle virtual servers that I manage failed and (conveniently) the RAID 5 with the backups went up in smoke as well. It literally just disappeared. Usually I prefer Hard disk backup to tape but in this case, hosting a server for someone else (bureaucratic favour), my preference turned around and bit me in the ass.

The meta-data on the Raid controller apparently became corrupt, with some sort of power blip (even with enterprise level UPS and generator backups) that happened just at the wrong time possible. Kind of like lightning hitting you in the dead of summer whilst you were casually walking in a field of lightning rods.

Anyhow, disaster aside, time to attempt either a recovery or a rebuild.

Part One - RAID Recovery.
In order to get the server to recognize the drives once more, the array needed to be deleted. Sounds scary, but technically the drives will not be wiped, per se. Then the array needed to be recreated using the same settings as its predecessor. Blind luck helped in this case, as the original guy who created the array took off, presumably because he got a premonition about this shitstorm and decided to flee.

So the Array got recreated and the server was able to see the 500 GB once again. YAY!...... well no. The 500GB appeared to be empty.

Time to see if we can work some magic.

Part two -  Attempted data recovery.
This will be done using UBCD for linux - two words. GET IT.
http://www.ultimatebootcd.com/download.html

Using the PhotoRec tool by CG Security, which is included on the CD, an attempt is currently being made to recover the data.

An update will follow soon.


*Update*

All we managed to recover was junk data. The server was rebuilt using an older backup. The client now understands the importance of a little request, like an extra HDD for backups.

-n

Tuesday, May 18, 2010

Update

Seems that the non-geek spell continues.
Currently working on some documentation, as well as:
Batch uploading users to myelearning (for manual accounts)
Batch creating courses (thanks to www.moodle.org)

Massive server changes coming soon, plus testing and deployment on VMWare ESXi, so plenty to write about in the upcoming weeks/months.

-n