Tags

, , ,

1. Install required modules:

$ sudo apt-get install libgeoip-dev
$ sudo apt-get install libgd2-noxpm
$ sudo apt-get install libgd2-noxpm-dev
$ sudo apt-get install libgd2-xpm-dev
$ sudo apt-get install libperl-dev
$ sudo apt-get install libpcre3 libpcre3-dev
$ sudo apt-get install libxml2-dev libxslt-dev

2. Download and Install Nginx:

# wget http://nginx.org/download/nginx-1.4.4.tar.gz
# tar -zxvf nginx-1.4.4.tar.gz
# cd nginx-1.4.4

Download testcookie-nginx-module from http://kyprizel.github.io/testcookie-nginx-module/

# tar -zxvf kyprizel-testcookie-nginx-module-8da7c62.tar.gz
# mv kyprizel-testcookie-nginx-module-8da7c62 kyprizel-testcookie-nginx-module
# mkdir /var/lib/nginx/
# ./configure—prefix=/etc/nginx —conf-path=/etc/nginx/nginx.conf —error-log-path=/var/log/nginx/error.log —http-client-body-temp-path=/var/lib/nginx/body —http-fastcgi-temp-path=/var/lib/nginx/fastcgi —http-log-path=/var/log/nginx/access.log —http-proxy-temp-path=/var/lib/nginx/proxy —http-scgi-temp-path=/var/lib/nginx/scgi —http-uwsgi-temp-path=/var/lib/nginx/uwsgi —lock-path=/var/lock/nginx.lock —pid-path=/var/run/nginx.pid —with-debug —with-http_addition_module —with-http_dav_module —with-http_flv_module —with-http_geoip_module —with-http_gzip_static_module —with-http_image_filter_module —with-http_mp4_module —with-http_perl_module —with-http_random_index_module —with-http_realip_module —with-http_secure_link_module —with-http_stub_status_module —with-http_ssl_module —with-http_sub_module —with-http_xslt_module —with-ipv6 —with-sha1=/usr/include/openssl —with-md5=/usr/include/openssl —with-mail —with-mail_ssl_module —add-module=kyprizel-testcookie-nginx-module

Nginx installed in /etc/nginx folder.

# mkdir /etc/nginx/sites-enabled/
# mkdir /etc/nginx/conf.d
# cd /etc/nginx

Download the following configuration file from pastebin:

1. nginx.conf : http://pastebin.com/23s0XNZE
2. conf.d/proxy.conf : http://pastebin.com/vzTFMJi2
3. site-available/www.bdneg.com : http://pastebin.com/jeEyhJ1P

To prevent automatic parsing, challenge cookie value can be encrypted with AES-128 in CBC mode using custom/random key and iv, and then decrypted at client side with JavaScript using SlowAES.

# svn checkout http://slowaes.googlecode.com/svn/trunk/ slowaes-read-only
# cp slowaes-read-only/js/aes.js /var/www/aes.min.js