Centos 6.x install and configure sengbench

Source: Internet
Author: User
Tags geoip geoip database maxmind

I. Software Module dependency:

[[Email protected] # Yum-y install GCC + gcc-C ++ GCC * Make * libpcre. so * OpenSSL * PCRE * zlib * libtool * libxml2 * libxslt * GD * Lua *


Ii. Install geoip

Install the maxmind geoip Library

Maxmind provides a free IP region database (geoip. dat), but this database file is binary and needs to be read using the geoip library, so in addition to downloading geoip. in addition to the DAT file (see the next step), you also need to install a library that can read this file.

: Http://dev.maxmind.com/geoip/legacy/geolite/

(1) Compile and install geoip

[[Email protected] # wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz

[[Email protected] # tar-zxvf geoip.tar.gz

[[Email protected] # GeoIP-1.4.8/CD/

[[Email protected] #./configure

[[Email protected] # Make

[[Email protected] # make install


The installed library is automatically installed under/usr/local/lib. Therefore, this directory needs to be added to the dynamic link configuration so that it can be automatically bound to this geoip library when running the relevant program:

[[Email protected] # echo '/usr/local/lib'>/etc/lD. So. conf

[[Email protected] # ldconfig


(2) download and install geoip. dat (geoip national database)

Maxmind provides a free IP region database, which is binary and cannot be opened in a text editor. You need to read the above geoip database:

[[Email protected] # wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz

[[Email protected] # gzip-D geoip.dat.gz


(3) download and install geolitecity. dat (geoip city region database)

[[Email protected] # http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

[[Email protected] # gzip-D geolitecity.dat.gz



3. Compile and install seng.pdf

(1) download the nginx version:

[[Email protected] ~] # Wget http://senginx.org/download/senginx-1.6.0.tar.gz


(2) Compile and install sengplugin:

Because the http_geoip_module module is used, the system's built-in nginx generally does not include this module, so you need to download the nginx source code and compile it yourself:

[[Email protected] # tar zxvf senginx-1.6.0.tar.gz

[[Email protected] # cd senginx-1.6.0

[[Email protected] # Vim se-configure.sh.

With-http_realip_module \

With-http_addition_module \

With-http_sub_module \

With-http_dav_module \

With-http_flv_module \

With-http_geoip_module \

-- With-mail \

With-mail_ssl_module \

With-ipv6 \

With-http_ssl_module \

-- With-Debug \

[[Email protected] #./se-configure.sh -- prefix =/usr/local/nginx

[[Email protected] # Make

[[Email protected] # make install

[[Email protected] # cd/usr/local/

[[Email protected] # nginx/sbin/nginx-V



(3) Configure nginx

Configure nginx with the following Configuration:

[[Email protected] # Vim/usr/local/nginx/CONF/nginx. conf


Session_max_size 10240;

GEO $ ip_wl {

Ranges;

Default 0;

127.0.0.1-127.0.0.1 1;

10.0.101.1-10.0.101.254 1;

}

Whitelist_ua $ ua_wl {

"Autotest" ". * \. Test \. com ";

}


(4) modify the VM configuration file

[[Email protected] # Vim/usr/local/nginx/CONF/vhosts/server. conf


######### Robot mitigation ##########

Robot_mitigation on;

Robot_mitigation_cookie_name enorth_cookie;

Robot_mitigation_mode JS;

Robot_mitigation_blacklist 3;

Robot_mitigation_timeout 60;

Robot_mitigation_challenge_ajax on;

Robot_mitigation_global_whitelist ua_var_name = ua_wl ip_var_name = ip_wl ip_var_value = 1;


########## Cookie ##########

# Cookie_poisoning_action block/pass/remove/blacklist, num;

Cookie_pythoning on;

Cookie_poisoning_action blacklist, 5;

Cookie_poisoning_log on;

Cookie_poisoning_whitelist ua_var_name = ua_wl ip_var_name = ip_wl ip_var_value = 1;


######### Naxsi_whitelist ##########

Naxsi_whitelist ua_var_name = ua_wl ip_var_name = ip_wl ip_var_value = 1;

Learningmode;

Secrulesenabled;

# Secrulesdisabled;

Deniedurl "/requestdenied ";

Include WL. conf;

# Check rules

Checkrule "$ XSS> = 4" block;

Checkrule "$ traversal> = 4" block;

Checkrule "$ evade> = 8" block;

Checkrule "$ upload> = 8" block;

Checkrule "$ RFI> = 8" block;

Checkrule "$ SQL> = 8" block;

}


Location/requestdenied {

Return 403;

}


# Location /{

# If ($ geoip_country_code = cn ){

# Rewrite ^/$/CN redirect;

#}

#

# If ($ geoip_country_code! = Cn ){

# Rewrite ^/$/EN redirect;

#}

#}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.