Tuesday, May 27, 2014

Debian-Installer: Preseed with minimal Debian and LVM partitioning

Modify an existing CD image to preseed d-i
Create copy of image
#mount -o loop debian-7.5.0-amd64-CD-1.iso /mnt
#mkdir Debian7x64
#rsync -a -H --exclude=TRANS.TBL /mnt Debian7x64
#umount /mnt

Hack the initrd
# mkdir irmod
# cd irmod
# gzip -d < ../Debian7x64/install.amd/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames
# cp ../preseed.cfg preseed.cfg
# find . | cpio -H newc --create --verbose | gzip -9 > ../Debian7x64/install.amd/initrd.gz
# cd ../
# rm -fr irmod/

Friday, May 16, 2014

Install nginx naxsi mod_pagespeed and spdy on Debian/Ubuntu

This is guide to installing and configuring Nginx to serve static files. Which is to say, this is how to install and set up Nginx to serve static files whether those files are simply stylesheets, images and JavaScript or full static sites like this one. What follows is the best practices of Nginx

Nginx beats Apache for static content
Whether you’re just building a quick live prototype or running an actual live website of static files, you’ll need a good server. So why not use Apache? Simply put, Apache is overkill.

Unlike Apache, which is a jack-of-all-trades server, Nginx was really designed to do just a few things well, one of which is to offer a simple, fast, lightweight server for static files. And Nginx is really, really good at serving static files. In fact, in my experience Nginx with PageSpeed, gzip, far future expires headers and a couple other extras I’ll mention is faster than serving static files from Amazon S33 (potentially even faster in the future if Verizon and its ilk really do start throttling cloud-based services).

Tuesday, May 13, 2014

Install nginx with naxsi and doxi rules

Install nginx with naxsi and doxi rules
apt-get install nginx nginx-naxsi

Enable naxsi core rules

nano /etc/nginx/nginx.conf
Uncomment
#include /etc/nginx/naxsi_core.rules;

to
include /etc/nginx/naxsi_core.rules;

Enable naxsi basic rule and check rule
nano /etc/nginx/sites-enabled/default

Under location /
Uncomment
#include /etc/nginx/naxsi.rules;

to
include /etc/nginx/naxsi.rules;

You've enabled naxsi for nginx, now look at the file /etc/nginx/naxsi.rules
cat, this is sample configuration
# Sample rules file for default vhost.

#LearningMode;
SecRulesEnabled;
#SecRulesDisabled;
#DeniedUrl "/RequestDenied";
DeniedUrl "/denied.html";

## check rules
CheckRule "$SQL >= 8" BLOCK;
CheckRule "$RFI >= 8" BLOCK;
CheckRule "$TRAVERSAL >= 4" BLOCK;
CheckRule "$EVADE >= 4" BLOCK;
CheckRule "$XSS >= 8" BLOCK;


Thursday, May 8, 2014

Postfix dovecot sasl amavisd-new clamav spamassassin postgrey opendkim vitual domains on Debian 7 (Wheezy)

Introduction
In this setup is for a small to medium sized email server with Postfix virtual mailboxes which can be used for multiple domains and non-Linux accounts. If you are new to Postfix please read PostfixBasicSetupHowto to understand the basics before proceeding with this Howto. Also, information is presented about integration with ClamSMTP (an SMTP filter for Postfix) and other mail servers that check for viruses (using the ClamAV anti-virus software).

Example Setup
In this example emails are hosted for two separate domains, domain1.com and domain2.com. (Replace these with your own domain names.

Install Postfix
Install the postfix package.
For convenience in testing mail delivery, also install mailx package for use as command line mail utility program. (mailx is a dummy package for one of three mail programs, the most widely used of which is bsd-mailx.)
$ sudo apt-get install postfix bsd-mailx