23 lines
812 B
Bash
23 lines
812 B
Bash
#!/bin/bash
|
|
|
|
# Ask the user for their organizational information
|
|
echo "Enter the name of your organization:"
|
|
read -p "Organization Name: " orgName
|
|
|
|
echo "Enter the city, state, and country where your organization is located:"
|
|
read -p "Location: " location
|
|
|
|
echo "Enter the organizational email address:"
|
|
read -p "Email Address: " orgEmail
|
|
|
|
# Generate the CSR
|
|
openssl req -x509 -nodes -days 365 -out csr.pem -newkey rsa:2048 -keyout key.pem -out fi.pem
|
|
|
|
# Extract the private key from the key file
|
|
openssl rsa -in key.pem -out key.txt
|
|
|
|
# Replace the placeholders in the CSR with the actual values
|
|
cat csr.pem | sed "s/oldOrgName/$orgName/" | sed "s/oldLocation/$location/" | sed "s/oldEmailAddress/$orgEmail/" > newCSR.pem
|
|
|
|
# Remove the placeholder values from the private key
|
|
openssl rsa -in key.txt -out key.txt |