Convert .p12 bundle to server certificate and key files

Seperate Private Key and Certificate file

#Generate certificates bundle file

openssl pkcs12 -nokeys -in server-cert-key-bundle.p12 -out server-ca-cert-bundle.pem

#Generate server key file.

openssl pkcs12 -nocerts -nodes -in server-cert-key-bundle.p12 -out server.key

Convert a PKCS#12 file (.pfx .p12) containing a private key and certificates to PEM

openssl pkcs12 -in keyStore.pfx -out keyStore.pem -nodes

Create a .pfx/.p12 certificate file using OpenSSL

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt

Src: https://www.sslshopper.com/article-most-common-openssl-commands.html

Share

Install and integrate DKIM with OpenDKIM and Postfix on a CentOS 6

UPDATE THE SYSTEM

Before going any further, make sure you’re in a screen session and your system is fully up-to-date by running:

## screen -U -S opendkim-screen
## yum update

ENABLE EPEL REPOSITORY

OpenDKIM is available in the EPEL repository, so we need to enable it on the system before we can install OpenDKIM

## wget -P /tmp http://mirror.pnl.gov/epel/6/i386/epel-release-6-8.noarch.rpm
## rpm -Uvh /tmp/epel-release-6-8.noarch.rpm
## rm -f /tmp/epel-release-6-8.noarch.rpm

INSTALL OPENDKIM

Install the package using yum:

## yum install opendkim

CONFIGURE OPENDKIM

Next thing to do is to configure OpenDKIM. Its main configuration file is located in /etc/opendkim.conf, so before making any changes create a backup and add/edit the following: Continue reading “Install and integrate DKIM with OpenDKIM and Postfix on a CentOS 6” »

Share

Nginx Reverse Proxying Multiple Domains Using map Module

map_hash_bucket_size 128;
map $http_host $backend_servers {
hostnames;
    default                         www.example.com;
    frontend.example2.com           backend.example2.com
    frontend.example3.com           backend.example3.com
    www.example.org                 backend.example.org
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
server {
    location / {
        proxy_pass  http://$backend_servers
    }
}
Share

Install PHP 7.3, 7.2, 7.1 on CentOS/RHEL 6.10

Configure Yum Repository

First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems

Use this command to install epel-release yum repository

yum install epel-release

and now execute one of the following commands as per your operating system version to install Remi repository.

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Install PHP 7 on CentOS 6

Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.

## Install PHP 7.3 
yum --enablerepo=remi-php73 install php
## Install PHP 7.2 
yum --enablerepo=remi-php72 install php
## Install PHP 7.1 
yum --enablerepo=remi-php71 install php

I have installed the latest version PHP 7.3 on my system. Now running the following command to check current active PHP version on my system. Continue reading “Install PHP 7.3, 7.2, 7.1 on CentOS/RHEL 6.10” »

Share

Apache Virtual Hosts on CentOS

Step One— Create a New Directory

The first step in creating a virtual host is to a create a directory where we will keep the new website’s information.

This location will be your Document Root in the Apache virtual configuration file later on. By adding a -p to the line of code, the command automatically generates all the parents for the new directory.

sudo mkdir -p /var/www/example.com/public_html

You will need to designate an actual DNS approved domain, or an IP address, to test that a virtual host is working. In this tutorial we will use example.com as a placeholder for a correct domain name.

However, should you want to use an unapproved domain name to test the process you will find information on how to make it work on your local computer in Step Six.

Step Two—Grant Permissions

We need to grant ownership of the directory to the user, instead of just keeping it on the root system.

sudo chown -R apache:apache /var/www/example.com/public_html

Additionally, it is important to make sure that everyone will be able to read our new files.

sudo chmod 755 /var/www

Now you are all done with permissions. Continue reading “Apache Virtual Hosts on CentOS” »

Share

Find Out NFS Clients Connected To My NFS Server

You can use the following commands. SSH or login into your nfs server and type the following command:

netstat -an | grep nfs.server.ip:port

If your nfs server IP address 192.168.1.12 and port is 2049, enter:

netstat -an | grep 192.168.1.12:2049

Sample outputs:

tcp 0 0 192.168.1.12:2049 192.168.1.5:757 ESTABLISHED
tcp 0 0 192.168.1.12:2049 192.168.1.6:892 ESTABLISHED

Where,

192.168.1.12 – NFS serer IP address
2049 – NFS server port
192.168.1.5 and 192.168.1.6 – NFS clients IP address Continue reading “Find Out NFS Clients Connected To My NFS Server” »

Share

Install Plex on Ubuntu 18.04

Plex is a streaming media server that lets you organize your video, music, and photo collections and stream them to all of your devices at any time and from anywhere.

Although this tutorial is written for Ubuntu 18.04 Bionic Beaver the same steps can be used for Debian and Ubuntu 16.04 Xenial Xerus.

Prerequisites

You’ll need to be logged in as a user with sudo access to be able to install packages on your Ubuntu system.

Install Plex Media Server

The easiest way to install and manage Plex Media Server on Ubuntu 18.04 is by using the Plex official repository. It requires no technical knowledge and it should not take you more than 20 minutes to install and configure the media server.

Follow the steps below to install the Plex Media Server on your Ubuntu system:

Start by importing the repository’s GPG key using the following curl command:

curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

Add the Plex APT repository to your system’s software repository list by issuing:

echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

Once the Plex repository is enabled, update the apt package list and install the latest version of the Plex Media Server with: Continue reading “Install Plex on Ubuntu 18.04” »

Share

Basic Email Server with Postfix, Dovecot and Squirrelmail on CentOS 6

Step 1 »Before installation assign a static ip and add a host entry for your domain to that IP in the /etc/hosts file like below.

192.168.0.15 tweenpath.net

Step 2 » Issue the below command to install postfix

[root@mail ~]# yum -y install postfix

Step 3 » Now issue the below command to install SMTP AUTH packages .

[root@mail ~]# yum -y install cyrus-sasl cyrus-sasl-devel cyrus-sasl-gssapi cyrus-sasl-md5 cyrus-sasl-plain

Postfix package installation is completed .

Step 4 » Issue the below commands one by one for creating SSL Cert.

[root@mail ~]# mkdir /etc/postfix/ssl
[root@mail ~]# cd /etc/postfix/ssl/
[root@mail ssl]# openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
[root@mail ssl]# chmod 600 smtpd.key
[root@mail ssl]# openssl req -new -key smtpd.key -out smtpd.csr
[root@mail ssl]# openssl x509 -req -days 365 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
[root@mail ssl]# openssl rsa -in smtpd.key -out smtpd.key.unencrypted
[root@mail ssl]# mv -f smtpd.key.unencrypted smtpd.key
[root@mail ssl]# openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 365

Step 4 » Now open /etc/postfix/main.cf file Continue reading “Basic Email Server with Postfix, Dovecot and Squirrelmail on CentOS 6” »

Share

How to Change Hostname on Ubuntu 18.04

Display the Current Hostname

To view the current hostname, enter the following command:

hostnamectl

As you can see in the image above, the current hostname is set to ubuntu1804.localdomain.

Change the Hostname

The following steps outline how to change the hostname in Ubuntu 18.04.

1. Change the hostname using hostnamectl

In Ubuntu 18.04 we can change the system hostname and related settings using the command hostnamectl.

For example, to change the system static hostname to linuxize, you would use the following command: Continue reading “How to Change Hostname on Ubuntu 18.04” »

Share

Split large file and combine file in Linux

$ du -h Linux\ Security.mp4

Sample output:

1.1G Linux Security.mp4

As you see, the video file size is 1.1 GiB, which is very large to upload to my google drive. Even though, Google Drive lets users upload files up to 5TB in size, it is really time consuming process. With my low speed Internet connection, I presume it would take more than 30 minutes to upload. I don’t want to wait that much longer. So, what I am going to do is split this file into multiple smaller size files, for example 100 MB each, to make upload process faster.

Now, let us split the above file into multiple smaller files, say for example 100MB each. To do so, run:

$ split -b 100M Linux\ Security.mp4 ls.

Continue reading “Split large file and combine file in Linux” »

Share