LetsEncrypt CAFile for pkcs12 format

you may get “Error unable to get local issuer certificate getting chain.” while creating a keystore in the pkcs12 with Letsencrypt certificate.¬† You need to create CAFile to fix this issue.

install openjdk-8-jre for keytool, if you do not have keytool command on Linux

# sudo apt-get install openjdk-8-jre

To create CAFile, download  and merge root and intermediate certificate of Letsencrypt at https://letsencrypt.org/certs

# wget https://letsencrypt.org/certs/isrgrootx1.pem.txt  #

# wget https://letsencrypt.org/certs/letsencryptauthorityx3.pem.txt

# cat isrgrootx1.pem.txt letsencryptauthorityx3.pem.txt > letsencryptCA.pem

# openssl pkcs12 -export -in domain.crt -inkey domain.key -chain -CAfile letsencryptCA.pem -name “mycert” -out myapp.p12

# keytool -importkeystore -deststorepass myapppass -destkeystore myapp.keystore -srckeystore myapp.p12 -srcstoretype PKCS12

Verify the keystore;

# keytool -list -v -keystore myapp.keystore -storepass myapppass

Now you can use this keystore on Tomcat/Jboss

ismail yenigul

Advertisements
LetsEncrypt CAFile for pkcs12 format

pg_prewarm extention to Pre-warming the buffer cache in PostgreSQL

The pg_prewarm module provides to load relation data into either the operating system buffer cache or the PostgreSQL buffer cache.
It is available for PostgreSQL 9.4 or higher releases.

You can load the most important tables to the cache when the postgresql was restarted.

First install postgresql contrib package

example:
yum install postgresql96-contrib
apt-get install postgresql-contrib-9.6

Login to database and create the extension.

psql -U user databasename
create extension pg_prewarm;

enable prewarn on desired tables
SELECT pg_prewarm(‘tablename’);

example
SELECT pg_prewarm(‘languages’);
SELECT pg_prewarm(‘messages’);

 

You have to run SELECT pg_prewarm(‘tablename’); whenever you restart postgresql database. You can add SELECT statements into a bash script and call it when the database become online.

References:

https://www.postgresql.org/docs/9.4/static/pgprewarm.html

https://blog.dbi-services.com/pre-warming-the-buffer-cache-in-postgresql/

https://www.depesz.com/2014/01/10/waiting-for-9-4-pg_prewarm-a-contrib-module-for-prewarming-relationd-data/

 

ismail yenigul

 

pg_prewarm extention to Pre-warming the buffer cache in PostgreSQL