-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathubuntu_csr.sh
More file actions
50 lines (36 loc) · 2.93 KB
/
Copy pathubuntu_csr.sh
File metadata and controls
50 lines (36 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# could you make a csr for ubuntu for mysite.local private domain?
# To generate a Certificate Signing Request (CSR) for a private domain like mysite.local on an Ubuntu server, you will need to use OpenSSL,
# which is a common tool for managing SSL certificates and keys. Here's how you can do it:
# Install OpenSSL (skip if it's already installed):
# Open your terminal and update your package list:
sudo apt update
# Then install OpenSSL:
sudo apt install openssl
# Generate a Private Key:
# Generate a private key for your server using the following command. Replace 4096 with the desired key length; 2048 is the minimum recommended length, but 4096 is more secure.
openssl genrsa -out mysite.local.key 4096
# This will create a file named mysite.local.key which is your private key. Keep this file secure and private.
# Generate the CSR:
# Now that you have a private key, you can generate a CSR with the following command:
openssl req -new -key mysite.local.key -out mysite.local.csr
# You will be prompted to enter details for the CSR; these are the Distinguished Name (DN) fields:
Country Name (2 letter code): The two-letter country code where your organization is legally located.
State or Province Name (full name): The state or province where your organization is located.
Locality Name (eg, city): The city where your organization is located.
Organization Name (eg, company): The legally registered name of your organization/company.
Organizational Unit Name (eg, section): The division of your organization handling the certificate.
Common Name (e.g. server FQDN or YOUR name): The fully qualified domain name (FQDN) for your server. In your case, you would enter mysite.local.
Email Address: An email address where you can be contacted.
A challenge password & optional company name: You can leave these blank for a CSR.
Review the CSR:
# Once you have generated the CSR, you may want to review it to ensure all information is correct.
openssl req -text -noout -verify -in mysite.local.csr
# This command will display the contents of the CSR in a human-readable format.
# Submit the CSR:
# For a private domain like mysite.local, you would typically use a self-signed certificate or a private Certificate Authority (CA) since public CAs cannot issue certificates for .local domains.
# If you have a private CA, submit the CSR to your CA according to their process.
# Create a self-signed certificate (if not using a CA):
# If you're using the certificate for internal purposes and do not have a private CA, you can create a self-signed certificate with the following command:
openssl x509 -signkey mysite.local.key -in mysite.local.csr -req -days 365 -out mysite.local.crt
# This will create a certificate file named mysite.local.crt that is valid for 365 days.
# Remember to replace mysite.local with your actual private domain name, and make sure to store your private key and CSR in a secure location. The private key should never be shared or transmitted insecurely.