Friday, August 6, 2010
LOADBALANCE WITH MULTI PPPoE INTERFACE IN PFSENSE 2.0
Tuesday, June 1, 2010
Setting Up A High-Availability Load Balancer HTTPS(With Failover and Session Support) With HAProxy/Keepalived/Stunnel
Friday, May 14, 2010
Setting Up A High-Availability Load Balancer(With Failover and Session Support) With HAProxy/Keepalived
For this howto I set up four Centos systems (minimal installation without gui etc.) with the following configuration:
Load Balancer 1
IP: 192.168.236.128(eth0) and 192.168.127.128(eth1) Shared IP: 192.168.236.130
Load Balancer 2
IP: 192.168.236.129 192.168.127.129(eth1) Shared IP: 192.168.236.130
Web Server 1
IP: 192.168.127.130
Web Server 2
IP: 192.168.127.132
Tuesday, April 6, 2010
Deploy iptables Cluster using Fwbuilder and Heartbeat
Firewall Builder is packaged with most Linux distributions. If the package is not available in the base distribution, it usually can be found in "extras". You need to install package that has supporting API library libfwbuilder and package fwbuilder that contains Firewall Builder GUI and policy compilers. You can use your favorite package management tool sucn as yum, apt-get or aptitude to find and install them. On FreeBSD and OpenBSD Firewall Builder is part of ports, you can find it in /usr/ports/security/fwbuilder. Now The new version comes with support for high availability firewall configurations, including heartbeat, vrrpd, keepalived, conntrackd on Linux, CARP and pfsync on OpenBSD and PIX failover configuration. It can generate configuration scripts to manage ip addresses, VLAN, bridge and bonding interfaces on the firewall. Drop-in support for OpenWRT firewall script is now available, as well as experimental integration with IPCOP firewall appliances. The GUI has supports undo/redo of unlimited depth and was generally streamlined and has many other improvements.you can prefer:http://www.fwbuilder.org/
2/Install
Step 1:config IP for 2 firewall as image
Step 2:install heartbeat
yum -y install heartbeat
Step 3:copy file configure default.It's necessary to do this on both systems
cp /usr/share/doc/heartbeat-2.1.3/authkeys /etc/ha.d/authkeys
cp /usr/share/doc/heartbeat-2.1.3/ ha.cf etc/ha.d/ha.cf
cp /usr/share/doc/heartbeat-2.1.3/haresources etc/ha.d/haresources
Step 4 :Edit /etc/ha.d/authkeys It's necessary to do this on both systems
auth 3
Step 5:edit etc/ha.d/ha.cf.It's necessary to do this on both systems
keepalive 2 #line 52
deadtime 10 # line 60
mcast eth0 225.0.0.1 694 1 0 #line 117
mcast eth1 225.0.0.1 694 1 0 #line 118
step 6:edit etc/ha.d/haresources
fw1.test.vn IPaddr::192.168.10.145/24/eth0/192.168.10.255
fw1.test.vn IPaddr::172.16.1.3/16/eth1/172.16.255.255
shutdown fw1 test again
start fw1 test again
beside you can use vrrp,carp.... for cluster.
if you need file template for config .Please send mail to quan.hoa@conheotiensinh.co.cc.I Will send it to you
Thanks
Thursday, December 31, 2009
INSTALL IPS(SNORT) WITH EasyIDS and Guardian
An Intrusion prevention system (IPS) is a network security device that monitors network and/or system activities for malicious or unwanted behavior and can react, in real-time, to block or prevent those activities. Network-based IPS, for example, will operate in-line to monitor all network traffic for malicious code or attacks . When an attack is detected, it can drop the offending packets while still allowing all other traffic to pass. Intrusion prevention technology is considered by some to be an extension of intrusion detection (IDS) technology
II/INSTALL
Step 1:Install IDS as http://conheotiensinh.blogspot.com/2009/12/install-ids-in-centos-with-5-minutes.html
Step 2:IPS – Guardian
Guardian is a security program which works in conjunction with Snort to automaticly update firewall rules based on alerts generated by Snort.
The updated firewall rules block all incoming data from the IP address of the attacking machine (the machine which caused Snort to generate an alert.
There is also logic in place which pervents blocking important machines, such as DNS servers, gateways, and whatever else you want.
Step 3:
Go to http://www.chaotic.org/guardian/ to download Guardian. The current version as at this writing is version 1.7.
#wget
http://www.chaotic.org/guardian/guardian-1.7.tar.gz#
tar -xzvf guardian-1.7.tar.gz
#cd guardian-1.7
#cp guardian.pl /usr/local/bin/
#cp scripts/iptables_block.sh /usr/local/bin/guardian_block.sh
#cp scripts/iptables_unblock.sh /usr/local/bin/guardian_unblock.sh
#cp guardian.conf /etc/snort/
#touch /etc/snort/guardian.ignore
#touch /etc/snort/guardian.target
#touch /var/log/snort/guardian.logStep 4:
edit /etc/snort/guardian.conf change some variablesHostIpAddr xxx.xxx.xxx.xxx (IP snort monitor)
Interface ETH01 (interface snort monitor)
HostGatewayByte 75
Logfile /var/log/snort/guardian.log
AlertFile /var/log/messages
IgnoreFile /etc/snort/guardian.ignore
TargetFile /etc/snort/guardian.target
TimeLimit 86400
Step 5:
Edit /usr/local/bin/guardian_block.sh change some variables(this shell will block ip attacker and alert mail to test@conheotiensinh.co.cc )source=$1
interface=$2
/sbin/iptables -I INPUT -s $source -i $interface -j DROP
/sbin/iptables -I FORWARD -s $source -i $interface -j DROP
echo "$source is blocked!" | mail -s "Snort alert is blocked" test@conheotiensinh.co.cc
Step 6:Edit /usr/local/bin/guardian_unblock.sh change some variables(this shell will delete ip attaker from block ip and alert mail to test@conheotiensinh.co.cc)source=$1
interface=$2
/sbin/iptables -D INPUT -s $source -i $interface -j DROP
/sbin/iptables -D FORWARD -s $source -i $interface -j DROP
echo "$source is blocked for 24 hours! It is released!" | mail -s "Snort alert is released" test@conheotiensinh.co.ccStep 7:
Edit
/etc/snort/guardian.targetadd ip (snort monitor)
Step 8:
Edit /etc/snort/guardian.ignoreadd ip 127.0.0.1
Step 9:
Edit /etc/snort/snort.confuncomment “output alert_syslog: LOG_AUTH LOG_ALERT”
service snort restart
guardian.sh #————— CUT HERE —————–#
#!/bin/bash
start()
{
export PATH=$PATH:/usr/local/bin
/usr/local/bin/guardian.pl -c /etc/snort/guardian.conf
}
stop()
{
ps aux | grep 'guardian.pl *-c' 2>&1 > /dev/null
if [ $? -eq 0 ];
then
kill `ps aux | grep 'guardian.pl *-c' | awk '{print $2}'`
else
echo "Guardian is not running ....."
fi
}
status()
{
ps aux | grep 'guardian.pl *-c' 2>&1 > /dev/null
if [ $? -eq 0 ];
then
echo "Guardian is Running ....."
else
echo "Guardian is not Running ...."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
esacStep 11:
chmod +x guardian.shcp guardian.sh /usr/local/bin/guardian.sh
/usr/local/bin/guardian.sh start
Step 12:test
use nmap test
#nmap -v -sS xxx.xxx.xxx.xxx
Beside you can use Easy IDS as IPS with other Firewall:FreeBSD using IPFW,Checkpoint, PIX....use SSH copy rule to firewall
Please prefer:http://www.chaotic.org/guardian/
Tuesday, December 29, 2009
Install IDS in Centos with 5 minutes
I/Intro
An Intrusion detection system (IDS) is a device (or application) that monitors network and/or system activities for malicious activities or policy violation.IDS install very hard (you need install Snort,HTTP,MYSQL and ......). But With EasyIDS you install IDS easier
II/Install
Step 1:you download ISO EasyIDS from http://sourceforge.net/projects/easyids/files/
Step 2:install It as install Centos OS (EasyIDS 4.0 run with Centos 5.4)
Step3:config Ip for Nic Card
Setp 4: To access the EasyIDS GUI browse to https://IPADDRESS from another computer and login with the username admin and the password password.
Friday, December 4, 2009
INSTALL Monit for Monitor System
Monit is a free open source utility for managing and monitoring, processes, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.
II/INSTALL
Step 1:Install monit
#wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#rpm -Uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum install monit
#chkconfig --levels 235 monit on
Step 2:Config Monit
edit /etc/moni.d/monitrc
set daemon 60
set logfile syslog facility log_daemon
set mailserver localhost #mail server
set mail-format { from: monit@server1.example.com }
set alert root@localhost #alert to admin with email adrress root@localhost
set httpd port 2812 and
SSL ENABLE
PEMFILE /var/certs/monit.pem
allow admin:test
some features example of monit
*check host CUIBAP with address 19.16.12.32
if failed icmp type echo with timeout 20 seconds then alert
(check host if over 20 second it will alert mail to admin)
*check host CONHEO with address 132.163.193.3
if failed port 25 with timeout 30 seconds then alert
(check Service SMTP if over 30 second it will alert mail to admin)
*check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if failed port 22 protocol ssh then alert
if 5 restarts within 5 cycles then timeout
(check Service SSH if it down monit auto start only run in localhost)
Step 3:access monit via web mail port 2812
