Tuesday, January 19, 2010

BlackBerry Bold "Caller ID" doesnt work

ok, lets be clear...its not the ANI data that's messed up (aka Caller ID) but its the a security feature of the phone that's keeping the name of the contact resolving on the screen when the phone is locked (also not a default setting of the phone).....which in the case of losing your phone is a great thing. In the case of normal usage, its impractical. My phone locks rather quickly and has a message that helps the finder return it if I lose it.

This thread was difficult to find but outlines the situation. however, the steps given in the thread are a little different for the newest version from AT&T. By default, many of the features in 'Options | Security Options | Encryption' are turned off. I went in there and turned a bunch of stuff on....thinking "Hey, Cool! Security is so great...lets turn it on! Oh, wow...it doesnt work anymore. hmm."

To make the Contact Name show up when the phone is locked and ringing, be sure that the 'Include Contacts' for 'Encryption: Device Memory' is 'No'.

The Bold must do some housekeeping when it locks, memory wiping and so forth. The Contact list is potentially a list containing PII, and its probably a requirement somewhere to make sure that data is at rest when the device is idle. Just guessing here...

Thursday, January 14, 2010

list APC properties

php -i | grep apc

import dshield block list for pf

/usr/local/bin/wget -q -O - http://feeds.dshield.org/block.txt | egrep -v '#|Start' | awk '{print $1 "/24"}' | sed -n '4,50p;50p' > /etc/pf.blocklist.dshield && pfctl -f /etc/pf.conf

Thursday, January 7, 2010

make bootable usb with openbsd 4.6 installer

# fdisk -iy sd0
# disklabel -E sd0
> d *
> a a
##make install partition 1G
> q
# newfs sd0a
# mkdir /mnt/usb
# cd /mnt/usb
# mount /dev/sd0a /mnt/usb
# ftp ftp.openbsd.org
user: anonymous
password: 123456
ftp> cd pub/OpenBSD/4.6/i386
ftp> mget *
mget INSTALL.i386? a
ftp> exit
# cp /boot /mnt/usb/boot
# /usr/mdec/installboot -v /mnt/usb/boot /usr/mdec/biosboot sd0c
# cp /mnt/usb/bsd /mnt/usb/bsd.old
# cp /mnt/usb/bsd.rd /mnt/usb/bsd
# cd /
# umount /mnt/usb
try it


see also: http://bsdanywhere.org/
see also: https://calomel.org/bootable_openbsd_cd.html

Sunday, December 6, 2009

allow tftp under selinux

For RHEL5:

# audit2allow -a -M mytftp
# semodule -i mytftp.pp
# service xinetd restart

add virtual hard disk to linux

#in vmware workstation | vm settings
add virtual hard disk to vm

#in vm
fdisk /dev/sdb
n
[ENTER][ENTER]
w
mkfs -t ext3 /dev/sdb1
mkdir /newdir
mount -t ext3 /dev/sdb1 /newdir
echo "/dev/sdb1 /software ext3 defaults 1 1" >> /etc/fstab

See: http://www.matttopper.com/?p=25

remount /

mount -n -o remount /

Wednesday, December 2, 2009

tw_cli: 3ware controller commands

when replacing a failed disk, you must issue a 'maint deleteunit command', as the 'maint remove' command doesnt do what you might think it does. so, pull the drive, insert the new one, issue a rescan commmand, then deleteunit, then rebuild.

the following commands were used to start rebuiding the raid-1 array on a server with a single 8006 controller.

show ver
info
info c0
rescan
info c0
maint deleteunit c0 u1
maint rebuild c0 u0 p1

Friday, November 20, 2009

list pecl modules and info

You might have to:
`ln -s /usr/local/apache2/bin/apxs /usr/local/bin/apxs`

Then:
`/usr/local/apache2/php/bin/pecl list`
`/usr/local/apache2/php/bin/pecl install apc`
`vi /usr/local/apache2/php/conf/php.ini`
- add 'extension=apc.so'
`/usr/local/apache2/bin/apachectl_admin restart`

Thursday, November 19, 2009

list kernel modules

# modinfo $(cut -d' ' -f1 /proc/modules) | sed '/^dep/s/$/\n/; /^file\|^desc\|^dep/!d'

Wednesday, November 11, 2009

host firewall for the mac

#!/bin/sh
#fwrules

IPFW='/sbin/ipfw -q'

$IPFW -f flush
$IPFW add 2000 allow ip from any to any via lo*
$IPFW add 2010 deny log ip from 127.0.0.0/8 to any in
$IPFW add 2020 deny log ip from any to 127.0.0.0/8 in
$IPFW add 2030 deny log ip from 224.0.0.0/3 to any in
$IPFW add 2040 deny log tcp from any to 224.0.0.0/3 in
$IPFW add 2050 allow log tcp from any to any out
$IPFW add 2060 allow tcp from any to any established
$IPFW add 12190 deny log tcp from any to any


Then apply it to the firewall

# sudo ipfw list
# chmod 600 ./rules
# sudo ipfw ./rules

Tuesday, November 10, 2009

pecl install apc

make sure that the apxs directory is in the system path.

Wednesday, October 7, 2009

resize a mounted lvm-managed disk in linux

I have found many overly-complex and incorrect and/or unnecessary instructions all over the web. So, I made this reference for me, but it may work well for you too. I typically use RHEL4/5 in my data center implementations, so these steps cover lvm managed disk space (which is decent for a simple LAMP stack).

I tend to do the following a lot in vmware products (workstation/esx/esxi).

First, check and note the size of your disks and partitions in your target vm.

[root@host]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
5.8G 665M 4.9G 12% /
/dev/sda1 99M 9.1M 85M 10% /boot
none 506M 0 506M 0% /dev/shm

[root@host]# sfdisk -s
/dev/sda: 8385898
/dev/sda1: 104391
/dev/sda2: 8281507
/dev/dm-0: 6160384
/dev/dm-1: 2031616


Then, go into the settings of your vm (e.g. through the vi client) and either add another virtual hard disk or increase the size of the existing disk. In my case i simply extended the existing virtual disk from 8G to 16G.

Reboot.

Check to see that the size of /dev/sda has increased.


[root@host]# sfdisk -s
/dev/sda: 16777216
/dev/sda1: 104391
/dev/sda2: 8281507
/dev/dm-0: 6160384
/dev/dm-1: 2031616

[root@host]# sfdisk -l

Disk /dev/sda: 2088 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 12 13- 104391 83 Linux
/dev/sda2 13 1043 1031 8281507+ 8e Linux LVM
/dev/sda3 0 - 0 0 0 Empty
/dev/sda4 0 - 0 0 0 Empty


/* If you increased the size of your existing disk, its probably easiest to boot from the gparted-live disk and create a new primary partition in the newly free space, format ext3. */
wget http://downloads.sourceforge.net/project/gparted/gparted-live-stable/0.4.6-1/gparted-live-0.4.6-1.iso?use_mirror=softlayer

reboot

/* check for /dev/sda3, your new parition */

[root@host]# sfdisk -s
/dev/sda: 16777216
/dev/sda1: 104391
/dev/sda2: 8281507
/dev/sda3: 8385930
/dev/dm-0: 6160384
/dev/dm-1: 2031616


/* create the lvm pv reference */

[root@host]# pvcreate /dev/sda3


/* extend the lvm vg reference */

[root@host]# vgextend VolGroup00 /dev/sda3


/* note the free space for your upcoming `lvextend` command */

[root@host]# vgdisplay

--- Volume group ---
VG Name VolGroup00
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 15.84 GB
PE Size 32.00 MB
Total PE 507
Alloc PE / Size 250 / 7.81 GB
Free PE / Size 257 / 8.03 GB
VG UUID L7woQB-ymCv-NeWL-i47M-b5Ua-fOHQ-hM0DXI


/* extend the lvm vg reference */

[root@host]# lvextend -L+8.03G /dev/VolGroup00/LogVol00


/* resize the volume group while its still mounted */

[root@host]# ext2online /dev/VolGroup00/LogVol00


check the following

[root@host]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
14G 668M 13G 6% /
/dev/sda1 99M 9.1M 85M 10% /boot
none 506M 0 506M 0% /dev/shm

[root@host]# sfdisk -l

Disk /dev/sda: 2088 cylinders, 255 heads, 63 sectors/track
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/sda1 * 0+ 12 13- 104391 83 Linux
/dev/sda2 13 1043 1031 8281507+ 8e Linux LVM
/dev/sda3 1044 2087 1044 8385930 83 Linux
/dev/sda4 0 - 0 0 0 Empty


now, go on with your life.

Wednesday, August 19, 2009

compare directory trees

ssh server1 "find /usr/local/apache2/sites/htdocs/ -type f -exec basename {} \; | sort" > server1.txt; ssh server2 "find /usr/local/apache2/sites/htdocs/ -type f -exec basename {} \; | sort" > server2; comm -3 ./server1 ./server2

Friday, August 14, 2009

slowloris ddos aversion

use Nginx and openBSD/pf to protect Apache.
http://nginx.net/

here's some configuration help.
https://calomel.org/nginx.html

Thursday, August 13, 2009

rpm packages by name only

rpm -qa --qf "%{NAME}\n" > hostname.rpm.txt

then you can compare to see what is missing.

comm -3 host1.rpm.txt host2.rpm.txt

Tuesday, August 11, 2009

Slowloris DDOS prevention

#!/bin/sh

LIMIT=100

COMMAND='netstat -n | egrep '\''tcp.*[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:(80|443)[ ]*[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*:[0-9]*[ ]*ESTABLISHED
'\'' | awk -F'\''[ \t:]+'\'' '\''{ print $6 }'\'''

eval $COMMAND | sort | uniq -c | while read numconn ip
do
if [ $numconn -gt $LIMIT ]
then
echo "Check ASAP and renable this cron." | mail -s "IP $ip - ($numconn) went over $LIMIT connections on `hostname`" me@someemailaddress.com

sed -i 's/\(^\*.*this_script.sh*\)/#\1/g' /etc/crontab
# /sbin/iptables -I INPUT -s $ip -j DROP
fi
done

Wednesday, July 22, 2009

ESXi 4.0 not booting off DVD ISO or Host CD/DVD Device with DVD's

I had some problems with booting off DVD iso's on nfs shares and DVD's in the Host system CD/DVD reader (which, incidentally is a SATA device, also problematic with ESXi according to some forums I've read). But I was able to get it to boot off the DVD media by burning the DVD iso to a physical disk and placing the disk in my client system DVD reader. Then, I set the boot options to delay by 5000ms, set the boot order in the VM's bios as removable,network,cdrom,hard drive, and then i started the vm. while it was sitting there trying to boot off the network, i used the little CD button above the vm console window to connect my local DVD drive to the vm through the VI4 client. This worked, it was slow but it worked and I was so happy!

Thursday, July 9, 2009

List installed perl modules

perl -MCPAN -e 'print CPAN::Shell->r '

Monday, June 15, 2009

convert unix time to local time

date -R -d @1245049200

-R requests that date output in RFC 2822 format
-d requests that date output the date based on a string that follows