Skip to content

Commit da7c0d5

Browse files
authored
Update generate-p12.sh
1. Added Option to parse in the npm value (I.E. npm-10) as a required variable which is the npm value that the certificate files are stored in (I.E. '/etc/letsencrypt/live/npm-10/' and '/etc/letsencrypt/archive/npm-10/' ) 2. Added the option to parse a password into the script to be used as the p12 password for securing the private key within the generated PKCS12 file. 3. Added Variable in script to allow the user to keep the root certificate that the script generates ($KEEP_ROOT_CERTIFICATE which it is set to true by default). 4. Added Simlinks for the .p12 file (follows the current convention) 5. Added Simlink for the root certificate, if the user chooses to keep the root certificate by setting the variable $KEEP_ROOT_CERTIFICATE to true (follows the current convention) 6. Added automatic cleanup for temporary files as well as the root file when the variable $KEEP_ROOT_CERTIFICATE is set to false. 7. Changed Print Help Text to use echo command.
1 parent 00a5008 commit da7c0d5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

backend/scripts/generate-p12.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
SCRIPT_NAME="$(basename "$0")"
66

77
print_help() {
8-
cat <<EOF
9-
Usage: $SCRIPT_NAME --npm <name> [--password <password>]
8+
echo -e "\nUsage: $SCRIPT_NAME --npm <name> [--password <password>]
109
1110
Options:
12-
--npm <name> Required. Name or identifier used for the certificate. Must be in the form "npm-#"
11+
--npm <name> Required. Name or identifier used for the certificate. Must be in the form 'npm-#'
1312
--password <string> Optional. Password to secure the PKCS#12 (.p12) file. If not provided the scipt will use the script default.
1413
-h, --help Show this help message and exit.
1514
1615
Example:
1716
./$SCRIPT_NAME --npm npm-123
1817
./$SCRIPT_NAME --npm npm-123 --password secret123
19-
EOF
18+
"
2019
}
2120

2221
# Initialize Required Input variables
@@ -25,7 +24,7 @@ PKCS12_PASSWORD=""
2524

2625
# Exit early and show help if no arguments were provided
2726
if [[ $# -eq 0 ]]; then
28-
echo -e "\nERROR - No arguments provided.\n"
27+
echo -e "\n\nERROR - No arguments provided."
2928
print_help
3029
exit 1
3130
fi

0 commit comments

Comments
 (0)