Skip to main content

Posts

Showing posts from 2017

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               0     Total PE              0   Free PE               0   Allocated PE          0   PV UUID               gDI14y-m6Af-DAek-0xdv-bZEs-4wVd-GJcH68      "/dev/vdb5" is a new physical volume of "1.00 GiB"   --- NEW Physical volume ---   PV Name               /dev/vdb5   VG Name           

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 craft P

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

Restrict all except some ips using TCP wrappers

Files using for this : /etc/hosts.allow /etc/hosts.deny /etc/sshd.hosts 1) First add the ips that need to be whitelisted in the /etc/hosts.allow. for that you need to add the ips to the file /etc/sshd.hosts file. 2) Add the below entry to the file /etc/hosts.allow. sshd: /etc/sshd.hosts 3) Finally add the below entry to the file /etc/hosts.deny sshd: ALL This will deny ssh from all the locations except the ips given in the sshd.hosts file. So if you want to whitelist anymore ips just add that to the file sshd.hosts.

Install Self Signed Certificate for a domain for 10 years

Things that you need to install the certificate: Key CSR (Certificate Signing Request) Certificate Here we can create these files  with the openssl command. This can be done from any where. It is not necessary that we need to do this commands in the server itself where the domains hosted. I usually do this in my locale machine. My example domain is myxyz.com Creating the Key ############ # openssl genrsa -out myxyz-key.pem 2048 Note: Here if we want to create a more secure key then replace 2048 with 4096 Here we can give any name for the key file, but the only thing is that the extension should be .pem Creating the CSR ############ # openssl req -new -sha256 -key myxyz-key .pem -out myxyz.csr Note: Here we need to give the key filename after the -key option. This command will create a CSR file named myxyz . csr This command will ask for few options and you can see what I have given for a test case.  ==================================== jino@loc