Skip to main content

Posts

Snort as NIDS. Installation and configuration Step by Step.

Install Required Dependencies ############################# apt-get update -y apt-get upgrade -y apt-get install openssh-server ethtool build-essential libpcap-dev libpcre3-dev libdumbnet-dev bison flex zlib1g-dev liblzma-dev openssl libssl-dev wget https://www.snort.org/downloads/snort/daq-2.0.6.tar.gz tar -zxvf daq-2.0.6.tar.gz cd cd daq-2.0.6 ./configure && make && make install Install Snort from Source: ########################## wget https://www.snort.org/downloads/snort/snort-2.9.11.1.tar.gz tar -xvzf snort-2.9.11.1.tar.gz cd snort-2.9.11.1 ./configure --enable-sourcefire && make && make install ldconfig ln -s /usr/local/bin/snort /usr/sbin/snort snort -V Configure Snort ############### mkdir /etc/snort mkdir /etc/snort/preproc_rules mkdir /etc/snort/rules mkdir /var/log/snort mkdir /usr/local/lib/snort_dynamicrules touch /etc/snort/rules/white_list.rules touch /etc/snort/rules/black_list.rules touch ...

Working of GPG key encryption.

If someone wants you to send a confidential file. ######################################## 1)   Generate  gpg keys from your local machine and provide them your public key. 2)   Then they will encrypt that file with your public key provided by you via mail or chat. 3)   Now after encryption they will send that encrypted file to you. 4)   Now you can decrypt the file with the private key resides in your local machine. Useful commands. ############### Generate gpg key # gpg --gen-key Export a public key  #  gpg --armor --export ramesh > ramesh-pub-asc.gpg Import a public key #  gpg --import FileName If you want to send a file ##################### 1)   Ask his/her the public key. 2)   Import the public key. 3)   encrypt the file 4)   Send them the file. That is all , Thanks,

Install Free SSL for a domian using certbot (Ubuntu 16.04 / Apache / Nginx )

FOR APACHE $ sudo apt-get update $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:certbot/certbot $ sudo apt-get update $ sudo apt-get install python-certbot-apache First given a command like this : sudo certbot --apache -d cloud.xyz.com If this gave an error like below: Performing the following challenges: Client with the currently selected authenticator does not support any combination of challenges that will satisfy the CA. Then give the below command and it works. # certbot --authenticator standalone --installer apache --pre-hook "apachectl -k stop" --post-hook "apachectl -k start" Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator standalone, Installer apache No names were found in your configuration files. Please enter in your domain name(s) (comma and/or space separated)  (Enter 'c' to cancel): cloud.xyz.com Running pre-hook command: apachectl -k stop Obtaining ...

Logical Volume Manager

LVM Commands ########### >> First we need to create Physical Volume. PV is chunks of 4MBs >> Then create Volume Group using this PV. >> THen create Logical Volume. Creating PV: [root@localhost ~]# pvcreate /dev/vdb5 /dev/vdc1 /dev/vdb6 /dev/vdc2   Physical volume "/dev/vdb5" successfully created.   Physical volume "/dev/vdc1" successfully created.   Physical volume "/dev/vdb6" successfully created.   Physical volume "/dev/vdc2" successfully created. pvdisplay   --- NEW Physical volume ---   PV Name               /dev/vdc1   VG Name                 PV Size               2.00 GiB   Allocatable           NO   PE Size        ...

SES error "Request Expired ,it must be within 300secs/of server time."

This error occurs if difference in time on your server and Amazon SES 1. First Check your linux server time by > date 2. Check Amazon SES time by > wget https://email.us-east-1.amazonaws.com --no-check-certificate --server-response if this time difference is more than 300 seconds, then you get this error on sending email from Amazon SES, to solve this use ntpdate on your linux server 3. sudo ntpdate 0. amazon.pool.ntp.org 1. amazon.pool.ntp.org 2. amazon.pool.ntp.org 3. amazon.pool.ntp.org Again check the time difference by using above 2 commands. If time difference is < 300 seconds . Some time you will get an error when using the command ntpdate like below: the NTP socket is in use, exiting At this time you can use the -u option in ntpdate command inorder to run the ntpdate command on different port. sudo ntpdate -u 0. amazon.pool.ntp.org 1. amazon.pool.ntp.org 2. amazon.pool.ntp.org 3. amazon.pool.ntp.org Thats it. :-)

Deploying PHP along with Nginx using php-fpm & FastCGI

Some times you have a requirement to run php in an APP server having Nginx and uWSGI configured. If uwsgi is already running with a plugin , then it will be difficult to enable php along with uwsgi. You have to install the uwsgi-plugin-php and after that install another uwsgi from compiling uwsgi source with php plugin. But if we install php-fpm then it will be more easy to do this task. First install the necessary packages for this: >> sudo apt-get install php7.0-dev libphp7.0-embed php-fpm php-curl if you are planning to use mysql and db then also install  php7 . 0 - mysql After that you have to Configure the PHP Processor: Open the php-fpm configuration file: >> vi /etc/php/7.0/fpm/php.ini Change the value of cgi.fix_pathinfo from 1 to 0 This is an extremely insecure setting because it tells PHP to attempt to execute the closest file it can find if the requested PHP file cannot be found. This basically would allow users to cra...

ELK Stack (ElasticSearch / Logstash / Kibana ) Configuration

ELK Stack Installation Step By Step Guide ########################### Make sure Java is installed ################# Consider 1.2.3.4 as our ELK Stack server. > cd /opt/ > wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz" > tar -xzf jdk-8u141-linux-x64.tar.gz > cd jdk1.8.0_141/ > alternatives --install /usr/bin/java java /opt/jdk1.8.0_141/bin/java 2 > alternatives --config java > alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_141/bin/jar 2 > alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_141/bin/javac 2 > alternatives --set jar /opt/jdk1.8.0_141/bin/jar > alternatives --set javac /opt/jdk1.8.0_141/bin/javac Install Elasticsearch 5.5.1 (Port 9200) ######################## Before installing E...