Tuesday, November 22, 2016

Secure Apache from Clickjacking

open Terminal
use below command

curl -I http://localhost/ or http://serverIP/

check, is it showing any lines with X-Frame options or not if not follow the steps below

Open httpd.conf and append one line at the bottom of the file.

Header always append X-Frame-Options SAMEORIGIN
             
or you can append the below line

Header always append X-Frame-Options DENY

now save and close the file

To verify the syntax error run the below command

httpd -t it will show SYNTAX OK

now restart the service of apache/httpd

Wednesday, November 2, 2016

Install CSF (firewall) on any Linux




below are the steps to install the firewall named ConfigServer Security & Firewall which can be installed on any flavor of Linux. I have installed it on CentOS 7.

cd /usr/local/src

rm -fv csf.tgz

Download the package using
wget https://download.configserver.com/csf.tgz

extract it
tar -xzf csf.tgz

change directory
cd csf

install it
sh install.sh

To test if CSF will work in the server can be found by running,
perl /usr/local/csf/bin/csftest.pl

befor executing above command please check once is your system having perl installed or not
using command : perl -v

if not installed install it using below command
yum install perl

Now, open
vi /etc/csf/csf.conf

Edit the Testing Flag
TESTING = "0"

now run below command to start csf
csf -r
/etc/init.d/csf restart   or
systemctl restart csf


some basic command which can be useful

to block IP with CSF
csf -d (Ip Address)

to allow IP with CSF
csf -a (Ip Address)

unblock an IP with CSF
csf -dr (Ip Address)

unblock temporarily blocked IP
csf -tr (Ip Address)

csf -s – Start firewall rules

csf -f – Flush/stop firewall rules

csf -r – Restart firewall rules

csf -x – Disable CSF

csf -e – Enable CSF

csf -c – Check for updates

csf -h – Show help screen