From 1b2538fdc3e546c8f44eabbde75e55dd0ec3683f Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Sat, 7 Sep 2024 23:22:38 -0500 Subject: [PATCH] Add Security/csr.sh --- Security/csr.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Security/csr.sh 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