welcome to netwrkspider

Monday, June 17, 2013

How to : Install & configure High Availbility Heartbeat Cluster on Centos 6.x/ Redhat 6.x with Apache web Server

Heartbeat is a daemon that provides cluster infrastructure (communication and membership) services to its clients. This allows clients to know about the presence (or disappearance!) of peer processes on other machines and to easily exchange messages with them.
In order to be useful to users, the Heartbeat daemon needs to be combined with a cluster resource manager (CRM) which has the task of starting and stopping the services (IP addresses, web servers, etc.) that cluster will make highly available. Pacemaker is the preferred cluster resource manager for clusters based on Heartbeat. Source : http://linux-ha.org/wiki/Heartbeat

Requirements :-
2 linux nodes, RHEL 6.x/CentOS 6.x
LAN & Internet connection.
A yum server.
Node-1: 192.168.28.4
Node-2: 192.168.28.5
Virtaul IP Address (VIP) :-  192.168.28.6
1. Set the fully qualified hostnames and give corresponding entries in /etc/hosts and /etc/sysconfig/network
node-1 :- 192.168.28.4 :- node1
node-2 :- 192.168.28.5 :- node2

2. Configuring Apache on both node
# yum install httpd mod_ssl
On node1
# vim /var/www/html/index.html
This is test page of node 1 of Heartbeat HA cluster
On node2
# vim /var/www/html/index.html
This is test page of node 2 of Heartbeat HA cluster
On both nodes:
# vim /etc/httpd/conf/httpd.conf
Listen 192.168.28.6:80

3. Now start the service in both nodes.
# /etc/init.d/httpd restart
# chkconfig httpd on

Note:- It won’t work until heartbeat is started. So don’t worry

4. Confirm them from broswer. (If You are on terminal use Lynx browser )

5. Install the following packages in both nodes:
(These below packages are not necessary, but you can install it.)
# yum install glibc*
# yum install gcc*
# yum install lib*
# yum install flex*
# yum install net-snmp*
# yum install OpenIPMI*
# yum install python-devel
# yum install perl*
# yum install openhpi*
6. Save the repo file for clusterlabs online repository in both node. Its available in http://www.clusterlabs.org/rpm/epel-5/clusterlabs.repo
# cd /etc/yum.repos.d/
(Note : Add latest EPEL repository )

7. After that install heartbeat packages on both nodes:
# yum install cluster-glue* heartbeat* resource-agents*

8. Setting Configuration files:
We can do all configuration in one system and copy the /etc/ha.d to both nodes.
#cd /etc/ha.d
#cat README.config

9. The details about configuration files are explained in this file. We have to copy three
configuration files to this directory from samples in documentation.

# cp /usr/share/doc/heartbeat-3.0.3/authkeys /etc/ha.d/
# cp /usr/share/doc/heartbeat-3.0.3/ha.cf /etc/ha.d/
# cp /usr/share/doc/heartbeat-3.0.3/haresources /etc/ha.d/

10. We have to edit the authkeys file on both nodes:

We are using sha1 algorithm:

# vim /etc/ha.d/authkeys
—————
auth 2
#1 crc
2 sha1 test@net4
#3 md5 Hello!
—————


11. Change the permission of authkeys to 600 to both nodes:

# chmod 600 authkeys

12. We have to edit the ha.cf file on both nodes:
# vim /etc/ha.d/ha.cf
uncomment following lines and make edits
—————————————–
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
warntime 10
initdead 120
udpport 694
bcast eth0
auto_failback on //Keep resources on their "preferred" hosts - needed for active/active
node node1 // in both nodes command “uname -n” should give the these hostnames
node node2
—————————————–

13. We have to edit the haresources file on both nodes separately:
on node-1 :-
# vim /etc/ha.d/haresources
node1    192.168.28.6 httpd
on node-2 :-
# vim /etc/ha.d/haresources
node2    192.168.28.6 httpd

Note:- You dont have to create an interface and set this IP or make a IP alias. Heartbeat will take care of it Automatically.

14. Now exchange and save authorized keys between node1 and node2
node-1# ssh-keygen -t rsa
node-1# ssh-copy-id -i ~/.ssh/id_rsa.pub node2
node-2# ssh-keygen -t rsa
node-2# ssh-copy-id -i ~/.ssh/id_rsa.pub node1
15. Start Heartbeat service on both nodes:
# /etc/init.d/heartbeat start
# chkconfig heartbeat on

Tuesday, June 11, 2013

How to : High-Availability Storage With GlusterFS 3.2.x On Ubuntu 12.04 LTS server/ Ubuntu 13.04

Gluster is a distributed scale out filesystem that allows rapid provisioning of additional storage based on your storage consumption needs. It incorporates automatic failover as a primary feature. All of this is accomplished without a centralized metadata server.

More info : Visit http://www.gluster.org

The following steps should be performed on SERVER1, SERVER2 and SERVER3.

1 ) Install GlusterFS packages using package manager:

$ apt-get install -y glusterfs-server

2 ) Create a directory which will be exported through GlusterFS:

$mkdir /storage

3 ) Make corresponding changes to the GlusterFS server configuration file:

=================================================================
# /etc/glusterfs/glusterfsd.vol
volume posix
type storage/posix
option directory /storage
end-volume

volume locks
type features/posix-locks
subvolumes posix
end-volume

volume brick
type performance/io-threads
option thread-count 8
subvolumes locks
end-volume

volume server
type protocol/server
option transport-type tcp
subvolumes brick
option auth.addr.brick.allow *
end-volume

=================================================================

4 ) Start GlusterFS server service:

$ service glusterfs-server start

5 ) Make corresponding changes to the GlusterFS client configuration file:

=================================================================

# /etc/glusterfs/glusterfs.vol
volume server1
        type protocol/client
        option transport-type tcp
        option remote-host SERVER1
        option remote-subvolume brick
end-volume

volume server2
        type protocol/client
        option transport-type tcp
        option remote-host SERVER2
        option remote-subvolume brick
end-volume

volume server3
        type protocol/client
        option transport-type tcp
        option remote-host SERVER3
        option remote-subvolume brick
end-volume

volume replicated_storage
        type cluster/replicate
        subvolumes node1 node2 node3
end-volume

==================================================================

6 ) Add following line into /etc/fstab to allow auto-mount:

---------------------------------------------------------------------------------------------------
/etc/glusterfs/glusterfs.vol    /var/www/blog   glusterfs defaults      0 0
---------------------------------------------------------------------------------------------------

7 ) Create a new directory for the php based application (wordpress, Joomla, drupal etc etc. ) content:

$mkdir /var/www/sites/

8 ) Mount the GlusterFS to /var/www/sites:

$ mount -a

How to : Compile mod_bw for apache server 2.4.x on Centos 6.3/ Fedora / Redhat 6.0/ Ubuntu 12.04

How to Compile mod_bw for apache server 2.4.x on Linux Server.

1 ) Download the mod_bw package from
wget http://bwmod.sourceforge.net/files/mod_bw-0.7.tgz
tar -zxvf mod_bw-0.7.tgz
cd mod_bw

2 ) Open & edit  C program file mod_bw.c

a ) Search “remote_addr” and replace to “client_addr”

b ) That will install the module correctly, but when you add the configuration option to your vhost configs you might get an error "undefined symbol: apr_atomic_cas". When that happens, open the file mod_bw.c and change the following:

Before:

/* Compatibility for ARP < 1 */
#if (APR_MAJOR_VERSION < 1)
    #define apr_atomic_inc32 apr_atomic_inc
    #define apr_atomic_dec32 apr_atomic_dec
    #define apr_atomic_add32 apr_atomic_add
    #define apr_atomic_cas32 apr_atomic_cas
    #define apr_atomic_set32 apr_atomic_set
#endif


AFTER : comment the block.


/* Compatibility for ARP < 1 */
/*
#if (APR_MAJOR_VERSION < 1)
   #define apr_atomic_inc32 apr_atomic_inc
   #define apr_atomic_dec32 apr_atomic_dec
   #define apr_atomic_add32 apr_atomic_add
   #define apr_atomic_cas32 apr_atomic_cas
   #define apr_atomic_set32 apr_atomic_set
#endif
*/

Save & exit.

3 ) Now use apache extension tool for compile mod_bw.c code.

apxs -i -a -c mod_bw.c

Check & verify your httpd.conf files.

4 ) restart Apache Server
apachectl restart

How to : Compile mod_cband module for Apache 2.4.x on Centos 6.3/Fedora /Redhat 6

How to Compile mod_cband module for Apache 2.4.3 on Centos 6.3/ Redhat/ Fedora/ Ubuntu 12.04

mod_cband is an Apache 2 module that solves the problem of limiting the bandwidth usage of users, virtual hosts, and destinations.

INSTALLATION
============
Prerequisites

Apache 2.0.54 or above  Apache 2.4.3- http://www.apache.org/
Other versions may work but have not been tested
I Have tested on Apache 2.4.3
Building
If you have got the apxs/apxs2 (Apache eXtenSion tool) tool installed, write the following commands to build module:

$ wget http://pkgs.fedoraproject.org/repo/pkgs/mod_cband/mod-cband-0.9.7.4.tgz/ff635d7b55bf7ca648d319247dfb45e3/mod-cband-0.9.7.4.tgz
$ tar xzvf mod-cband-0.9.7.4.tgz
$ cd mod-cband-0.9.7.4
$ ./configure
$ make
$ make install

Note : Above Source code having error for Apache 2.4.x version

Error : if You got the error Like this while executing make.

apxs -Wc,-Wall -Wc,-DDST_CLASS=3 -c src/mod_cband.c
/usr/local/apr/build-1/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic   -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache/include  -I/usr/local/apr/include/apr-1   -I/usr/local/apr/include/apr-1  -Wall -DDST_CLASS=3  -c -o src/mod_cband.lo src/mod_cband.c && touch src/mod_cband.slo
src/mod_cband.c: In function 'mod_cband_create_traffic_size':
src/mod_cband.c:1046: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1046: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1050: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c:1050: warning: comparison with string literal results in unspecified behavior
src/mod_cband.c: In function 'mod_cband_get_dst':
src/mod_cband.c:1325: error: 'conn_rec' has no member named 'remote_ip'
src/mod_cband.c: In function 'mod_cband_get_remote_host':
src/mod_cband.c:1354: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1355: error: 'struct conn_rec' has no member named 'remote_ip'
src/mod_cband.c:1357: error: 'struct conn_rec' has no member named 'remote_addr'
apxs:Error: Command failed with rc=65536
.
make: *** [src/.libs/mod_cband.so] Error 1

On Source Directory
[root@netwrkspider mod-cband-0.9.7.4]# ls
AUTHORS  conf        config.status  doc      libpatricia.copyright  Makefile     src
Changes  config.log  configure      INSTALL  LICENSE                Makefile.in

open c program file under src folder .
[root@netwrkspider src]# vim mod_cband.c

On c code
1 ) change variable name remote_ip" to "client_ip"

2 ) Search & change the given below line.

else
        addr = c->remote_addr->sa.sin.sin_addr.s_addr;
to
    else
        addr = c->client_addr->sa.sin.sin_addr.s_addr;


Save & exit .

Now try to compile program from mod_cband root directory.

make
make install

Enjoy

Note : API Changes in Apache HTTP Server 2.4 since 2.2
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html

Code Changes Details :




Saturday, May 25, 2013

How to : Add Kali Linux 1.0 full Repository on Ubuntu 13.04 / 12.04 / 10.04

# How to : Add full Kali Linux 1.0 Repository on Ubuntu 13.04 / 12.04 / 10.04

 

Step 1 : open file /etc/apt/sources.list using vi/vim/gedit

root@netwrkspider:~# gedit /etc/apt/sources.list

Note : edit the repository - to use vim check the following link http://www.tuxfiles.org/linuxhelp/vimcheat.html

Now add the all repository on file sources.list 

deb http://http.kali.org/ /kali main contrib non-free
deb http://http.kali.org/ /wheezy main contrib non-free
deb http://http.kali.org/kali kali-dev main contrib non-free
deb http://http.kali.org/kali kali-dev main/debian-installer
deb-src http://http.kali.org/kali kali-dev main contrib non-free
deb http://http.kali.org/kali kali main contrib non-free
deb http://http.kali.org/kali kali main/debian-installer
deb-src http://http.kali.org/kali kali main contrib non-free
deb http://security.kali.org/kali-security kali/updates main contrib non-free
deb-src http://security.kali.org/kali-security kali/updates main contrib non-free

Step 2 : Update Repository  & Upgrade Ubuntu

root@netwrkspider:~# apt-get update


root@netwrkspider:~# apt-get upgrade


Thanks & Enjoy

Sunday, April 28, 2013

How to : Install twinkle on Ubuntu 13.04 / 12.10 / 12.04


#Twinkle : Twinkle is a softphone for your voice over IP and instant messaging communcations using the SIP protocol. You can use it for direct IP phone to IP phone communication or in a network using a SIP proxy to route your calls and messages.

#How to install twinkle on ubuntu 13.04

Open Terminal :

netwrkspider@netwrkspider:~$ sudo vim /etc/apt/sources.list

# Add following lines at the end

deb http://http.us.debian.org/debian stable main contrib non-free
deb-src http://ftp.debian.org/debian stable main contrib non-free

#Now execute on terminal :

sudo apt-get update

#Now execute on terminal

sudo apt-get install twinkle


Note:  if PPA Add doesn't work type below cmd on terminal

sudo apt-get install python-software-properties


Enjoy

Thursday, April 18, 2013

How to hack DNS : - Enumerate Domain to get IPV4 & IPV6 Address- by netwrkspider

Today im gonna teach you how to find domains or subdomains using dnsdict6 tool which comes under KALI LINUX >> Information Gathering >>Network Analysis >> DNS Analysis >> dnsdict6

dnsdict6 powerful dns sniffing tool is mainly used for information gathering  of a particular domain and finds subdomains which is invisible to public but still exist, these domains could be forgotten by admin and may have high vulnerabilities.

Note:-
-d is used to display information on Name Servers and MX Records
-4 is used to dump IPv4 addresses.
There are four types of dictionary which are already inbuilt in this tool. -s(mall=50), -m(edium=796) (DEFAULT) -l(arge=1416), or -x(treme=3211).
-t is used to specify no. of threads.

To enumerate the domains, type dnsdict6 -d46 -s -x -t 25 www.target.com. Then hit Enter.

More : See manual

#Demo