August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Determine the Zeroed status of Thick Lazy disk

this article there is a potential write performance impact on the first-write to each block in the Lazy Zeroed Thick Disk. If you for some reason would like to know how large part of the Thick Lazy that has been zeroed of a production virtual machine and how much remains to be zeroed later you could use the vmkfstools command from the ESXi command line. This could be done while the VM is running, so no need to power off any machines.

zeroed-4

Navigate to the VM folder through the /vmfs/volumes path and then list the file name(s) of the “flat” (data) VMDK, not the small descriptor file. Use for example:

ls -l *flat.vmdk

Above we see a 10 GB flat vmdk file. This is a Lazy Zeroed disk, which has all its space (10 GB = 10737418240) allocated on the data store, however we do not really know what the zeroing status is.

This could be displayed by the command:
zeroed-5

vmkfstools -D vm-FLAT.vmdk (Note, must point to the flat file, not descriptor)

zeroed-6

From this output some interesting data could be observed.

len = Total size of disk in Bytes.

bs = Block size (would be 1 MB/1048576 Bytes on all new VMFS5 stores).

nb = Total number of blocks of the virtual disk.

This gives that: nb * bs = len
zeroed-7

And for the zeroing status: next to nb we find the “tbz” value.

tbz = The number of blocks remaining to be zeroed.

In this example the tbz is 7916 blocks. You could divide this value with nb (total number of blocks) to get the percentage.

Here 7916 blocks out of 10240 remains to be zeroed.

tbz / nb = percent of disk remaining to be zeroed

7916 / 10240 = 0,77 = 77 %

This could be useful to know in a performance troubleshooting situation where being able to verify the exact zeroing status of a Lazy Zeroed disk could give some more piece of information which might or might not be relevant to the situation.

VMware Thin and Thick Client Provisioning: A Brief Overview

Thick and thin client provisioning is not as different as you might first assume, both operate by running a client application on the desktop – which then sends and receives data over the network to the server. By going through the differences with you here, we will hopefully help you see how one might benefit your company’s environment over the other.

Thin Clients

A thin client is a network computer without a hard disk drive. Thin provisioning is based around the concept of saving disk space on your data stores. This allows you to over allocate disk space on your virtual machines because thin clients don’t reserve space on the file system (VMFS).

Thin Provisioning Pros

Virtual machine disk usage is minimal.
Cuts down on storage costs.
Allows an organization to maximize the use of space in a storage array.
Reduces the threat of data loss.

Thin Provisioning Cons

The possibility that you can run out of space on an over-allocated data store.
Requires closer storage oversight.
Eliminates the possibility of using some of vSphere’s advanced features – such as Fault Tolerance.
May carry a performance penalty. As new space is made available for thinly provisioned storage expansion, vSphere must reserve the space and zero it out. If you are in an environment where top performance reigns paramount, don’t use thin provisioning.

Thick Clients

A thick client performs most client/server applications. Thick provisioning is based on the concept of allocating the virtual machine disk, reserving all necessary space on the data store at the time of creation.

Thick Provisioning Pros

Prevents over provisioning your data stores, ensuring you don’t have any down time.
You’ll receive the best performance since all of the blocks will be pre-zeroed, cutting out the need during normal operations.

Thick Provisioning Cons

Thick provisioning will decrease your storage space much faster.
There’s the very real possibility of wasting disk space on empty blocks of data.

Thick Options

Lazy Zeroed Thick is a provisioning format in which the virtual machine reserves the space on the VMFS. The disk blocks are only used on the back-end data store when they get written to the virtual machine.

Eager Zeroed Thick is a provisioning format in which the virtual machine reserves all the space on the VMFS and zeros out the disk blocks at the time of creation. Creating a virtual machine with this type of provisioning may take a little longer, but it’s performance is optimal from deployment because there’s no overhead in zeroing out disk blocks on-demand. This means no additional work to the data store for the zeroing operation.

Thick thin

 

eager-vs-lazy-1

 

The VMware Thick Eager Zeroed Disk vs the Lazy Zeroed Thick disk in write performance.

What is the potential write performance difference between the VMware virtual disks: Thick Lazy Zeroed, Thick Eager Zeroed and Thin provisioned types? This has been discussed for many years and there are many opinions regarding this, both in terms of test vs real life write behavior as well as test methods. There is also important factors as storage effiency, migration times and similar to this, however I will in this article try to make the potential “first write” impact more easy to evaluate.

Before the virtual machine guest operating system can actually use a virtual disk some preparations has to be accomplished by the ESXi host. The main tasks that has to be done for each writable part of a virtual disk is that the space has to be allocated on the datastore and the specific disk sectors on the storage array has to be safely cleared (“zeroed”) from any previous content.

In short, this is done in the following way:

Thin: Allocate and zero on first write
Thick Lazy: Allocate in advance and zero on first write
Thick Eager: Allocate and zero in advance

There are some published performance tests between these three disk types often using the standard tool IOmeter. There is however a potential flaw to these tests, caused by the fact that before IOmeter starts the actual test it will create a file (iobw.tst) and write data to each part of that file – which at the same time causes ESXi to zero out these blocks on the storage array. This means that it is impossible to use IOmeter output data to spot any write performance differences between the three VMware virtual disk types, since the potential difference in write performance will already be nullified when the IOmeter test actually begins.

When the difference will only be in the very first write from the Virtual Machine across the virtual disk sectors a way to simulate this is to force a massive amount of writes over the whole disk area and note the time differences. This is of course not how most applications work in the sense that it is uncommon to do all writes in one continuous stream and instead the “first-writes” with ESXi zeroing is likely to be spread over a longer period of time, but sooner of later each sector that is used by the guest operating system has to be zeroed.

 

eager-vs-lazy-2

A way to simulate large amounts of writes could be done from using the standard Windows format tool which, despite some popular belief, actually erases the whole disk area if selecting a “full” / non-quick format. In real life there is not much specific interest how fast a partition format is done in itself, however in this test the format tool is used just to create a massive amount of “first-writes”.

 

eager-vs-lazy-3

This test case uses a VM with Windows 2012 R2 which was given three new virtual hard disks of 40 GB each, where there was one Eager, one Lazy and one Thin. Each disk was then formatted with NTFS, default allocation unit, no compression, but with the non-quick option.

 

eager-vs-lazy-4

 

 

 

One first observation was in ESXTOP while looking at the ratio between the writes that the virtual machine actually commits compared to how many writes are being sent from ESXi to the LUN.

Above we can see ESXTOP while doing a full format of an Eager Zeroed Thick disk. The important point here is that the numbers are very close. The writes being done at the LUN are only the writes the VM wants to make, i.e. there is no ESXi introduced extra writes since the “zeroing” was done already in advance.

 

eager-vs-lazy-5

 

Above a Lazy Zeroed Thick Disk is being full formated from inside the VM.

What could be noticed is the amount of write IOs being sent from ESXi to the LUN is much higher than the number of write IOs coming from the virtual machines. This is the actual zeroing taking place “in real time” and will make the VM write performance lower than the Eager version while accessing new areas of the virtual disk for the first time.

 

The actual time results for doing a full format of a 40 GB virtual disk was:

Eager Zeroed Thick Disk: 537 seconds
Lazy Zeroed Thick Disk: 667 seconds
Thin Disk: 784 seconds

The Eager Zeroed Thick Disk was almost 25 % faster in first-write performance compared to the Lazy Zeroed.

The Eager Zeroed Thick Disk was almost 45 % faster in first-write performance compared to the Thin Disk.

This is obvious in doing a full format which forces the VM to write at all sectors. In a real environment the “first-writes” will naturally be spread over a longer period of time, but sooner or later the Zeroing hit will take place for each part of the disk and might or might not be noticeable to the user. For a typical virtual machine that does the majority of “first-writes” at OS installation this is likely to be of lesser interest, but for VMs with databases, logfiles or other write intensive applications it is possible to result in a higher impact.

 

What Files Make Up a Virtual Machine?

What Files Make Up a Virtual Machine?

You may never need to know the file names or locations for your virtual machine files. Virtual machine file management is performed by VMware Workstation. If the behind the scenes file structure is not interesting to you, skip this section.

A virtual machine typically is stored on the host computer in a set of files, usually in a directory created by Workstation for that specific virtual machine.

The key files are listed here by extension. In these examples, is the name of your virtual machine

Extension

File Name

Description

.log

.log

or

vmware.log

This is the file that keeps a log of key VMware Workstation activity. This file can be useful in troubleshooting if you encounter problems. This file is stored in the directory that holds the configuration (.vmx) file of the virtual machine.

.nvram

.nvram

or

nvram

This is the file that stores the state of the virtual machine’s BIOS.

.vmdk

.vmdk

This is a virtual disk file, which stores the contents of the virtual machine’s hard disk drive.

A virtual disk is made up of one or more .vmdk files. If you have specified that the virtual disk should be split into 2GB chunks, the number of .vmdk files depends on the size of the virtual disk. As data is added to a virtual disk, the .vmdk files grow in size, to a maximum of 2GB each. (If you specify that all space should be allocated when you create the disk, these files start at the maximum size and do not grow.) Almost all of a .vmdk file’s content is the virtual machine’s data, with a small portion allotted to virtual machine overhead.

If the virtual machine is connected directly to a physical disk, rather than to a virtual disk, the .vmdk file stores information about the partitions the virtual machine is allowed to access.

Earlier VMware products used the extension .dsk for virtual disk files.

–<###>.vmdk

This is a redo-log file, created automatically when a virtual machine has one or more snapshots. This file stores changes made to a virtual disk while the virtual machine is running. There may be more than one such file. The ### indicates a unique suffix added automatically by VMware Workstation to avoid duplicate file names.

.vmem

.vmem

The virtual machine’s paging file, which backs up the guest main memory on the host file system. This file exists only when the virtual machine is running, or if the virtual machine has crashed.

Each snapshot of a virtual machine that is powered on has an associated .vmem file, which contains the guest’s main memory, saved as part of the snapshot.

.vmsd

.vmsd

This is a centralized file for storing information and metadata about snapshots.

.vmsn

-Snapshot.vmsn

This is the snapshot state file, which stores the running state of a virtual machine at the time you take that snapshot

-Snapshot<###>.vmsn

This is the file which stores the state of a snapshot

.vmss

.vmss

This is the suspended state file, which stores the state of a suspended virtual machine

.Some earlier VMware products used the extension .std for suspended state files

.vmtm

.vmtm

This is the configuration file containing team data.

.vmx

.vmx

This is the primary configuration file, which stores settings chosen in the New Virtual Machine Wizard or virtual machine settings editor. If you created the virtual machine under an earlier version of VMware Workstation on a Linux host, this file may have a .cfg extension

.vmxf

.vmxf

This is a supplemental configuration file for virtual machines that are in a team. Note that the .vmxf file remains if a virtual machine is removed from the team.

There can be other files in the directory, some of which are present only while a virtual machine is running.

What’s new in vSphere 6.0

Straight from PEX 2015 in San Francisco, here’s a recap of the February 2 announcement for what’s new in vSphere 6.0

Platform Enhancements:

128 vCPUs per VM
4TB of RAM per VM
64 hosts per cluster
12TB of system RAM
480 vCPUs per host
Hot-add RAM is now vNUMA aware
WDDM 1.1 GDI acceleration features
xHCI controller for USB 3 and OSX
Serial and parallel port enhancements (they can now be removed)
Account lockout (after 10 attempts, for 2 minutes) applies to SSH and Web SDK. DCUI is still available.
Can change default password complexity via API call or advanced setting
Improved auditing: All actions now list the actual username doing the action vs. just vpxuser
Support for SQL 2012 AlwaysOn Availability groups within MSCS
IPV6 Support with MSCS
vMotion support for MSCS nodes (with pRDMs)
MSCS supports PVSCSI controllers
New Support for Intel GPUs – vmklinux driver
Expanded NVidia Support

vCenter 6.0 Features

Parity with Windows and Appliance scalability
New Platform Services Controller – Embedded or Centralized model
Linked Mode – Feature Parity with Windows and Appliance. Supports policies and tags
New Certificate Lifecycle Management for vCenter and ESXi
VMCA -VMware Certificate Authority – Provisions certificates
VECS – Stores certificates
Certificate options – VMCA default, VMCA Enterprise, Custom
Cross vSwitch vMotion – vSS to vSS, vSS to vDS, vDS to vDS. Requires L2 network connectivity. Still transparent to Guest.
Cross vCenter vMotion – Simultaneously change Compute, storage, network and vCenter. Targeted for local, metro, intra-continental. Tested u pto 150ms latency.
Long Distance vMotion – Tested up to 150ms. Supports vVols but not required. Needs 250 Mbps per vMotion. VM UUID not changed. MAC address is also preserved. Shares, limits, and reservations are also maintained.
Content library – Simple content management for VM templates, vApps, ISO images and scripts
vSphere C# client still here – Added support for HW v10 and v11 read-only
vSphere web client – Improved login time (13x), right click 4x faster, charts appear faster
Get anywhere in the web client in one click
Brought back recent tasks in the web client
NIOC – Reserve bandwidth to guarantee service levels. Applied at vNIC level.
Multiple TCP/IP stacks – vMotion network will cross L3 boundaries
vMotion can now use its own TCP/IP stack

Storage

vSphere Virtual Volumes – Virtualizes SAN and NAS devices. No more LUNs on block devices.
VVols enables finer control with VM level storage operations using array-based operations
VVols Supports block and NFS protocols
VVols is included with vSphere at all licensing levels
NFS 4.1 with Kerberos

vSphere 6.0 Fault Tolerance

Multi-vCPU support – 4 vCPUs
No longer require EZT disks – Can use any disk format
No support for vVOls
Up to 8 vCPUs protected per host (mix and match VMs)
Greatly increased FT host compatibility
Requires a 10Gb network – Segmented is strongly recommended
Heavily modified version of xvMotion
Each VM has its own vmx config file, vmdsk files. Can store second VM on another array
Supports backup snapshosts (only), no user snapshots

vSphere Replication

End-to-end network compression
Network traffic isolation
Linux file system quiescing
Faster full sync
Same 15 minute RPO

vSphere 6.0 Data Protection

No more advanced edition – All features available in base version
Included with vSphere essentials and higher
Supports up to 800 VMs per vCenter
For ROBOs up to 20 VDP appliances per vCenter
Replicate backup data between VDP appliances and EMC Avamar
EMC Data domain support with DD boost
Automated backup verification

tomcat 8 centos 6.7

## screen -U -S tomcat8-screen
## yum update

INSTALL JAVA 8

Download the latest JAVA 8 from here or use the following command to download JAVA JDK 8u5:

for 32bit systems use:

## wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.rpm" \
-O /opt/jdk-8-linux-i586.rpm

for 64bit systems use:

## wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-x64.rpm" \
-O /opt/jdk-8-linux-x64.rpm

once the JAVA package has been downloaded, install it using rpm as follows:

for 32bit systems use:

## rpm -Uvh /opt/jdk-8-linux-i586.rpm

for 64bit systems use:

## rpm -Uvh /opt/jdk-8-linux-x64.rpm

CONFIGURE JAVA

configure the newly installed JAVA package using alternatives as in:

## alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_05/jre/bin/java 20000
## alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar 20000
## alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 20000
## alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_05/jre/bin/javaws 20000
## alternatives --set java /usr/java/jdk1.8.0_05/jre/bin/java
## alternatives --set javaws /usr/java/jdk1.8.0_05/jre/bin/javaws
## alternatives --set javac /usr/java/jdk1.8.0_05/bin/javac
## alternatives --set jar /usr/java/jdk1.8.0_05/bin/jar

check the JAVA version running on your system:

## java -version

INSTALL TOMCAT 8

Create a separate user which will run the Tomcat server:

## useradd -r tomcat8 --shell /bin/false

Download the latest Tomcat 8 version from here or use the following command to download Tomcat 8.0.5

## wget http://mirrors.koehn.com/apache/tomcat/tomcat-8/v8.0.5/bin/apache-tomcat-8.0.5.tar.gz -P /tmp

Extract the contents of the Tomcat archive to /opt using the following command:

## tar -zxf /tmp/apache-tomcat-8.0.5.tar.gz -C /opt
## ln -s /opt/apache-tomcat-8.0.5 /opt/tomcat-latest
## chown -hR tomcat8: /opt/tomcat-latest /opt/apache-tomcat-8.0.5

START THE TOMCAT 8 SERVICE

Create the following init script in /etc/init.d/tomcat8

#!/bin/bash
#
# tomcat8
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat8
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Tomcat 8
# Short-Description: start and stop tomcat
### END INIT INFO

## Source function library.
#. /etc/rc.d/init.d/functions
export JAVA_HOME=/usr/java/default
export JAVA_OPTS="-Dfile.encoding=UTF-8 \
  -Dnet.sf.ehcache.skipUpdateCheck=true \
  -XX:+UseConcMarkSweepGC \
  -XX:+CMSClassUnloadingEnabled \
  -XX:+UseParNewGC \
  -XX:MaxPermSize=128m \
  -Xms512m -Xmx512m"
export PATH=$JAVA_HOME/bin:$PATH
TOMCAT_HOME=/opt/tomcat-latest
TOMCAT_USER=tomcat8
SHUTDOWN_WAIT=20

tomcat_pid() {
  echo `ps aux | grep org.apache.catalina.startup.Bootstrap | grep -v grep | awk '{ print $2 }'`
}

start() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ] 
  then
    echo "Tomcat is already running (pid: $pid)"
  else
    # Start tomcat
    echo "Starting tomcat"
    ulimit -n 100000
    umask 007
    /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/startup.sh
  fi


  return 0
}

stop() {
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo "Stoping Tomcat"
    /bin/su -p -s /bin/sh $TOMCAT_USER $TOMCAT_HOME/bin/shutdown.sh

    let kwait=$SHUTDOWN_WAIT
    count=0;
    until [ `ps -p $pid | grep -c $pid` = '0' ] || [ $count -gt $kwait ]
    do
      echo -n -e "\nwaiting for processes to exit";
      sleep 1
      let count=$count+1;
    done

    if [ $count -gt $kwait ]; then
      echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds"
      kill -9 $pid
    fi
  else
    echo "Tomcat is not running"
  fi
 
  return 0
}

case $1 in
start)
  start
;; 
stop)   
  stop
;; 
restart)
  stop
  start
;;
status)
  pid=$(tomcat_pid)
  if [ -n "$pid" ]
  then
    echo "Tomcat is running with pid: $pid"
  else
    echo "Tomcat is not running"
  fi
;; 
esac    
exit 0

make the script executable using chmod

## chmod +x /etc/init.d/tomcat8

Start the Tomcat 8 server using:

## service tomcat8 start

Add the Tomcat 8 service to system startup:

## chkconfig tomcat8 on

Access your newly installed Tomcat at http://YOUR_IP:8080

How to install phpmyadmin on centos 7

How to install phpmyadmin on centos 7
Phpmyadmin is an opensource tool to manage MySQL database using web browser. it can perform almost all tasks such as creating,deleting,modifying databases,users,tables and fields .
This guide helps you to install phpmyadmin on centos 7. it contains step by step installation through YUM using EPEL repository.
Prerequisite – LAMP server
Before starting phpmyadmin installation, You must setup LAMP server on your centos 7 server. Copy and paste below command in terminal for quick setup . At the end, you need to provide some inputs .
» leave blank for current mysql password.
» provide new password and press enter for the rest.
yum -y install httpd mariadb-server mariadb php php-mysql php-gd php-pear php-mbstring && systemctl start httpd.service && systemctl enable httpd.service && systemctl start mariadb && systemctl enable mariadb && firewall-cmd –permanent –add-service http && systemctl restart firewalld.service && mysql_secure_installation

You can also refer this guide – Install LAMP server on centos 7 for more detailed setup.

Install phpmyadmin on centos 7
By default, centos 7 repository does not contains phpmyadmin package. we need to enable EPEL repository. Find the latest EPEL for centos 7 from EPEL for Centos 7
Step 1 » Download and install epel-release-7-x.noarch.rpm file . or install directly by copying the rpm link.
[root@rmohan ~]# rpm -ivh http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-1.noarch.rpm

Step 2 » Update repositories by issuing below command .
[root@rmohan ~]# yum check-update

Step 3 » Now install phpmyadmin package along with dependencies.
[root@rmohan ~]# yum -y install phpmyadmin

Step 4 » After installation, Open /etc/httpd/conf.d/phpMyAdmin.conf file ( Apache config file for phpmyadmin ) and edit as follows.
Find these lines . ( Found 2 times )
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>

# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
Replace with
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
Require all granted
</RequireAny>

# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
# Require ip ::1
Require all granted
</RequireAny>

tep 5 » Restart Apache service .
[root@rmohan ~]# systemctl restart httpd.service

Step 6 » Now open http://serverIP/phpmyadmin in your browser. You can login using root as username and mysql root password.

Install the Apache

? Web server Apache

Install the Apache, which boasts the largest share in the world. You must first install the apache in yum.

# Yum install httpd
# Rpm -qa | grep httpd
httpd-2.4.6-18.el7.centos.x86_64
httpd-tools-2.4.6-18.el7.centos.x86_64

Edit the configuration file (/etc/httpd/conf/httpd.conf). The following has been described only part that was edited.

ServerAdmin webmaster@rmohan.com
ServerName www.rmohan.com:80

# Enabling specify the CGI and htaccess document root
DocumentRoot “/ var / www / html”
<Directory “/ var / www / html”>
Options ExecCGI
AllowOverride FileInfo AuthConfig Limit
Order allow, deny
Require all granted
</ Directory>

# To add a file to be accessed at URL omitted
<IfModule dir_module>
DirectoryIndex index.html index.cgi index.php
</ IfModule>

# Does not fix the directory that you can run the cgi
<IfModule alias_module>
# ScriptAlias / cgi-Bin / “/ var / Www / cgi-Bin /”
</ IfModule>

# Enable the extension of cgi
<IfModule mime_module>
AddHandler cgi-script .cgi
</ IfModule>

Set the following order # is that Japanese is garbled
#AddDefaultCharset UTF-8
AddDefaultCharset none

Since the default but with the index.html file is not also provide’s the state in which the page to be able to access does not exist, but they will be actually when you access a page that says CentOS. Because it’s this OS will cause leaks to a third party, you have to save the /etc/httpd/conf.d/welcome.conf this is set to be displayed in the appropriate directory.

# Mv /etc/httpd/conf.d/welcome.conf / root

? settings for access control

and describes the directives for carrying out the access control to the directory that is specified in the <Directory>. Access control is the core function of the Apache. (1) add, change or delete control options

Options [+ | -] <option>

Is in the <Directory> Specifies the specific directives for the specified directory. Set in the <option> a parameter called the control options in this. The control options that can be specified for this parameter is shown below.

option meaning
None To all the control options invalid
All To all the control option is enabled
ExecCGI To permit the execution of CGI programs
FollowSymLinks When there is a symbolic sink, allowing you to follow it
Includes Allow SSI
IncludesNOEXEC But to allow SSI, # exec, # cmd, execution of the program by # include is prohibited
Indexes To allow creation of a directory index
MultiViews Allow Content negotiated MultiViews
SymLinksOwnerMatch If the symbolic link and the link destination is the same owner only, allowing you to follow it

You can also put in front of the specified each of the control options +/-. + The put when a new option in the directory will be added. – <Option> put and in the directory will be deleted. Either all control of options in it than the upper directory to be wearing will be replaced by those of this directory.

(2) permission of the override by the access control file

AllowOverride <override> …..

Up to where the configuration changes for each directory by the access control file to specify whether to allow. Specifiers that can be specified in <override> is shown below.

Specifier meaning
None To disable the override (even if the access control file to ignore)
All To enable all of the directives in the access control file.
AuthConfig To enable the directives related to authentication. (.htaccess File becomes effective)
FileInfo To enable the directive to specify the document type.
Indexes To enable the directive to specify the directory index. Non-encouragement to become a directory full view state.
Limit To enable the directives to carry out access control. The subject of the directive allow, deny, three of the order.
Options To enable the directives to control the functions.

(3) access permission or denial such as setting of have to allow access from any IP that has been used to apache2.2 description is changed to less than 2.4, it is set by default. .

Require all granted

It has indicated only one line in the above, but the original is written using the Require directive. The Require directive is present the following three types.

Directives Description
<RequireAny> Permission If either match among multiple conditions described. The default behavior of the case omitted.
<RequireAll> Multiple conditions described will fire when all matches. It is used to specify, such as permit or deny specific IP.
<RequireNone> Access denied when matching one among the plurality described conditions. Never use too much.

For example, if you want to allow access to the 192.168.0.0/24 and 192.168.1.0/24 performs the following description. The following RequireAny will be applied because it omitted the Require directive. Also it will be the fact that if you want to specify more than one may be written on a new line.

Require ip 192.168.0.0/24
Require ip 192.168.1.0/24

And described without omitting it will be as follows.

<RequireAny>
Require ip 192.168.0.0/24
Require ip 192.168.1.0/24
</ RequireAny>

If you reverse to want to deny access from the 192.168.0.0/24 and 192.168.1.0/24 using RequireAll directive will be in the following such a description.

<RequireAll>
Require all granted
Require not ip 192.168.0.0/24
Require not ip 192.168.1.0/24
</ RequireAll>
? user authentication (Basic)

This is the most standard method in the authentication method that has been used in old-fashioned in the Apache. However, this approach of passwords will flow in the clear (unencrypted) is difficulty. Configuration is done in httpd.conf. Let’s assume that this will be the directory to which you want to apply the limit / var / www / html / basic.

<Directory “/ var / Www / Html / Basic”>
AuthType Basic
AuthName “Require Auth”
AuthUserFile /Var/www/html/basic/.Htpasswd
Require Valid-User
</ Directory>

Append the above to the end of the httpd.conf, and then restart the apache. Or it is also to create the / var / www / html / basic .htaccess file under. And sets the actual user and password in the following command.

# Htpasswd -C /Var/www/html/basic/.Htpasswd User
New Password: [Enter Password]
Re-Type New Password: [password]
Adding Password For User User # More / var / Www / Html / Basic /. htpasswd User: SNQ1ca2F / HkRk

Register the “user” as the user ID, you have set a password for it. -c option means that generates a new file. If you want to add an authentication user to an existing .htpasswd is -c option will run the command as there is no need next.

# Htpasswd /Var/www/html/basic/.Htpasswd user1
New Password: [Enter Password]
Re-Type New Password: [password]
Adding Password For User User # More /Var/www/html/basic/.Htpasswd User : SNQ1ca2F / HkRk user1: 3JlDTcijbrgbQ
Authentication screen as you try to access from the browser to the directory of the top in this state is displayed, it is OK if you can browse in the ID / PASS.

? user authentication (Digest)

Another authentication of Apache, is Digest authentication. Basic authentication Digest authentication for the flowing password is in plain text will be encrypted. There is a need for Apache to auth_digest module has been incorporated as a prerequisite, you may not be supported in such old browser, but it is the security be preferred is better here.

How to set and edit from the first httpd.conf in almost the same as the Basic authentication.

<Directory “/ var / Www / Html / Digest”>
AuthType Digest
AuthName “Require Auth”
AuthUserFile /Var/www/html/digest/.Htdigest
Require Valid-User
</ Directory>

Actual user and password you set in the next command.

# Htdigest -C /Var/www/html/digest/.Htdigest ‘Require Auth’ User
Adding Password For User In Realm Require Auth.
New Password: [Enter Password]
Re-Type New Password: [password]

# More / var /Www/html/digest/.Htdigest
User: Require Auth: 5552A3218d8fd3d4ed6abfc4d0062c15

Register the “user” as the user ID, you have set a password for it. -c option means that generates a new file. The difference between Basic authentication, you must specify the realm. It is part of the referred to in the command of the above ‘Require Auth’. This should match the AuthName specified in httpd.conf. This state authentication screen to access from the browser to the above directory is displayed in, the behavior is OK if impassable until the authentication.
? virtual host of setting

the virtual host is a mechanism for operating multiple domains on a single Web server. For example www.rmohan.com also be operated as at the same time www.rmohan.com web server and to act as a web server will use the virtual host. The method to achieve a virtual host has a virtual host of IP-based virtual hosts and name-based. IP-based virtual host is a method to assign the IP address for each domain. You can surely realize the functions of the virtual host for the IP address that is connected from the client can determine the domain. However, can say that there is not a very realistic because the necessary IP address only the number of domains. However, it must be this system and I think an attempt is made to realize the HTTPS virtual host. Name-based virtual host is a method to determine the domain in the HTTP Host request header from the client. The IP address does not need more than one, but the client must correspond to the HTTP / 1.1. In the following left a note of this name-based virtual host.

It describes the settings that you want to distinguish between the server name, the document root, such as the location of the log for each domain. You must specify at least ServerName directive. The following is an example of setting the two of virtual host of www.rmohan.com and www.rmohan.com.

<VirtualHost 192.168.12.20>
ServerName www.rmohan.com
ServerAdmin webmaster@rmohan.com
DocumentRoot / var / www / unix-power / htdocs
ErrorLog /var/log/httpd/unixpower.net-error_log
CustomLog /var/log/httpd/unixpower.net-access_log combined
</VirtualHost>

<VirtualHost 192.168.12.20>
ServerName www.rmohan.com
ServerAdmin webmaster@rmohan.com
DocumentRoot / var / www / unix-power1 / htdocs
ErrorLog /var/log/httpd/unixpower1.net-error_log
CustomLog /var/log/httpd/unixpower1.net-access_log combined
</VirtualHost>

If you specify a <VirtualHost> _default_ in the argument of the directive it will be the default if you do not match the settings of all the virtual hosts. In addition, from the Apache2.4 statement that NameVirtualHost ****** is no longer required.

SSL Security

 

Image 3

 

 

This tutorial shows you how to set up strong SSL security on the Apache2 webserver. We do this by updating OpenSSL to the latest version to mitigate attacks like Heartbleed, disabling SSL Compression and EXPORT ciphers to mitigate attacks like FREAK, CRIME and LogJAM, disabling SSLv3 and below because of vulnerabilities in the protocol and we will set up a strong ciphersuite that enables Forward Secrecy when possible. We also enable HSTS and HPKP. This way we have a strong and future proof ssl configuration and we get an A+ on the Qually Labs SSL Test.

I’ve created a website with Copy-pastable strong cipherssuites for NGINX, Apache, Lighttpd and other software: https://cipherli.st. Handy if you don’t want to read this entire tutorial. This tutorial and https://cipherli.st are updated continuously as new vulnerabilities are discovered.

I’ve written an Open Source SSL server test. You can use it to test your configuration, as an addition to the other SSL tests our there. It is open source so you can host it yourself internally to test local resources. It is fast, shows you all the information so you can make your own informed decision (no ratings), and the results are saved so you can compare different settings. You can test your site via https://ssldecoder.org.

I’ve also written a handy tool which notifies you when your certificates are about to expire. It is open source so you can host it yourself internally and there is a hosted version available at https://certificatemonitor.org.

If you like this article, consider sponsoring me by trying out a Digital Ocean VPS. With this link you’ll get a $5 VPS for 2 months free (as in, you get $10 credit). (referral link)

This tutorial works with the strict requirements of the SSL Labs test

This tutorial is also available for NGINX
This tutorial is also available for Lighttpd
This tutorial is also available for FreeBSD, NetBSD and OpenBSD over at the BSD Now podcast

You can find more info on the topics by following the links below:

BEAST Attack
CRIME Attack
Heartbleed
FREAK Attack
Perfect Forward Secrecy
Dealing with RC4 and BEAST

Make sure you back up the files before editing them!
The BEAST attack and RC4

In short, by tampering with an encryption algorithm’s CBC – cipher block chaining – mode’s, portions of the encrypted traffic can be secretly decrypted. More info on the above link.

Recent browser versions have enabled client side mitigation for the beast attack. The recommendation was to disable all TLS 1.0 ciphers and only offer RC4. However, [RC4 has a growing list of attacks against it],(http://www.isg.rhul.ac.uk/tls/) many of which have crossed the line from theoretical to practical. Moreover, there is reason to believe that the NSA has broken RC4, their so-called “big breakthrough.”

Disabling RC4 has several ramifications. One, users with shitty browsers such as Internet Explorer on Windows XP will use 3DES in lieu. Triple-DES is more secure than RC4, but it is significantly more expensive. Your server will pay the cost for these users. Two, RC4 mitigates BEAST. Thus, disabling RC4 makes TLS 1.0 users susceptible to that attack, by moving them to AES-CBC (the usual server-side BEAST “fix” is to prioritize RC4 above all else). I am confident that the flaws in RC4 significantly outweigh the risks from BEAST. Indeed, with client-side mitigation (which Chrome and Firefox both provide), BEAST is a nonissue. But the risk from RC4 only grows: More cryptanalysis will surface over time.
Factoring RSA-EXPORT Keys (FREAK)

FREAK is a man-in-the-middle (MITM) vulnerability discovered by a group of cryptographers at INRIA, Microsoft Research and IMDEA. FREAK stands for “Factoring RSA-EXPORT Keys.”

The vulnerability dates back to the 1990s, when the US government banned selling crypto software overseas, unless it used export cipher suites which involved encryption keys no longer than 512-bits.

It turns out that some modern TLS clients – including Apple’s SecureTransport and OpenSSL – have a bug in them. This bug causes them to accept RSA export-grade keys even when the client didn’t ask for export-grade RSA. The impact of this bug can be quite nasty: it admits a ‘man in the middle’ attack whereby an active attacker can force down the quality of a connection, provided that the client is vulnerable and the server supports export RSA.

There are two parts of the attack as the server must also accept “export grade RSA.”

The MITM attack works as follows:

In the client’s Hello message, it asks for a standard ‘RSA’ ciphersuite.
The MITM attacker changes this message to ask for ‘export RSA’.
The server responds with a 512-bit export RSA key, signed with its long-term key.
The client accepts this weak key due to the OpenSSL/SecureTransport bug.
The attacker factors the RSA modulus to recover the corresponding RSA decryption key.
When the client encrypts the ‘pre-master secret’ to the server, the attacker can now decrypt it to recover the TLS ‘master secret’.
From here on out, the attacker sees plaintext and can inject anything it wants.

The ciphersuite offered here on this page does not enable EXPORT grade ciphers. Make sure your OpenSSL is updated to the latest available version and urge your clients to also use upgraded software.
Logjam (DH EXPORT)

Researchers from several universities and institutions conducted a study that found an issue in the TLS protocol. In a report the researchers report two attack methods.

Diffie-Hellman key exchange allows that depend on TLS to agree on a shared key and negotiate a secure session over a plain text connection.

With the first attack, a man-in-the-middle can downgrade a vulnerable TLS connection to 512-bit export-grade cryptography which would allow the attacker to read and change the data. The second threat is that many servers and use the same prime numbers for Diffie-Hellman key exchange instead of generating their own unique DH parameters.

The team estimates that an academic team can break 768-bit primes and that a nation-state could break a 1024-bit prime. By breaking one 1024-bit prime, one could eavesdrop on 18 percent of the top one million HTTPS domains. Breaking a second prime would open up 66 percent of VPNs and 26 percent of SSH servers.

Later on in this guide we generate our own unique DH parameters and we use a ciphersuite that does not enable EXPORT grade ciphers. Make sure your OpenSSL is updated to the latest available version and urge your clients to also use upgraded software. Updated browsers refuse DH parameters lower than 768/1024 bit as a fix to this.

Cloudflare has a detailed guide on logjam.
Heartbleed

Heartbleed is a security bug disclosed in April 2014 in the OpenSSL cryptography library, which is a widely used implementation of the Transport Layer Security (TLS) protocol. Heartbleed may be exploited regardless of whether the party using a vulnerable OpenSSL instance for TLS is a server or a client. It results from improper input validation (due to a missing bounds check) in the implementation of the DTLS heartbeat extension (RFC6520), thus the bug’s name derives from “heartbeat”. The vulnerability is classified as a buffer over-read, a situation where more data can be read than should be allowed.

What versions of the OpenSSL are affected by Heartbleed?

Status of different versions:

OpenSSL 1.0.1 through 1.0.1f (inclusive) are vulnerable
OpenSSL 1.0.1g is NOT vulnerable
OpenSSL 1.0.0 branch is NOT vulnerable
OpenSSL 0.9.8 branch is NOT vulnerable

The bug was introduced to OpenSSL in December 2011 and has been out in the wild since OpenSSL release 1.0.1 on 14th of March 2012. OpenSSL 1.0.1g released on 7th of April 2014 fixes the bug.

By updating OpenSSL you are not vulnerable to this bug.
SSL Compression (CRIME attack)

The CRIME attack uses SSL Compression to do its magic, so we need to disable that. On Apache 2.2.24+ we can add the following line to the SSL config file we also edited above:

SSLCompression off

If you are using al earlier version of Apache and your distro has not backported this option then you need to recompile OpenSSL without ZLIB support. This will disable the use of OpenSSL using the DEFLATE compression method. If you do this then you can still use regular HTML DEFLATE compression.
SSLv2 and SSLv3

SSL v2 is insecure, so we need to disable it. We also disable SSLv3, as TLS 1.0 suffers a downgrade attack, allowing an attacker to force a connection to use SSLv3 and therefore disable forward secrecy.

SSLv3 allows exploiting of the POODLE bug. This is one more major reason to disable this!

Again edit the config file:

SSLProtocol All -SSLv2 -SSLv3

All is a shortcut for +SSLv2 +SSLv3 +TLSv1 or – when using OpenSSL 1.0.1 and later – +SSLv2 +SSLv3 +TLSv1 +TLSv1.1 +TLSv1.2, respectively. The above line enables everything except SSLv2 and SSLv3. More info on the apache website
Poodle and TLS-FALLBACK-SCSV

SSLv3 allows exploiting of the POODLE bug. This is one more major reason to disable this.

Google have proposed an extension to SSL/TLS named TLSFALLBACKSCSV that seeks to prevent forced SSL downgrades. This is automatically enabled if you upgrade OpenSSL to the following versions:

OpenSSL 1.0.1 has TLSFALLBACKSCSV in 1.0.1j and higher.
OpenSSL 1.0.0 has TLSFALLBACKSCSV in 1.0.0o and higher.
OpenSSL 0.9.8 has TLSFALLBACKSCSV in 0.9.8zc and higher.

The Cipher Suite

(Perfect) Forward Secrecy ensures the integrity of a session key in the event that a long-term key is compromised. PFS accomplishes this by enforcing the derivation of a new key for each and every session.

This means that when the private key gets compromised it cannot be used to decrypt recorded SSL traffic.

The cipher suites that provide Perfect Forward Secrecy are those that use an ephemeral form of the Diffie-Hellman key exchange. Their disadvantage is their overhead, which can be improved by using the elliptic curve variants.

The following two ciphersuites are recommended by me, and the latter by the Mozilla Foundation.

The recommended cipher suite:

SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH

The recommended cipher suite for backwards compatibility (IE6/WinXP):

SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4

If your version of OpenSSL is old, unavailable ciphers will be discarded automatically. Always use the full ciphersuite above and let OpenSSL pick the ones it supports.

The ordering of a ciphersuite is very important because it decides which algorithms are going to be selected in priority. The recommendation above prioritizes algorithms that provide perfect forward secrecy.

Older versions of OpenSSL may not return the full list of algorithms. AES-GCM and some ECDHE are fairly recent, and not present on most versions of OpenSSL shipped with Ubuntu or RHEL.
Prioritization logic

ECDHE+AESGCM ciphers are selected first. These are TLS 1.2 ciphers. No known attack currently target these ciphers.
PFS ciphersuites are preferred, with ECDHE first, then DHE.
AES 128 is preferred to AES 256. There has been discussions on whether AES256 extra security was worth the cost, and the result is far from obvious. At the moment, AES128 is preferred, because it provides good security, is really fast, and seems to be more resistant to timing attacks.
In the backward compatible ciphersuite, AES is preferred to 3DES. BEAST attacks on AES are mitigated in TLS 1.1 and above, and difficult to achieve in TLS 1.0. In the non-backward compatible ciphersuite, 3DES is not present.
RC4 is removed entirely. 3DES is used for backward compatibility. See discussion in #RC4_weaknesses

Mandatory discards

aNULL contains non-authenticated Diffie-Hellman key exchanges, that are subject to Man-In-The-Middle (MITM) attacks
eNULL contains null-encryption ciphers (cleartext)
EXPORT are legacy weak ciphers that were marked as exportable by US law
RC4 contains ciphers that use the deprecated ARCFOUR algorithm
DES contains ciphers that use the deprecated Data Encryption Standard
SSLv2 contains all ciphers that were defined in the old version of the SSL standard, now deprecated
MD5 contains all the ciphers that use the deprecated message digest 5 as the hashing algorithm

With Apache 2.2.x you have only DHE suites to work with, but they are not enough. Internet Explorer (in all versions) does not support the required DHE suites to achieve Forward Secrecy. (Unless youre using DSA keys, but no one does; that’s a long story.) Apache does not support configurable DH parameters in any version, but there are patches you could use if you can install from source.

Even if openssl can provide ECDHE the apache 2.2 in debian stable does not support this mechanism. You need apache 2.4 to fully support forward secrecy.

A workaround could be the usage of nginx as a reverse proxy because it fully supports ECDHE.

Make sure you also add this line:

SSLHonorCipherOrder on

When choosing a cipher during an SSLv3 or TLSv1 handshake, normally the client’s preference is used. If this directive is enabled, the server’s preference will be used instead.
Forward Secrecy & Diffie Hellman Ephemeral Parameters

The concept of forward secrecy is simple: client and server negotiate a key that never hits the wire, and is destroyed at the end of the session. The RSA private from the server is used to sign a Diffie-Hellman key exchange between the client and the server. The pre-master key obtained from the Diffie-Hellman handshake is then used for encryption. Since the pre-master key is specific to a connection between a client and a server, and used only for a limited amount of time, it is called Ephemeral.

With Forward Secrecy, if an attacker gets a hold of the server’s private key, it will not be able to decrypt past communications. The private key is only used to sign the DH handshake, which does not reveal the pre-master key. Diffie-Hellman ensures that the pre-master keys never leave the client and the server, and cannot be intercepted by a MITM.

Apache prior to version 2.4.7 and all versions of Nginx as of 1.4.4 rely on OpenSSL for input parameters to Diffie-Hellman (DH). Unfortunately, this means that Ephemeral Diffie-Hellman (DHE) will use OpenSSL’s defaults, which include a 1024-bit key for the key-exchange. Since we’re using a 2048-bit certificate, DHE clients will use a weaker key-exchange than non-ephemeral DH clients.

For Apache, there is no fix except to upgrade to 2.4.7 or later. With that version, Apache automatically selects a stronger key.

If you have Apache 2.4.8 or later and OpenSSL 1.0.2 or later, you can generate and specify your DH params file:

#Generate the parameters
cd /etc/ssl/certs
openssl dhparam -out dhparam.pem 4096

# Add the following to your Apache config.
SSLOpenSSLConfCmd DHParameters “/etc/ssl/certs/dhparam.pem”

If you are using Apache with LibreSSL, or Apache 2.4.7 and OpenSSL 0.9.8a or later, you can append the DHparams you generated earlier to the end of your certificate file. The documentation for that is here and below:

Custom DH parameters and an EC curve name for ephemeral keys, can also be added to end of the first file configured using SSLCertificateFile. This is supported in version 2.4.7 or later. Such parameters can be generated using the commands openssl dhparam and openssl ecparam. The parameters can be added as-is to the end of the first certificate file. Only the first file can be used for custom parameters, as they are applied independently of the authentication algorithm type.

Around May, Debian backported ECDH ciphers to work with apache 2.2, and it’s possible to get PFS: http://metadata.ftp-master.debian.org/changelogs//main/a/apache2/apache22.2.22-13+deb7u3changelog

> apache2 (2.2.22-13+deb7u2) wheezy; urgency=medium

* Backport support for SSL ECC keys and ECDH ciphers.

HTTP Strict Transport Security

When possible, you should enable HTTP Strict Transport Security (HSTS), which instructs browsers to communicate with your site only over HTTPS.

View my article on HTST to see how to configure it.
HTTP Public Key Pinning Extension

You should also enable the HTTP Public Key Pinning Extension.

Public Key Pinning means that a certificate chain must include a whitelisted public key. It ensures only whitelisted Certificate Authorities (CA) can sign certificates for *.example.com, and not any CA in your browser store.

I’ve written an article about it that has background theory and configuration examples for Apache, Lighttpd and NGINX: https://raymii.org/s/articles/HTTPPublicKeyPinningExtension_HPKP.html
OCSP Stapling

When connecting to a server, clients should verify the validity of the server certificate using either a Certificate Revocation List (CRL), or an Online Certificate Status Protocol (OCSP) record. The problem with CRL is that the lists have grown huge and takes forever to download.

OCSP is much more lightweight, as only one record is retrieved at a time. But the side effect is that OCSP requests must be made to a 3rd party OCSP responder when connecting to a server, which adds latency and potential failures. In fact, the OCSP responders operated by CAs are often so unreliable that browser will fail silently if no response is received in a timely manner. This reduces security, by allowing an attacker to DoS an OCSP responder to disable the validation.

The solution is to allow the server to send its cached OCSP record during the TLS handshake, therefore bypassing the OCSP responder. This mechanism saves a roundtrip between the client and the OCSP responder, and is called OCSP Stapling.

The server will send a cached OCSP response only if the client requests it, by announcing support for the status_request TLS extension in its CLIENT HELLO.

Most servers will cache OCSP response for up to 48 hours. At regular intervals, the server will connect to the OCSP responder of the CA to retrieve a fresh OCSP record. The location of the OCSP responder is taken from the Authority Information Access field of the signed certificate.

View my tutorial on enabling OCSP stapling on Apache
Conclusion

If you have applied the above config lines you need to restart apache:

# Check the config first:
apache2ctl -t
# Then restart:
/etc/init.d/apache2 restart

# If you are on RHEL/CentOS:
apachectl -t
/etc/init.d/httpd restart

 

 

 

Here’s my config for apache2.4:

1) 4096 bit key:
You will need to generate a 4096 bit key instead of the default 2048 bit key to get the key exchange to 100%. To do this, run letsencrypt-auto with this flag: --rsa-key-size 4096

./letsencrypt-auto --agree-dev-preview --server \
https://acme-v01.api.letsencrypt.org/directory auth --rsa-key-size 4096

2) SSL Settings:
Add these directives to your apache2 config in the vhost section:

SSLEngine on
SSLCompression off
SSLCipherSuite "HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128"
SSLHonorCipherOrder on
SSLProtocol TLSv1.2
SSLUseStapling on

3) SSL Certificate and Key File Settings:
Also add these directives to your apache2 config in the same vhost section. Keep in mind you need to update the path to your specific certificate and key that relate to your domain (<<< YOUR DOMAIN HERE >>>):

SSLCertificateFile "/etc/letsencrypt/live/<<< YOUR DOMAIN HERE >>>/fullchain.pem"
SSLCertificateKeyFile "/etc/letsencrypt/live/<<< YOUR DOMAIN HERE >>>/privkey.pem"

4) DH parameters:
Generate >=4096 dhparams using your openssl binary. This will take some time:

openssl dhparam -out /etc/ssl/private/dhparams_4096.pem 4096

If you have openssl >= 1.0.2d installed (type openssl version to find out), you can use the following line in your apache2 vhost config:

SSLOpenSSLConfCmd DHParameters "/etc/ssl/private/dhparams_4096.pem"

If you do not have openss >= 1.0.2d, you will need to append your dhparameters to the bottom of your certificate file:

cat /etc/letsencrypt/live/<<< YOUR DOMAIN HERE >>>/fullchain.pem \
    /etc/ssl/private/dhparams_4096.pem > \
    /etc/letsencrypt/archive/<<< YOUR DOMAIN HERE >>>/fullchain_dhparams_4096.pem

Then you will use this file in place of your SSLCertificateFile above:

SSLCertificateFile "/etc/letsencrypt/archive/<<< YOUR DOMAIN HERE >>>/fullchain_dhparams_4096.pem"

Keep in mind that if you manipulate the certificate (issue a new one, etc), you will need to repeat this step as the dhparams will not be added to that certificate!

5) Headers:
You need to set a Public-Key-Pin header. Generate the first pin against the letsencrypt chain cert with the following code (read more here: https://raymii.org/s/articles/HTTP_Public_Key_Pinning_Extension_HPKP.html88):

openssl x509 -noout -in /etc/letsencrypt/live/<<<< YOUR DOMAIN HERE >>>>/chain.pem -pubkey | \
openssl asn1parse -noout -inform pem -out /tmp/fingerprint.key;
openssl dgst -sha256 -binary /tmp/fingerprint.key | openssl enc -base64

The next pin comes from your private key. You should keep this key in a safe place:

openssl x509 -noout -in /etc/letsencrypt/live/<<<< YOUR DOMAIN HERE >>>>/privkey.pem -pubkey | \
openssl asn1parse -noout -inform pem -out /tmp/fingerprint.key;
openssl dgst -sha256 -binary /tmp/fingerprint.key | openssl enc -base64

You will use these fingerprints in the section below (<<< YOUR CUSTOM PIN HERE >>>).

I haven’t figured out a good programmatic way to get the chain cert keys, but I have found that you can get them with https://dev.ssllabs.com/ssltest/analyze.html70 by analyzing your own site once it’s already running.

Also add these directives to your apache2 config in the same vhost section:

Header edit Set-Cookie ^(.*)$ $1;HttpOnly;Secure
Header always set Public-Key-Pins "pin-sha256=\"<<< YOUR CHAIN PIN HERE >>>=\"; pin-sha256=\"<<< YOUR PRIVATE KEY PIN HERE >>>\"; max-age=31536000; includeSubDomains"
Header always set X-Frame-Options SAMEORIGIN
Header always set Strict-Transport-Security "max-age=31536000; includeSubdomains; preload"
Header always set X-Content-Type-Options nosniff

6) SSL Stapling Cache:
Add the following line to your ssl.conf /etc/apache2/conf-available/ssl.conf file:

echo 'SSLStaplingCache shmcb:/tmp/stapling_cache(2097152)' >> \
/etc/apache2/conf-available/ssl.conf`

Enable your ssl.conf file:

a2enconf ssl

7) Restart Apache:

service apache2 restart

8) Test your site at https://www.ssllabs.com/ssltest/analyze.html150. You’re done!

 

SSL Handshake Failed, Specified label could not be found in the key file

download (5)

This error is seen due the SSLServerCert variable defined in httpd.conf file of IHS defined under the SSL Virtual host.

Check the hostname or the common name that is mentioned next to SSLServerCert variable.

Solution: Install the self signed or signed certificate with the common name and import it to the key.kdb.

Install SSL certificate

The following instructions will guide you to create csr and import the signed crt in the default kdb of IHS.

Step 1: Finding the Kdb

The default Kdb will be present in the IHS installation path. Find the key.kdb and take a back up before executing the commands.

Step 2: Creation of Csr

Use the following command to create the csr.
gskcmd will be present in the bin folder of IHS. gsk7cmd can be used based on the version of IHS.
./gskcmd -certreq -create -db /opt/IHS/SSL/key.kdb -pw WebAS -label lablename -dn “CN=hostname, OU=ou name, O=organization, L=Location, ST=state, C=country code” -size 2048 -file filename.csr
-db is the key.kdb path
-pw is the kdb password, The defualt password is WebAS
-label is any name that you choose the certificated to be labled.
-dn is the domain information
CN = Common name (dns name of the name with which you are trying to use https://hotname protocol)
OU = Organization unit name (ex: IT services)
O = Organization that you are working in, or to whom you are configuring the certificate.
L = Location (ex: Germany)
C = 2 digit country code (ex: GE)
This command will create a filename.csr with the information that you have provided.

Step 3: Certificate request

The csr has to be sent to the certificate signing authorities like verisign, Thwate or Geotrust. They will create a crt file and send the server certificate along with the root and intermediate certificates.

Step 4: Importing the server certificate

Following command will import the server certificate to the kdb file.

Save the certificate file received from the signing authority as server.crt and execute the following command.

gskcmd -cert -receive -file server.crt -db /opt/IHS/SSL/key.kdb -pw WebAS -label servercertificate -format ascii

This command will import the server certificate.

Step 5: Set the server certificate to default

Following command will make the server certificate as default. When you access the https protocol of the website, The default certificate will be choosen.

gskcmd -cert -setdefault -label servercertificate -db /opt/IBM/HTTPServer/SSL/key.kdb

Step  6: Importing the CA/Intermediate certificate

Along with the server certificate, The signing authority will send the intermediate certificate, This certificate has to be imported to prevent the ssl handshake errors.

Save the Intermediate certificate as rootCAcertificate.crt and execute the following command.

gskcmd -cert -add -file rootCAcertificate.crt -db /opt/IHS/SSL/key.kdb -label primaryCA -pw WebAS -format ascii

Step 7: Populate the certificates

gskcmd -cert -populate -db /opt/IHS/SSL/key.kdb -pw WebAS
 

Now add the kdb path in the httpd.conf in ssl module tags and restart the apache server with -DSSL option.

Basic commands of gskcmd to check the certificates:

List the certificates : ./gskcmd -cert -list -db /opt/IHS/SSL/key.kdb 

Check the details of the certificates:  

./gskcmd -certreq -details -label labelname -db /opt/IHS/SSL/key.kdb
./gskcmd -cert -details -label labelname -db /opt/IHS/SSL/key.kdb

Delete a certificate : ./gskcmd -cert -delete -label labelname -db /opt/IHS/SSL/key.kdb

Extract a certificate : ./gskcmd -cert -extract -db certificate.jks -label labelname -target test_myne.cer -type jks

 

 

Date and Time stamp] [error] [client ip] [ds0] [789] SSL0223E: SSL Handshake Failed, No certificate.

 

> Then use the following command to display the chain of certificates imported in the kdb. You can see the certificate that you have imported in the kdb. This should display the new certificate imported to the kdb.

./gskcmd -cert -list -db /opt/IHS/SSL/key.kdb

-> Even after this you see the error, Make the certificate as default using the following command.

gskcmd -cert -setdefault -label servercertificate -db /opt/IBM/HTTPServer/SSL/key.kdb

Now a quick restart of the apache server should resolve the issue.