Skip to main content

Debian how to create your server's self signed SSL certificates


SSL stands for Secure Sockets Layer in short, it's the standard technology for keeping an internet connection secure and safeguarding any sensitive data that is being sent between two systems. The two systems can be a server and a client (for example, a shopping website and browser) or server to server (for example, an application with personal identifiable information or with payroll information). In general we would say  SSL Certificates protect your sensitive information such as credit card information, usernames, passwords etc.
This particular kind of cryptography harnesses the power of two keys which are long strings of randomly generated numbers. One is called a private key and another one is called a public key.A public key is known to your server and available in the public domain. It can be used to encrypt any message.

In this post I will show you how to properly configure OpenSSL which  is full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library. OpenSSL is a nice tool to help you became a CA (Certificaet Authority) to sign other people's CSR (Certificate Signing Request).OpenSSL can generate 2048-bit keys. Certificates generated by OpenSSL are compatible for "keytool" to import into 'keystore' files.  We will use 2048-Bit Private Keys, for most web sites, security provided by 2,048-bit RSA keys is sufficient. The RSA public key algorithm is widely supported, which makes keys of this type a safe default choice.

 Create your server's self signed SSL Certificates. 


Note: If you use your server for a business, it better to buy and use Formal Certificates.

cd /etc/ssl/private

openssl genrsa -aes128 -out server.key 2048
Generating RSA private key, 2048 bit long modulus (2 primes)
......................+++++
....................+++++
e is 65537 (0x010001)
Enter pass phrase for server.key:     # set passphrase

Verifying - Enter pass phrase for server.key:    # confirm

# remove passphrase from private key

openssl rsa -in server.key -out server.key
Enter pass phrase for server.key:   # passphrase
writing RSA key


 generate certificate requests

openssl req -new -days 3650 -key server.key -out server.csr

Ignoring -days; not generating a certificate
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:TZ
State or Province Name (full name) [Some-State]:Dar Es Salaam
Locality Name (eg, city) []:Dar Es Salaam
Organization Name (eg, company) [Internet Widgits Pty Ltd]:LBT
Organizational Unit Name (eg, section) []:internal labnet
Common Name (e.g. server FQDN or YOUR name) []:pyw.internal,labnet
Email Address []:admin@internal.labnet

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:




Generate a certificate signing request based on an existing certificate
openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650
Signature ok
subject=C = TZ, ST = Dar Es Salaam, L = Dar Es Salaam, O = LBT, OU = internal labnet, CN = "pyw.internal,labnet", emailAddress = admin@internal.labnet
Getting Private key

Popular posts from this blog

Difference between HashMap, LinkedHashMap and TreeMap

 LinkedHashMap is an implementation of java.util.Map interface with predictable iteration order (the order of insertion) i.e. LinkedHashMap will iterate in the order in which the entries were put into the map. LinkedHashMap implementation differs from HashMap in the way that it maintains a doubly-linked list running through all of its entries. This linked list defines the iteration ordering, which is normally the order in which keys were inserted into the map. The insertion order is not affected if a key is re-inserted into the map. Performance of LinkedHashMap is slightly below than that of HashMap, due to the added expense of maintaining the linked list. The other two important implementations of Map interface are java.util.HashMap and java.util.TreeMap. They offer mostly the same functionality. The most important difference is the order in which iteration through the entries will happen. HashMap makes no guarantee about the order. The order can even change completely whe...

mongodb authentication setting

The administrator of the database is the right person for the task of granting, or denying, permissions to users for doing operations with database resources. By using roles, we can specify what action can be done with a resource. Therefore, a role is a privilege granted to a user to do specific tasks with specific resources. Before you enable access control, you should create a user that can then create users and assign roles to them once access control is enabled.This user-admin will then be used to create and maintain other users and roles, so needs to be assigned a suitable role to enable it to do so. I assume you already have admin user set up within you system if not refer hare before proceeding. The role userAdminAnyDatabase in MongoDB gives ability to create users and assign roles to them, but by itself it doesn’t allow the user to do anything else. The superuser role in MongoDB is the root . In the this post i will show how to create, show and delete a user in...

How to Install Latest Nodejs, NPM & Yarn on Debian

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.Node is designed to build scalable network applications. Latest version node.js ppa is maintaining on its official website.In this post, I'll work you through on how to get started with Node.js on a Debian 9 server. Step 1 – Add Node.js PPA ( personal package archive ) To work with a more recent version of Node.js, you can add the PPA   maintained by NodeSource. This will have more up-to-date versions of Node.js than the official Debian repositories, We first need to install the curl if not installed already, which you will use to access the PPA    apt install curl Step 2 – Install Node.js on Debian Now that the pre request is out of our way , let's install the PPA in order to get access to its contents. Let's use curl to retrieve the installation script for your preferred version, note that Latest LTS Version: 10.16.0 (includes npm 6.9.0) is recommended for most users, while th...