Add Security/csr.sh

This commit is contained in:
Matthew Fisher 2024-09-07 23:22:38 -05:00
parent faa69c5f46
commit 1b2538fdc3

23
Security/csr.sh Normal file
View File

@ -0,0 +1,23 @@
#!/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