diff --git a/Security/csr.sh b/Security/csr.sh new file mode 100644 index 0000000..1b247fd --- /dev/null +++ b/Security/csr.sh @@ -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 \ No newline at end of file