Sutff about my job and comments about personal activities. Take a look to the first idea.

Tuesday, November 03, 2009

openvpn routed

I used to have bridge openvpn server in windows.. cause there was the easy way to configure...
But in linux bridge interfaces are not optimal, its better to use route openvpn..
Configuring the server and clients are found almost everywhere.. and iptables is also needed
A pretty short tutorial is can be found here

VMware tunning

I just needed how to tune my vmware host... a easy guide here.. from alfi's blog

Sunday, November 01, 2009

VMware tunning

I just needed how to tune my vmware host... a easy guide here.. from alfi's blog

Friday, October 30, 2009

SPA8000 & asterisk

I just received my SPA 8000 and I needed to connect to an asterisk...
Just like a SIP extension... found in:
Configuring the Cisco SPA8800 IP Telephony Gateway in an Asterisk® Environment a link


SPA8000 & asterisk

I just received my SPA 8000 and I needed to connect to an asterisk...
Just like a SIP extension... found in:
Configuring the Cisco SPA8800 IP Telephony Gateway in an Asterisk® Environment a link


Tuesday, October 27, 2009

SSH attacks

2 years ago I set up a iptables rule to stop ssh attack... something like:
# Limit SSH connections
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --name ATTACKER_SSH --rsource --update --seconds 600 --hitcount 6 -j DROP
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --name ATTACKER_SSH --rsource --set
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT

but last month I read about fail2ban which is little easiear to configure and even more specific... and set it up in 5 minutes...
http://www.howtoforge.com/fail2ban_debian_etch

Thursday, October 15, 2009

USB HASP dongle

It was not so hard to set up usb dongle key to get access in linux... I use it for Microsip

Download
Device Drivers for USB HASP keys
http://www.aladdin.com/support/hasp/hasp4/linuxdrv.aspx
wget ftp://ftp.aladdin.com/pub/hasp/new_releases/linux/HDD_Linux_USB_daemon.tar.gz

NetHASP License Manager
http://www.aladdin.com/support/hasp/enduser.aspx
wget ftp://ftp.aladdin.com/pub/hasp/hl/linux/hasplm_linux_8.30.tgz

Untar de tarballs to /usr/sbin

Mount usbfs
mount -t usbfs none /proc/bus/usb

To connect to USB dongle run:
/usr/sbin/aksusbd
and it will create /tmp/.aksusb

To start service on UDP:475
/usr/sbin/hasplm

UPDATE: 24/Dic/2015
I've have issues regarding dongle disconnection

usb 1-3: usbfs: USBDEVFS_CONTROL failed cmd aksusbd rqt 192 rq 161 len 8 ret -71

I had to desconect the power of the usb port and then connect again with:

echo 0 > /sys/bus/usb/devices/1-3/authorized
echo 1 > /sys/bus/usb/devices/1-3/authorized

After that, retart the aksusb daemon with
/etc/init.d/aksusbd restart

There is a link on how to install microsip 2007 on linux using winehq
Unfortunatelly, laters version of microsip use HASP SRM Dongle, which is not yet suported according with Etersoft Support for HASP dongles in Wine

UPDATE: 7/March/2017
Driver update can be downloaded from Gemalto Downloads
License version 7.51 on release October/2016

Nagios monitoring configuration for hasplmd segfault:

define service{
use generic-service
host_name localhost
service_description hasp_proc
check_command check_hasp
# Minutes to wait before next "regular" check.
normal_check_interval 2
# Minutes to wait before re-checking a non-OK service.
# A value of 1 = 60 seg, a value of 0.50 min = 30 seg
#retry_check_interval 1
retry_check_interval .25
# Number of times to retry a service check when a non-OK state is returned.
max_check_attempts 3
event_handler restart-aksusbd
}
define command{
command_name check_hasp
command_line /usr/lib/nagios/plugins/check_procs -c 1: -C hasplmd
}
define command{
command_name restart-aksusbd
command_line /usr/local/bin/aksusbd_eventhandler.sh "$SERVICESTATE$" "$SERVICESTATETYPE$" "$SERVICEATTEMPT$"
}

Add path to /etc/init.d/aksusbd
PATH=/sbin:/usr/sbin:/bin:/usr/bin

visudo
nagios ALL=NOPASSWD: /etc/init.d/aksusbd start

/usr/local/bin/aksusbd_eventhandler.sh


!/bin/sh
#
# Event handler script for restarting the web server on the local machine
#
# Note: This script will only restart the web server if the service is
# retried 3 times (in a "soft" state) or if the web service somehow
# manages to fall into a "hard" error state.
#

# What state is the AKSUSB service in?

LOG=/tmp/eventhandler.log
echo $UID >> $LOG
echo $(date) $@ >> $LOG
# kill -ABRT $(pidof hasplmd)

case "$1" in
OK)
# The service just came back up, so don't do anything...
;;

WARNING)
# We don't really care about warning states, since the service is probably still running...
;;

UNKNOWN)
# We don't know what might be causing an unknown error, so don't do anything...
;;

CRITICAL)
# Aha! The AKSUSB service appears to have a problem - perhaps we should restart the server...
# Is this a "soft" or a "hard" state?
case "$2" in
# We're in a "soft" state, meaning that Nagios is in the middle of retrying the
# check before it turns into a "hard" state and contacts get notified...
SOFT)
# What check attempt are we on? We don't want to restart the service on the first
# check, because it may just be a fluke!
case "$3" in
# Wait until the check has been tried 2 times before restarting the web server.
# If the check fails on the 4th time (after we restart the web server), the state
# type will turn to "hard" and contacts will be notified of the problem.
# Hopefully this will restart the web server successfully, so the 4th check will
# result in a "soft" recovery. If that happens no one gets notified because we
# fixed the problem!
2)
echo -n "Restarting AKSUSB service (3rd soft critical state)..."
# Call the init script to restart the AKSUSB services
#chmod o+w /sys/bus/usb/devices/1-3/authorized
#echo 0 > /sys/bus/usb/devices/1-3/authorized
#echo 1 > /sys/bus/usb/devices/1-3/authorized
sudo /etc/init.d/aksusbd start
;;
esac
;;
# The AKSUSB service somehow managed to turn into a hard error without getting fixed.
# It should have been restarted by the code above, but for some reason it didn't.
# Let's give it one last try, shall we?

# Note: Contacts have already been notified of a problem with the service at this
# point (unless you disabled notifications for this service)
HARD)
echo -n "Restarting HTTP service..."
# Call the init script to restart the HTTPD server
#chmod o+w /sys/bus/usb/devices/1-3/authorized
#echo 0 > /sys/bus/usb/devices/1-3/authorized
#echo 1 > /sys/bus/usb/devices/1-3/authorized
sudo /etc/init.d/aksusbd start
;;
esac
;;
esac
exit 0


Monday, October 05, 2009

Dr. House

I've just found another way to see Dr. House... It's suppouse to include Gilmore Girls.. but they are not so updated... pretty sad.

Sunday, August 23, 2009

partprobe

Finally solve.. repartition without reboot.. just run partprobe after fdisk and no need to reboot... cool!!!!

Saturday, August 22, 2009

Zoneminder on debian

Just been amazed again by the power of debian...

There is a livecd with archlinux and zoneminder latest version... just for testing and every other package broken as it's suppouse to be... but debian has zoneminder package with everything on the road... just a few tips

Setup permisions
$ chmod o+rx /dev/video*

Configure rsyslog
vi /etc/rsyslog.conf
< *.*;auth,authpriv.none -/var/log/syslog > *.*;local1.none;auth,authpriv.none -/var/log/syslog
> local1.* /var/log/zm/zm.log
> local1.!*;local1.warning -/var/log/messages

Configure logrotate
vi /etc/logrotate.d/1st-zoneminder
>/var/log/zm/*log {
> weekly
> rotate 3
> notifempty
> missingok
> postrotate
> /usr/bin/zmpkg.pl logrot
> endscript
>}

The files are store in /var/cache/zoneminder with thousands of files, so I suggest to use an smaller inode_radio from 16384 to 8192 and set only 1% reserved block count
mkfs.ext3 -i 8192 -m 1 /dev/sdaX

Add noatime to fstab
vi /etc/fstab
> /dev/sdaX /var/cache/zoneminder ext3 defaults,noatime,nodiratime 0 0

Grub2

I've just upgrade to grub2, little tricky to find out /etc/grub.d/ and /etc/default/grub files...
Besides partitions number now starts beginning with 1 instead of 0.

Monday, April 27, 2009

Wireless roaming with Wireless Access Points

For the record...

What is "roaming" and how does it work?
Roaming is the ability of a wireless computer user to communicate continuously while moving freely throughout an area greater than that covered by a single access point. In such a system, the users end node undertakes a search for the best possible access to the system. First, it evaluates such factors as signal strength and quality. Based on that information the node next selects the strongest Access Point and registers its address. Communications between end node and host computer can then be transmitted up and down the backbone. When a node no longer receives acknowledgment from its original access point, it undertakes a new search. Upon finding a new access point, it then reregisters, and the communication process continues.