ubuntu:certificates:create_a_self-signed_certificate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:certificates:create_a_self-signed_certificate [2023/06/09 16:10] – [Create a self-signed certificate] peter | ubuntu:certificates:create_a_self-signed_certificate [2023/06/09 16:26] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ubuntu - Certificates - Create a self-signed certificate ====== | ====== Ubuntu - Certificates - Create a self-signed certificate ====== | ||
+ | |||
+ | A self-signed certificate made in this way is sufficient for testing, but should not be used in a production environment. | ||
+ | |||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * Many clients require that the certificate presented by the server be a user (also called “leaf” or “site”) certificate, | ||
+ | * In this situation, the self-signed certificate must be installed on the client host as a trusted root certification authority (CA), and the certificate used must be a user certificate signed with that self-signed certificate. | ||
+ | |||
+ | * For information on creating self-signed CA certificates and using them to sign user certificates, | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Prerequisites ===== | ||
+ | |||
+ | Ensure that openssl is installed. | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt install openssl | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | <code bash> | ||
+ | man openssl | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
===== Create a self-signed certificate ===== | ===== Create a self-signed certificate ===== | ||
Line 8: | Line 42: | ||
openssl req -x509 -newkey rsa:2048 -keyout file1.key -out file2.crt -days 9999 -nodes | openssl req -x509 -newkey rsa:2048 -keyout file1.key -out file2.crt -days 9999 -nodes | ||
</ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | <code bash> | ||
+ | openssl req -new -x509 -days 9999 -nodes -out file1.pem -keyout file2.key | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * You could, in **/ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | This will prompt with a number of questions. | ||
+ | |||
+ | < | ||
+ | Generating a 2048 bit RSA private key | ||
+ | ...........................+++ | ||
+ | ...........................................................................+++ | ||
+ | writing new private key to ' | ||
+ | ----- | ||
+ | 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 ' | ||
+ | ----- | ||
+ | Country Name (2 letter code) [AU]:JE | ||
+ | State or Province Name (full name) [Some-State]: | ||
+ | Locality Name (eg, city) []:St. Helier | ||
+ | Organization Name (eg, company) [Internet Widgits Pty Ltd]: | ||
+ | Organizational Unit Name (eg, section) []: | ||
+ | Common Name (e.g. server FQDN or YOUR name) []: | ||
+ | Email Address []: | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
<WRAP info> | <WRAP info> | ||
Line 33: | Line 108: | ||
</ | </ | ||
- | <WRAP info> | ||
- | **NOTE: | ||
- | * However, many clients require that the certificate presented by the server be a user (also called “leaf” or “site”) certificate, | ||
- | * In this situation, the self-signed certificate described above must be installed on the client host as a trusted root certification authority (CA), and the certificate used by Exim must be a user certificate signed with that self-signed certificate. | ||
- | |||
- | * For information on creating self-signed CA certificates and using them to sign user certificates, | ||
- | |||
- | </ | ||
---- | ---- | ||
- | ===== References | + | ===== Broken down ===== |
- | http:// | + | The same code as above, but split into separate commands: |
- | ===== Broken down ===== | + | |
<code bash> | <code bash> | ||
Line 67: | Line 133: | ||
</ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Set Permissions for the certificate files ===== | ||
+ | |||
+ | <code bash> | ||
+ | chmod 600 file1* | ||
+ | chmod 600 file2* | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== References ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | http:// | ||
+ | |||
+ | http:// | ||
+ | |||
+ | http:// |
ubuntu/certificates/create_a_self-signed_certificate.1686327005.txt.gz · Last modified: 2023/06/09 16:10 by peter