Monday, January 28, 2013

Nagios HTTP WARNING: HTTP/1.1 403 Forbidden Solved

After installing nagios monitoring tool. everything seem to be fine on local host.
Except HTTP deamon with warning HTTP/1.1 403 Forbidden.

To solve this..

simply create index.html file under http root directory.

#cd /var/www/html
#touch index.html


Restart web services.

#service httpd restart

Now restart you nagios services.

#/etc/init.d/nagios restart

Friday, January 25, 2013

Install pfsense to an usb drive

Nanobsd was created to make Freebsd suitable for installing on embedded systems, specifically on flash media.
Flash media has a limited number of write cycles and a standard install can burn through them quickly resulting in drive failure.

Nanobsd avoids this by logging to ram only and mounting the file system read only (among other tweaks).
Because of this some packages cannot work. Most have been adapted to work, for example it's possible to run squid without the cache just as a web filter.

SANDISK CRUZER FIT 4GB USB FLASH DRIVE

Download embedded builds image 4G with VGA output from:
http://files.nyi.pfsense.org/mirror/downloads/pfSense-2.0.2-RELEASE-4g-i386-nanobsd_vga.img.gz

Writing the image
When using a windows machine the easiest way to write your media is with physdiskwrite.
Place physdiskwrite and the pfSense image in the same folder. Attach the media you want to store pfSense on (i.e. CF-Reader and CF-Card).

Physdiskwrite will show you a numbered list of suitable devices (USB-stick, CF-cards in USB-readers, harddisks,...). Enter the number of the desired media.
physdiskwrite v0.5.2 by Manuel Kasper

Usage: physdiskwrite [-u] [-d driveno]

-u remove 2 GB restriction (WARNING!)
-d specify drive number (0..n) (no confirmation prompts!)

X:DownloadspfSense>physdiskwrite.exe -u pfSense-2.0.2-RELEASE-4g-i386-nanobsd_vga.img.gz

physdiskwrite v0.5.2 by Manuel Kasper

Searching for physical drives...

Information for .PhysicalDrive0:
Windows: cyl: 29185
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: INTEL SSDSC2CT240A4
Serial number: CVKI2455002X240DGN
Firmware rev.: 335t

Information for .PhysicalDrive1:
Windows: cyl: 91201
tpc: 255
spt: 63
C/H/S: 16383/16/63
Model: ST9750420AS
Serial number: 6WS17Q68
Firmware rev.: 0002DEM1

Information for .PhysicalDrive2:
Windows: cyl: 486
tpc: 255
spt: 63

Which disk do you want to write? (0..2) 2
WARNING: that disk is larger than 2 GB! Make sure you're not accidentally
overwriting your primary hard disk! Proceeding on your own risk...
About to overwrite the contents of disk 2 with new data. Proceed? (y/n) y
Found compressed image file
3989970432/3989970432 bytes written in total


Reference:
http://doc.pfsense.org/index.php/Installing_pfSense
http://forum.pfsense.org/index.php/topic,57064.0.html

Thursday, January 24, 2013

Zend Debugger How To

Download and Install Zend Debugger

# wget http://downloads.zend.com/studio_debugger/2011_04_10/ZendDebugger-20110410-linux-glibc23-x86_64.tar.gz
# wget http://downloads.zend.com/studio_debugger/2011_04_10/ZendDebugger-20110410-linux-glibc23-i386.tar.gz
# tar xzvf ZendDebugger-20110410-linux-glibc23-x86_64.tar.gz
# cp ZendDebugger-20110410-linux-glibc23-x86_64/5_3_x_comp/ZendDebugger.so /usr/lib64/php/modules/ZendDebugger.so


Configuration Debugger

# vi /etc/php.d/zend_debug.ini



;;;;;;;;;;;;;;;;;;;;
; ZendDebugger ;
;;;;;;;;;;;;;;;;;;;;
zend_extension=/usr/lib64/php/modules/ZendDebugger.so
zend_debugger.allow_hosts=192.168.1.1/16
zend_debugger.expose_remotely=always


Restart Apache before Testing

# service httpd restart


Check if it works

# php -v

PHP 5.3.3 (cli) (built: Jun 27 2012 12:53:18)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies


Error:libssl.so.0.9.8:

# php -v



Failed loading /usr/lib64/php/modules/ZendDebugger.so: libssl.so.0.9.8: cannot open shared object file: No such file or directory
PHP 5.3.3 (cli) (built: Jun 27 2012 12:53:18)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies


Install openssl098e package

# yum -y install openssl098e.x86_64

epel/metalink | 9.1 kB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.0 MB 00:03
ol6_UEK_latest | 1.2 kB 00:00
ol6_latest | 1.4 kB 00:00
ol6_latest/primary | 24 MB 00:31
ol6_latest 18436/18436
pgdg92 | 2.8 kB 00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package openssl098e.x86_64 0:0.9.8e-17.0.1.el6_2.2 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
openssl098e x86_64 0.9.8e-17.0.1.el6_2.2 ol6_latest 761 k

Transaction Summary
================================================================================
Install 1 Package(s)

Total download size: 761 k
Installed size: 2.2 M
Downloading Packages:
openssl098e-0.9.8e-17.0.1.el6_2.2.x86_64.rpm | 761 kB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : openssl098e-0.9.8e-17.0.1.el6_2.2.x86_64 1/1
Verifying : openssl098e-0.9.8e-17.0.1.el6_2.2.x86_64 1/1

Installed:
openssl098e.x86_64 0:0.9.8e-17.0.1.el6_2.2

Complete!


Link the file


# ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
# ln -s /usr/lib64/libcrypto.so.0.9.8e /usr/lib64/libcrypto.so.0.9.8


Check it Again
# php -v



PHP 5.3.3 (cli) (built: Jun 27 2012 12:53:18)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies


Reference:
http://forums.zend.com/viewtopic.php?f=8&t=3281
http://forums.zend.com/viewtopic.php?f=59&t=962
http://static.zend.com/topics/Zend-Debugger-Installation-Guide.pdf
http://static.zend.com/topics/Debugger-Install.pdf
http://www.developertutorials.com/tutorials/php/php-debugging-with-zend-studio-8-02-01-938/

Ubuntu/debian/Mint Setup Fixed IP address

Before setup fixed IP address please use an ifconfig to determine the current subnet.

$ sudo vi /etc/network/interfaces

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.59.133
gateway 192.168.59.2
netmask 255.255.255.0


$ sudo /etc/init.d/networking restart

Wednesday, January 23, 2013

SELinux cause PostgreSQL error: could not connect to server: Permission denied

The php command line works but not the apache page.

Error message:

pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Permission deniednt
Is the server running on host "localhost" (::1) and acceptingnt
TCP/IP connections on port 5432?ncould not connect to server: Permission deniednt
Is the server running on host "localhost" (127.0.0.1) and acceptingnt
TCP/IP connections on port 5432? in /home/www/htdocs/test.php on line 3


If you don't want to be using SELinux then disabling it is an option, but if you prefer the other protection it offers you may just want to enable the specific permission to allow Apache to issue HTTP connections.

As root, running:

# service httpd stop
# service postgresql-9.2 stop

# setsebool -P httpd_can_network_connect 1

# service httpd start
# service postgresql-9.2 start

How To Install VMware Tools for VMware Player

How To Install VMware Tools for VMware Player

mkdir /mnt/cdrom
mount -t iso9660 /dev/cdrom /mnt/cdrom

cp /mnt/cdrom/VMwareTools*.gz /root
or
wget http://www.milliondollarserver.com/iso/VMwareTools-9.2.2-893683.tar.gz

yum install perl gcc make kernel-devel kernel-uek-devel

tar zxvf VMwareTools-9.2.2-893683.tar.gz
./vmware-install.pl

Would you like to enable VMware automatic kernel modules?
[no]

No X install found.

Creating a new initrd boot image for the kernel.
vmware-tools-thinprint start/running
vmware-tools start/running
The configuration of VMware Tools 9.2.2 build-893683 for Linux for this running
kernel completed successfully.

You must restart your X session before any mouse or graphics changes take
effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the
command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and
file and text copy/paste), you will need to do one (or more) of the following:
1. Manually start /usr/bin/vmware-user
2. Log out and log back into your desktop session; and,
3. Restart your X session.

Enjoy,

--the VMware team

Reference:http://www.vmware.com/support/ws5/doc/ws_newguest_tools_linux.html

Thursday, January 17, 2013

Upgrade pfSense - new component

Here is the component and price for the new build.

Intel Next Unit of Computing (NUC) BOXDCCP847DYE
$179.99 from newegg.ca

Intel Celeron 847 1.1GHz (soldered down) with active heatsink
Intel® QS77 Express Chipset
Integrated Intel® 10/100/1000 network connection

1GB DDR3 SO-DIMM 1333/1600 MHz memory
$ 0.00 pull from old laptop

SANDISK CRUZER FIT 4GB 16G 16 G GB USB FLASH DRIVE
$ 4.21 from ebay.ca

AR9280 802.11B/G/N 300M Wireless Wifi N Card AR5BXB92
$ 10.04 from ebay.ca

Upgrade pfSense box - current system

Currently my pfSense based on:

Intel D945GSEJT Mini-ITX with ATOM on it.

Onboard Realtek 8111DL Gigabit Ethernet.
Intel PCI Gigabit Ethernet.
1GB DDR2 SO-DIMM memory.
Intel 80GB SSD.

Friday, January 4, 2013

Ubuntu monitor CPU system temperatures fan speeds

Ubuntu can monitor CPU and other system temperatures, fan speeds, and voltages via command line, using the package lm-sensors.

lm-sensors - utilities to read temperature/voltage/fan sensors

1.Install the package:
# sudo apt-get install lm-sensors

2.Run sudo sensors-detect and choose YES to all YES/no questions.
I choice all YES, did not have any trouble on Lenovo TS200v

3.At the end of sensors-detect, a list of modules that needs to be loaded will displayed.
Type "yes" to have sensors-detect insert those modules into /etc/modules, or edit /etc/modules yourself.

Intel digital thermal sensor... Success!
(driver `coretemp')

Trying family `SMSC'... Yes
Using driver `i2c-i801' for device 0000:00:1f.3: Intel 3400/5 Series (PCH)
Module i2c-i801 loaded successfully.
Module i2c-dev loaded successfully.

Probing for `Microchip MCP98242'... Success!
(confidence 5, driver `jc42')
Probing for `Microchip MCP98243'... Success!
(confidence 5, driver `jc42')

Driver `jc42':
* Bus `SMBus I801 adapter at f000'
Busdriver `i2c_i801', I2C address 0x18
Chip `Microchip MCP98242' (confidence: 5)
* Bus `SMBus I801 adapter at f000'
Busdriver `i2c_i801', I2C address 0x1a
Chip `Microchip MCP98243' (confidence: 5)

Driver `coretemp':
* Chip `Intel digital thermal sensor' (confidence: 9)

To load everything that is needed, add this to /etc/modules:
#----cut here----
# Adapter drivers
i2c_i801
# Chip drivers
coretemp
jc42
#----cut here----
If you have some drivers built into your kernel, the list above will
contain too many modules. Skip the appropriate ones!

Do you want to add these lines automatically to /etc/modules? (yes/NO)
service module-init-tools restart

4.Next, run sudo service module-init-tools restart

This will read the changes you made to /etc/modules in step 3, and insert the new modules into the kernel.

# sensors

will give the output.

Support Folding@home on Ubuntu 12.04 LTS

I have a Lenovo TS200v server at home.
Added an old i7 CPU, unplug Hard Drive, DVD and install Ubuntu Sever 12.04 LTS on a 2 GB USB Flash Drive.

Download the debian package:
wget https://fah-web.stanford.edu/file-releases/beta/release/fahclient/debian-testing-64bit/v7.2/fahclient_7.2.9_amd64.deb

Install the package:
# sudo dpkg -i fahclient_7.2.9_amd64.deb


Selecting previously unselected package fahclient.
(Reading database ... 44003 files and directories currently installed.)
Unpacking fahclient (from fahclient_7.2.9_amd64.deb) ...
Adding system user fahclient...done
Setting up fahclient (7.2.9) ...
Adding system startup for /etc/init.d/FAHClient ...
/etc/rc0.d/K20FAHClient -> ../init.d/FAHClient
/etc/rc1.d/K20FAHClient -> ../init.d/FAHClient
/etc/rc6.d/K20FAHClient -> ../init.d/FAHClient
/etc/rc2.d/S20FAHClient -> ../init.d/FAHClient
/etc/rc3.d/S20FAHClient -> ../init.d/FAHClient
/etc/rc4.d/S20FAHClient -> ../init.d/FAHClient
/etc/rc5.d/S20FAHClient -> ../init.d/FAHClient
Starting fahclient ... FAIL
invoke-rc.d: initscript FAHClient, action "start" failed.
Processing triggers for ureadahead ...
ureadahead will be reprofiled on next reboot


Add missing libs:
# sudo apt-get install libssl0.9.8 libegl1-mesa libgl1-mesa-glx

Reinstall the package
# sudo dpkg -r fahclient
# sudo dpkg -i fahclient_7.2.9_amd64.deb


Config file /etc/fahclient/config.xml:


















Remote FAHControl still not working.

/var/lib/fahclient/log.txt gave error:
19:17:45:Server access denied for 192.168.1.6:57856

To allow access from 192.168.1.0/24 subnet: