April 28th, 2009
Creating a layer 2 ethernet bridge under Debian (or Linux in general really) is incredibly easy, as are most things. What a L2 bridge actually is, is outside the scope of this guide, however Google has plenty of information. Essentially, ethernet frames are mirrored between the two interfaces, therefore what Layer 3 protocol data (TCP, UDP, ICMP, etc) is within the ethernet frame is irrelevant. Anyway, back to the point..
In case you don’t have the package, apt-get install bridge-utils and you’ll also need bridge support in your kernel, however unless you specifically removed it, you should have it.
Read the rest of this entry »
April 20th, 2009
I recently had my datacenter set up a new cPanel/Fantastico server for our hosting platform. Unfortunately they spelled the site name incorrectly which caused a load of problems. You can change the hostname with relative ease from within the basic setup section, however once the wrong nameservers are specified and domains are generated you’re stuck.
After fixing the nameserver addresses, you’d think that ‘/scripts/rebuildnsdzones’ or ‘/scripts/rebuildnamedconf’ would be obvious candidates however no such luck.
The answer came in the form of a 3rd party script. Back up your /var/named directory, and then download/run this perl script: http://mirrors.ndchost.com/pub/ndchost/scripts/cpanel_rebuildbindzones
Did the job perfectly for me 🙂
April 13th, 2009
‘batch’ is a very useful tool for scheduling jobs to run when the server is sufficiently idle to process them.
The default is to run jobs when the server load is less than 1.5 however this can be overwritten via the atd tool with -l.
batch takes input via STDIN, i.e.:
mysqldump -u backup –all-databases |batch
‘at’ executes a command at a specific time, ‘atq’ lists the current jobs, ‘atrm’ deletes a job by ID, and ‘batch’ executes jobs when server load drops below the defined level.
The timing of batch is obviously not predictable. If predictable scheduling is required, use ‘at’ for one shots or ‘cron’ for all others. The purpose of batch is to run non time sensitive tasks when the server is sufficiently idle. Examples include mailings, bulk updates such as ‘updatedb’ or ‘apt-get update’, and log rotating or log analyzing such as awstats.
April 5th, 2009
On the command line we have a number of powerful tools available to us. I’m going to cover some text sorting methods here.
I have a file called ‘testfile’ within this file is the following:
test:~# cat testfile
this is a test
Read the rest of this entry »
April 1st, 2009
An MD5 is a type of Hash, also, a Checksum.
An MD5 hash is a one way verification sum which can be used to verify a string or contents of a file. Once you have a file and an MD5 checksum, the recipient of the file can also perform an MD5 calculation to ensure that the file’s contents are unchanged. They may have been changed maliciously such as in the case of a binary file, or simply by data corruption. An MD5 is NOT a type of encryption. It can not be reversed.
In the case that you know the length of the data, say between 5 and 8 characters for a password, you can attempt to brute force (try every combination automatically until something hits) the password. For that reason passwords are often salted before being MD5’d however salts and their purpose are outside the scope of this article.
We can use PHP to do the following:
$string = “teststring”;
$checksum = md5($string);
echo “The checksum is: ” . $checksum . “n”;
The output is:
The checksum is: d67c5cbf5b01c9f91932e3b8def5e5f8
We can also use the ‘md5sum’ linux command and pipe input to it via STDIN.
test:~# echo “teststring”|md5sum
Why is the output of this md5sum different to that above? Well, ‘echo’ automatically adds a newline to the string to make it “teststringn”. We can surpress this with -n:
test:~# echo -n “teststring”|md5sum
We can also run the md5sum command against a file:
test:~# md5sum /bin/bash