Thursday, January 24, 2013

trim all leading and trailing whitespace with sed


# trim all leading and trailing whitespace
cat ./stuckchannels_Jan24-2013_unformatted.txt | sed 's/^[ \t]*//;s/[ \t]*$//'

kill zombies

ps -el | grep 'Z' | awk '{ print $5}' | grep -v PID | xargs -I{} kill -9 {}

Monday, January 21, 2013

"The headers for the current running kernel were not found"



But, my kernel headers are intstalled...and 3D accelleration is turned on in VirtualBox.
So, I installed dkms and that fixed it.


---


hostname@sakti:~$ sudo /media/VBOXADDITIONS_4.2.6_82870/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.6 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing installed version 4.2.6 of VirtualBox Guest Additions...
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the OpenGL support module ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers
Installing X.Org Server 1.11 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services components ...done.


hostname@sakti:~$ sudo apt-get install build-essential linux-headers-`uname -r` dkms
Reading package lists... Done
Building dependency tree      
Reading state information... Done
build-essential is already the newest version.
linux-headers-3.2.0-36-generic-pae is already the newest version.
The following NEW packages will be installed:
  dkms
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 73.1 kB of archives.
After this operation, 347 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main dkms all 2.2.0.3-1ubuntu3 [73.1 kB]
Fetched 73.1 kB in 0s (103 kB/s)
Selecting previously unselected package dkms.
(Reading database ... 175198 files and directories currently installed.)
Unpacking dkms (from .../dkms_2.2.0.3-1ubuntu3_all.deb) ...
Processing triggers for man-db ...
Setting up dkms (2.2.0.3-1ubuntu3) ...
mdeviveiros@sakti:~$ sudo /media/VBOXADDITIONS_4.2.6_82870/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.6 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing installed version 4.2.6 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers
Installing X.Org Server 1.11 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services components ...done.
hostname@sakti:~$

---

Rebooted and wa-la. all fixed. 
Ubuntu 12.04 LTS i686 with Unity 3D running in VirtualBox 4.2.6 (with the extention pack installed) on Windows 7 x64

Sunday, January 20, 2013

nginx ossec location directive


        location ^~ /ossec/(.*\.php)$  {
            auth_basic            "Restricted";
            auth_basic_user_file  /var/www/default/ossec/.htpasswd;
            root   /var/www/default/ossec;
            index  index.php;
            fastcgi_pass   127.0.0.1:8888;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/default/ossec$fastcgi_script_name;
            include        fastcgi_params;
        }
        #        
        location ~ \.php$ {
            root           /var/www/default;
            fastcgi_pass   127.0.0.1:8888;
            fastcgi_index  index.php;    
            fastcgi_param  SCRIPT_FILENAME  /var/www/default$fastcgi_script_name;
            include        fastcgi_params;
        }

    }

Wednesday, January 16, 2013

limit incoming connections with host firewall

limit incoming connections on ssh to no more than 6 attempts/30seconds:

ufw limit in log 22/tcp

---

also, in netfiler parlance:


/sbin/iptables -N LOGDROP
/sbin/iptables -A LOGDROP -j LOG
/sbin/iptables -A LOGDROP -j DROP
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent  --update --seconds 30 --hitcount 6 -j DROP

Saturday, January 12, 2013

OpenBSD upgrade: no route to host

Recently I upgraded from OpenBSD 4.8 to 5.2.
I followed the installation guide whereby you burn ISO's and boot off them, choose the Upgrade option.

Anyhow, after stepped into 5.0, I was no longer able to use wget to test connectivity. dig was succeeding but wget was not, claiming "no route to host".

i could ping the gateway, and outside of it. so I deleted the default route, and recreated it. done.

route delete default
route add default [your.default.gw.ip]

also, i had to comment out the following line in /etc/pf.conf

set require-order yes

then reloaded pf

pfctl -f /etc/pf.conf