{"id":10894,"date":"2021-10-05T08:42:41","date_gmt":"2021-10-05T08:42:41","guid":{"rendered":"https:\/\/linuxways.net\/?p=10894"},"modified":"2021-10-05T08:42:41","modified_gmt":"2021-10-05T08:42:41","slug":"how-to-generate-csr-certificate-signing-request-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-generate-csr-certificate-signing-request-in-linux\/","title":{"rendered":"How to Generate CSR (Certificate Signing Request) in Linux?"},"content":{"rendered":"<p>To obtain an SSL certificate, CSR (Certificate Signing Request) must be generated. It is later provided to the CA (Certificate Authority) who is responsible to provide such SSL certificates. Such CSR must be generated on the server. CSR includes and stores information such as Country Name, Organization name, domain name, common name, email address, the public key, and so on.<\/p>\n<h3>There are two types of certificates which are Self Signed Certificate and Certificate Authority<\/h3>\n<p>Self Signed certificates are usually generated to run the website in the developing phase or test environment. It is simply generated by using OpenSSL or any other tool which is free to use.<\/p>\n<p>In other cases, running the website or applications on a production environment, the certificate must be used and generated after verifying by the trusted CA.<\/p>\n<h3>To generate Certificate Signing Request(CSR) in Linux:<\/h3>\n<p>In Linux, first, we must have to install tools like OpenSSL to generate Certificate Signing Request (CSR). Let\u2019s see the command to install OpenSSL on Ubuntu 20.04.<\/p>\n<pre>$ sudo apt install openssl<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"407\" class=\"wp-image-10895\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-109.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-109.png 722w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-109-300x169.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p>To verify if OpenSSL is installed or not, you can run the following command:<\/p>\n<pre>$ sudo openssl -a<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"727\" height=\"287\" class=\"wp-image-10896\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-110.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-110.png 727w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-110-300x118.png 300w\" sizes=\"auto, (max-width: 727px) 100vw, 727px\" \/><\/p>\n<h3>To generate CSR and key in Linux<\/h3>\n<p>We can run the following command to generate a CSR and key which will be provided later to trusted CA.<\/p>\n<pre>$ sudo openssl req -new -newkey rsa:2048 -nodes -keyout test.com.key -out test.com.csr<\/pre>\n<p>Here,<\/p>\n<p>new = new request<\/p>\n<p>new-key rsa:2048 = create 2048-bit RSA key<\/p>\n<p>nodes = It tells to not encrypt the key<\/p>\n<p>keyout = It species filename to forward key on private key<\/p>\n<p>Out = It specifies filename to write CSR to<\/p>\n<p>After executing the above command, it will ask to provide the details such as Country Name, Organization name, domain name, common name, email address. Also, be sure your legally registered company name must be matched with the details you provide. It will be verified perfectly by the Certificate Authority before issuing the certificate.<\/p>\n<p>Here is the output section after executing the above command, you need to put details on:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"719\" height=\"483\" class=\"wp-image-10897\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-111.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-111.png 719w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-111-300x202.png 300w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><\/p>\n<p>Now, you can list and view the contents of the file that you have created with the above commands:<\/p>\n<pre>$ ls<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"610\" height=\"106\" class=\"wp-image-10898\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-112.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-112.png 610w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-112-300x52.png 300w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p>You can check and print the contents of the CSR with the following command:<\/p>\n<pre>$ cat test.com.csr<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"585\" height=\"345\" class=\"wp-image-10899\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-113.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-113.png 585w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-113-300x177.png 300w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><\/p>\n<p>Now, you can use such a CSR file to apply for SSL certificates from a trusted CA.<\/p>\n<h2>Conclusion:<\/h2>\n<p>With the above steps, you must have learned the process of creating a CSR file which is very necessary before applying for an SSL certificate from a Certificate Authority(CA). Thank you!<\/p>","protected":false},"excerpt":{"rendered":"<p>To obtain an SSL certificate, CSR (Certificate Signing Request) must be generated. It is later provided to the CA (Certificate Authority) who is responsible to provide such SSL&hellip;<\/p>","protected":false},"author":1,"featured_media":10945,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[602,35],"class_list":["post-10894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-certificate-signing-request","tag-linux"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=10894"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/10894\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/10945"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=10894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=10894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=10894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}