Tag Archives: database

Passbox

usage: passbox [action]

Passbox – command line password manager utility

ACTIONS

add-field Update an existing entry to add additional fields to
delete Remove an entry from the password database
get Get a particular password entry by it’s name
generate Generate a new random password
new Prompt to create a new passbox entry
remove-field Update an existing entry to remove additional fields
search Search the password database for a particular string, returns all matching entries
update Update an existing entry in the password database

Email Greylisting

First, for the un-initiated, click here to learn about email greylisting.

When email admins talk about greylisting, one of the benefits they normally point to is load on the actual email server but fail to mention supporting systems. I did notice a decrease in mail processing load there as well as my database server.

Keep in mind this is NOT a busy email server. It’s only hosting a couple TLDs.

I noticed an immediate improvement after restarting mail services (I did not reboot the server).

Email processing by amavisd was greatly reduced since the SMTP server rejected all new connections initially.
The “orange” is spam detected by amavis:

Below is the MariaDB database server.
Notice the drop in “pink” (ignore the spikes, those are backups) since the email server is rejecting before it has to query the database:

All things considered, SPAM and processing load has been greatly reduced.

Debian NAS

I wanted a centralized home storage system that could feed all my other toys. Data stored on this will include MySQL datafiles, our MP3 collection, website directories and all our receipts printed out in PDF format (Yay! CutePDF) among other things. And so the fun began…

I did some test installs of various “turnkey” solutions such as Openfiler.

Openfiler just didn’t seem stable enough. Arrays would claim to have faulty drives and start rebuilding the arrays at the strangest times. Only to find out, via 3rd party tools, that the drive was fine. The web interface was ok but I would have organized it differently. Minus that, Openfiler has a lot of potential.

In the end, for what I wanted, it was easier to do a netinstall of Debian and add the things I needed.

Started with this: Debian RAID

Changes:
Raid5 first
Raid1 with leftovers
Flat filesystem
Swap on Raid5

Problems:
Bad mainboard
Bad harddrive
BIOS truncation of HD hardware address forcing me to "find" the bootdisk manually.

Hardware:
ECS RS482-M754 w/ AMD Sempron 3200+ (Bundled)
4x Seagate Barracuda 7200.10 ST3250620AS 250GB
2x AllComponents 512MB 184-Pin SDRAM DDR 400

The mainboard had problems POSTing but I couldn't really determine if it was board, memory or CPU, so it (board, memory and processor) was replaced with:

MSI K9AGM2-L AM2 AMD 690V Micro ATX
AMD Sempron 64 3400+ Manila 1.8GHz Socket 754
2x Kingston 512MB 240-Pin SDRAM DDR2 800

Ended up having a dodgey harddrive too. Awaiting the RMA return. But that didn't stop the project, it's just running without a spare at the moment.

NFS with assigned ports: Securing NFS

This is used for our websites' files and MP3 collection. The MP3's are accessed internally via Jinzora and accessed via laptops, HTPC's etc.

Samba:
9 times out of 10, we're accessing the NAS interactively from laptops running windows. I didn't really look for a site that explained how to setup Samba on Debian. Just knit picked around google until my shares were up and running.

AoE for database files: AoE on Debian

First, the above URL is not quite complete, it's missing a few steps, which I have outlined below.

There are some security risks one should be aware of when implementing AoE. One item is the ability to X-mount an AoE LUN on another server causing corruption and all sorts of other nastiness. I've heard there are certain implementations that allow MAC filter and other security mechanisms to make this more secure. But in the end, you will still be shipping data in the clear over the wire.

I decided the ease of use were worth the risks.

Given that data files were going to live on the AoE devices, I wanted some extensive, longterm testing. I kept the originals and did some link chicanery for the test.

As I stated earlier, the AoE How-To linked is not complete but still makes a decent starting point. Below is a quick step-by-step.

Keep in mind the initiator is the "client" and the target is the "server". These are Debian specific instructions.

Initiator:
Install the client tools
apt-get install aoe-tools

Create the /dev structure
aoe-mkdevs /dev/etherd

Target:
apt-get install vblade

Create a device to export
lvcreate -n myAoE --size 10g my_vg0

Export device in userland for testing
vblade 0 1 eth1 /dev/my_vg0/myAoE &

Initiator:
aoe-discover

List AoE devices
aoe-stat

Create filesystem on device
mkfs.ext3 /dev/etherd/e0.1

Mount our new AoE device
mount /dev/etherd/e0.1 /data

And there you have it. In the end, I have 500GB of usable space in the first array. This includes a spare. All told, $415 delivered from NewEgg.

Next, I will be adding 4x 500GB drives for another array. At the current prices, you just can't beat the $ per GB.

Simple MySQL Backup Script

Below is a simple database backup script to use with MySQL.

#!/usr/bin/perl -w

use strict;

# Backup – Script used to backup MySQL databases to an NFS share.
# VERSION: 1.2
# DATE: 12152005
# AUTHOR: packetmad

# This is a Freebsd 4.x-centric script. It may run on other
# versions of Freebsd, or any other BSD for that matter, but I
# wrote it on a Freebsd 4.7 system. It’s not even guaranteed
# to run on that.

# Speaking of guarantees, warranties, etc., there ain’t one, so
# don’t even try. :P
# I am not responsible for the output of this script, nor am I
# responsible for any damage or data loss as a result of using
# this script. In short, I am not responsible for anything
# regarding this script.
# Furthermore, I am not responsible if this script causes
# Your dog to die, your wife to leave you, or
# your truck to break down.
# I am releasing this script under the conventions of the BSD
# license. You can use it, modify it, sleep with it, or
# whatever. If you do find this script useful or have
# suggestions on a better way to do some things contained here
# in, I welcome all correspondence.
# The latest version of this script can be obtained at:
# http://tech.kulish.com

# USE THIS SCRIPT AT YOUR OWN RISK!!!!!!!!!!!!!!!!!!

# Change Log
# v1.1
# Date: 11302002
# Initial Release, absolutely BUG FREE! :)
# v1.2
# Date: 12152005
# Added compression functionality
# Added naming of backup files by date
# Changed longterm storeage directory for 1back to store1

###
# Declare variables and arrays.
###

my (
$bdir, $sysname, $logfile, %databases, $key, $database, $rightnow
);

$bdir = ‘/databases/’;
chomp ( $sysname = `uname -n` );
chomp ( $rightnow = `date +%m%d%G%H%M` );
#print $rightnow;
# Databases we want to backup and associated archive names.
# Database => sql file pairs.

%databases = (‘testdb1’ => ‘testdb1.sql’,
‘testdb2’ => ‘testdb2.sql’);

###
# Backup Section
###
foreach $key (sort keys %databases) {
$database = $databases{$key};
`mysqldump -uUSERNAME -pPASSWORD $key >> $bdir$sysname/$database`;}

###
# Compression Functionality
###

foreach $key (sort keys %databases) {
$database = $databases{$key};
`gzip -c $bdir$sysname/$database > $bdir$sysname/$rightnow$database.gz`;}

# scp them to the fileshare
#`scp $bdir$sysname/*.gz USERNAME\@SERVER:databases`;

###
# Clean backup dir
###

`rm -rf $bdir$sysname/*.sql`;
`mv $bdir$sysname/*.gz $bdir$sysname/store1`;