Skip to content

Commit

Permalink
feat: vanity url helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekRoberts committed Mar 14, 2024
1 parent 0fd1247 commit a5e94a0
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,9 @@ test-report.xml

# VSCode
.vscode/

# Certificates
support/*.csr
support/*.key
*.csr
*.key
68 changes: 68 additions & 0 deletions support/custom_url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/sh
set -euo nounset

# Custom Domain Helper
#
# Usage: ./custom_url.sh [optional: DOMAIN]

# Sorry, internal! - https://apps.nrs.gov.bc.ca/int/confluence/display/DEVGUILD/Generating+a+CSR
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent


### Get inputs

# Vanity URL (DOMAIN)
if [[ -z "${1:-}" ]]; then
echo "Enter the fully qualified domain name (FQDN) name for the certificate:"
read DOMAIN
else
DOMAIN="${1}"
fi
echo -e "\nDomain: ${DOMAIN}"

# Default subject
SUBJECT="/C=CA/ST=British Columbia/L=Victoria/O=Government of the Province of British Columbia/CN=${DOMAIN}"
echo -e "\nSubject: $SUBJECT"

# Accept or create a new subject
echo "Accept subject? (y/n)"
read ACCEPT
if [[ "${ACCEPT^}" != "Y" ]]; then
echo "Subject: " && read SUBJECT
fi

# Generate the key and csr
openssl req -new -newkey rsa:2048 -nodes -keyout ${DOMAIN}.key -out ${DOMAIN}.csr -subj "${SUBJECT}"
echo -e "The following have been created:"
ls -l ${DOMAIN}.{csr,key}

echo ""
echo "BC Gov Natural Resources Only! ---"
echo ""
echo "Create a JIRA issue:"
echo ""
echo "- Project: Service Desk (SD)"
echo "- Issue Type: Service Request"
echo "- Title: SSL Certificate Request for ${DOMAIN}"
echo "- Summary: SSL Certificate Request for ${DOMAIN}"
echo "- Component/s: Other - N/A - Not Applicable"
echo "- Assignee: NRIDS Infrastructure and Middle Tier WLRS:EX"
echo "- Teams Involved: Tier 3 - Infrastructure"
echo "- Description: "
echo " Please create an SSL certificate for: ${DOMAIN}"
echo ""
echo " iStore billing codes ---"
echo " - Client:"
echo " - Responsibility:"
echo " - Service Line:"
echo " - Project:"
echo " - Expense Authority:"
echo ""
echo "- Attach the newly generated CSR file only"

# Open JIRA - optional
echo -e "\nWould you like to be redirected to Natural Resources JIRA? (y/n)"
read ACCEPT
if [[ "${ACCEPT^}" == "Y" ]]; then
xdg-open 'https://apps.nrs.gov.bc.ca/int/jira/secure/CreateIssue!default.jspa'
fi

0 comments on commit a5e94a0

Please sign in to comment.