Todd Smith Org

November 28, 2012

Quick Script to help you archive all those IOMega ZIP Disks

Filed under: Uncategorized — admin @ 3:13 am
base_file="Zip100_"
base_dir="/Users/smith/Documents/GraphicDesign"


while true ; do

    if [ -d "/Volumes/Zip 100" ] ; then
        vol_dir="/Volumes/Zip 100"
    elif [ -d "/Volumes/ZIP-100" ] ; then
        vol_dir="/Volumes/ZIP-100"
    elif [ -d "/Volumes/100zip" ] ; then
        vol_dir="/Volumes/100zip"
    fi

    if [ -d "${vol_dir}" ] ; then

        ls -1 $base_dir
        last=`ls -1 $base_dir/ | cut -f2 -d_ | tail -n1 | sed "s,^[0],,g"`
        echo "Last: ${base_dir}/${base_file}`printf '%02d' ${last}`/"
        if [ -f "${base_dir}/${base_file}`printf '%02d' ${last}`/.done" ] ; then
                #move to next one
                echo "${base_dir}/${base_file}`printf '%02d' ${last}`/ is DONE"
                next=`printf "%02d" $(($last + 1))`
                echo Next is "${base_dir}/${base_file}${next}/"
                mkdir "${base_dir}/${base_file}${next}/" && \
                rsync -av --progress --stats "${vol_dir}/"* "${base_dir}/${base_file}${next}/" && \
                touch "${base_dir}/${base_file}${next}/.done" && \
                hdiutil detach "${vol_dir}"
        else
                #rsync copy to last && \
                rsync -av --progress --stats "${vol_dir}/"* "${base_dir}/${base_file}`printf '%02d' ${last}`/" && \
                touch "${base_dir}/${base_file}`printf '%02d' ${last}`/.done" && \
                hdiutil detach "${vol_dir}"
        fi

        sleep 10

    else

        echo "Volume does not exist, sleeping for 5 seconds"
        sleep 5

    fi

done

April 5, 2010

Compile Xen 3.4.1 on Ubuntu Howto

Filed under: Uncategorized — admin @ 12:36 am

These are the commands that I used to compile and install Xen 3.4.1 on my Ubuntu Server.

sudo su -
apt-get update
apt-get upgrade
dpkg-reconfigure tzdata
echo 'export EDITOR=/usr/bin/vi' >> /etc/profile
apt-get remove exim4 exim4-base lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
apt-get install build-essential g++
apt-get install python-dev python-twisted
apt-get install bridge-utils
apt-get install debootstrap
apt-get install reiserfsprogs
apt-get install mercurial
apt-get install gawk
apt-get install gettext openssl zlib1g-dev openssl libssl-dev libx11-dev
apt-get install libx86-dev bin86 bcc ncurses-dev texinfo
mkdir /usr/src/XEN
cd !$
wget http://bits.xensource.com/oss-xen/release/3.4.1/xen-3.4.1.tar.gz

hg clone http://xenbits.xensource.com/linux-2.6.18-xen.hg

tar zxf xen-3.4.1.tar.gz
cd xen-3.4.1

make prep-kernels

make dist

make install

December 28, 2009

IPSec between OpenBSD and Mac OS X Howto

Filed under: Uncategorized — admin @ 4:54 am

IPSec between OpenBSD and Mac OS X Howto

This Howto will give some basics about how to setup a roadwarrior style IPSec VPN between your OpenBSD gateway, and your road-warrior Mac OS X machine.

What is road warrior? – This means your IP is changing all the time. It doesn’t necessarily mean that you carry bazookas to a knife fight on the road.

Configuring OpenBSD

Edit your /etc/rc.conf to contain the following:

isakmpd_flags=”-K4dv”

Create the file /etc/ipsec.conf . Here’s what mine looks like… Kinda.

ike passive from any to any \
main auth hmac-sha1 enc aes group modp1024 \
quick auth hmac-sha1 enc aes psk YOURSHAREDKEYHERE

Run the following command to get the ipsecctl command to configure your ISAKMPD using the /etc/ipsec.conf file we just created

ipsecctl -f /etc/ipsec.conf

Configuring Mac OS X

First download IPSecuritas from Lobotomo Software

Import the following config file, and be sure to change the line: sainfo subnet 172.16.175.4/32 any subnet 10.20.30.0/23 any to your local IP, and remote Subnet you want access to.

log notify;
path pre_shared_key "/Library/Application Support/Lobotomo Software/IPSecuritas/psk.txt";
path certificate "/Library/Application Support/Lobotomo Software/IPSecuritas/certs";

padding
{
        maximum_length 20;
        randomize on;
        strict_check off;
        exclusive_tail on;
}

timer
{
        counter 5;
        interval 5 seconds;
        persend 1;
        phase1 15 seconds;
        phase2 15 seconds;
}

# Connection "OpenBSD Gateway"
remote 192.149.131.95
{
        verify_cert off;
        verify_identifier off;
        initial_contact on;
        passive off;
        support_proxy off;
        generate_policy off;
        verify_cert off;
        send_cert on;
        send_cr on;
        mode_cfg off;
        ike_frag on;
        doi ipsec_doi;
        situation identity_only;
        nat_traversal off;
        exchange_mode main;
        proposal_check obey;
        nonce_size 16;
        my_identifier address;
        peers_identifier address;
        proposal
        {
                lifetime time 1800 seconds;
                encryption_algorithm aes 256;
                hash_algorithm sha1;
                authentication_method pre_shared_key;
                dh_group modp1024;
        }
}

sainfo subnet 172.16.175.4/32 any subnet 10.20.30.0/23 any
{
        lifetime time 1800 seconds;
        pfs_group modp1024;
        encryption_algorithm des, 3des, aes 256, aes 192, aes 128;
        authentication_algorithm hmac_md5, hmac_sha256;
        compression_algorithm deflate;
}

listen
{
        isakmp 172.16.175.4 [500];
        isakmp_natt 172.16.175.4 [4500];
        adminsock "/Library/Application Support/Lobotomo Software/IPSecuritas/admin.sock";

}

You should be in really good shape from this point.

April 20, 2009

Setup RAID on Ubuntu Desktop

Filed under: Uncategorized — admin @ 9:37 am

I have a client who needed a nice little web design station using open source software. One of the requirements is to have RAID. So, having used linux software RAID for about 10 years now, I am very comfortable with it. Unfortunately the installer in Ubuntu Intrepid does not seem to have support for configuring the software RAID, LVM, Encryption and all that rot.

So let’s do it from the terminal, Install as normal and then use the following process.

Change the partition types on your disk to 0xfd. I reconfigured /dev/sda as follows:

root@ubuntu:~# fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x965c0f26

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          20      160618+  fd  Linux raid autodetect
/dev/sda2              21       60000   481789350   fd  Linux raid autodetect
/dev/sda3           60001       60801     6434032+  83  Linux
root@ubuntu:~#

Then copy that partition table to /dev/sdb

dd if=/dev/sda of=/dev/sdb count=1 bs=512

Now reboot, or Call “Call ioctl() to re-read partition table.”

Now it’s time to install mdadm

apt-get -f -y install mdadm

And finally, setup the RAID

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda2 /dev/sdb2

Verify the raid status with:

cat /proc/mdstat

Change the /etc/fstab

instead of LABEL=blahblah

change to /dev/md0

I’m sorry, this is incomplete

R

March 28, 2009

iptables troubleshooting

Filed under: Uncategorized — admin @ 12:49 pm

Troubleshooting

iptables v1.4.2: Unknown arg `(null)’

Try adding -p to the equation

root@host:~# iptables -I OUTPUT –dport 6660:6669 -j DROP
iptables v1.4.2: Unknown arg `(null)’
Try `iptables -h’ or ‘iptables –help’ for more information.
root@host:~# iptables -I OUTPUT -p tcp –dport 6660:6669 -j DROP
root@host:~#

March 23, 2009

Setup Trac on Ubuntu via APT

Filed under: Uncategorized — admin @ 10:30 pm

HOWTO Setup Trac on Ubuntu via APT

Installing Trac

Comments (1)

Powered by WordPress