Monday, October 17, 2016

Hang when mounting nfs share

You have already configured the share in NFS server but when you mount it on the nfs client, the command just hang. To resolve use -o nolock
# mount -t nfs -o nolock 192.168.1.1:/home /home

Tuesday, October 11, 2016

Install asterisk on CentOS 6

How to install asterisk on CentOS 6. In this tutorial, the version of CentOS 6 is
# cat /etc/redhat-release 
CentOS release 6.4 (Final)
1. Update the environment
# yum install -y epel-release dmidecode gcc-c++ ncurses-devel libxml2-devel make wget openssl-devel newt-devel kernel-devel sqlite-devel libuuid-devel gtk2-devel jansson-devel binutils-devel
2. Install pjproject
# cd /tmp
# wget http://www.pjsip.org/release/2.5.5/pjproject-2.5.5.tar.bz2
# tar -jxvf pjproject-2.5.5.tar.bz2
2.1 Compile pjproject
# cd pjproject-2.5.5
# ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --enable-shared --disable-video --disable-sound --disable-opencore-amr
NOTE: I am installing in an 32bit machine. If you are using 64bit machine, add --libdir=/usr/lib64
# make dep
# make 
# make install
# ldconfig
Verify the pjsip libraries have been dynamically linked
# ldconfig -p | grep pj
3. Install asterisk
# cd /tmp
#  wget http://downloads.asterisk.org/pub/telephony/certified-asterisk/asterisk-certified-13.8-current.tar.gz
# tar -zxvf asterisk-certified-13.8-current.tar.gz 
# cd asterisk-certified-13.8-cert2
# ./configure
NOTE: If you are using 64bit machine, add --libdir=/usr/lib64 Error encountered
checking for json_dumps in -ljansson... no
configure: error: *** JSON support not found (this typically means the libjansson development package is missing)
#
To resolve, install jansson
# wget http://www.digip.org/jansson/releases/jansson-2.9.tar.gz
# tar -zxvf  jansson-2.9.tar.gz
# cd jansson-2.9
# ./configure
# make
# make install
Go back to asterisk-certified-13.8-cert2 and run ./configure Verify if the pjsip channel driver dependencies have been successfully installed.
# make menuselect
If all res_pjsip has (*) then you are good. Proceed with the installation.
# make 
# make install
You should see the following
 +---- Asterisk Installation Complete -------+
 +                                           +
 +    YOU MUST READ THE SECURITY DOCUMENT    +
 +                                           +
 + Asterisk has successfully been installed. +
 + If you would like to install the sample   +
 + configuration files (overwriting any      +
 + existing config files), run:              +
 +                                           +
 + For generic reference documentation:      +
 +    make samples                           +
 +                                           +
 + For a sample basic PBX:                   +
 +    make basic-pbx                         +
 +                                           +
 +                                           +
 +-----------------  or ---------------------+
 +                                           +
 + You can go ahead and install the asterisk +
 + program documentation now or later run:   +
 +                                           +
 +               make progdocs               +
 +                                           +
 + **Note** This requires that you have      +
 + doxygen installed on your local system    +
 +-------------------------------------------+
#
If you want Asterisk to start at boot time use the following command to setup the Asterisk service. You should have asterisk in /etc/init.d
# make config
# chkconfig --list | grep asterisk
asterisk        0:off   1:off   2:on    3:on    4:on    5:on    6:off
Error Encountered
# asterisk /usr/sbin/asterisk -C /etc/asterisk/asterisk.conf
asterisk: error while loading shared libraries: libjansson.so.4: cannot open shared object file: No such file or directory
Solution
# ln -s /usr/local/lib/libjansson.so.4 /usr/lib/libjansson.so.4
# echo /usr/local/lib > /etc/ld.so.conf.d/asterisk.conf
# ldconfig
Verify if you can locate libjansson.so.4
# updatedb
# locate libjansson.so.4
You should be able to list /usr/lib/libjansson.so.4

Saturday, September 17, 2016

Change or Remove Passphrase Key in ssh Private Key

Change or Remove Passphrase Key in ssh Private Keys
# ssh-keygen -p -f private_key
Enter old passphrase:
Key has comment 'private_key'
Enter new passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved with the new passphrase.

Saturday, September 26, 2015

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

I have an error after I do fdisk on my new disk.

[root@local ~]$

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 8e
Changed system type of partition 1 to 8e (Linux LVM)

Command (m for help): p

Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      243201  1953512001   8e  Linux LVM

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@local ~]$

Solution:

hdparm -z /dev/sdb

Tuesday, December 23, 2014

Thursday, September 25, 2014

How to identify if your bash shell is vulnerable to Bash Code Injection Vulnerability (CVE-2014-6271) , CVE-2014-7169

This new vulnerable in bash is spreading quickly over the Internet just like the heartbleed. How to know if your bash version is vulnerable?
For Linux
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
For Solaris 10
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
For Solaris 11
env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

Solution is of course to patch or update to the latest version of bash. Go check out your OS for any updates now.

Tuesday, May 20, 2014

Starting spamd: child process [22173] exited or timed out without signaling production of a PID file

I upgraded spamassassin and encountered an error when trying to start it.
[root@nelsoncli Mail-SpamAssassin-3.4.0]# /etc/init.d/spamassassin start
Starting spamd: child process [22173] exited or timed out without signaling production of a PID file: exit 255 at /usr/bin/spamd line 2960.
                                                           [FAILED]
Solution: Run sa-update.