Skip to content

Commit

Permalink
Merge pull request #8 from lil5/patch-#7
Browse files Browse the repository at this point in the history
Add alt ip addresses
  • Loading branch information
cytopia authored Dec 8, 2018
2 parents 52fc698 + 80defb1 commit 52dbf6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Optional arguments
-u OU Subject organizational unit (OU)
-e Email Subject email (emailAddress)
-a names Comma separated list of alt names (subjectAltName)
-i ips Comma separated list of alt ip addresses (subjectAltName)
-v Verbose output

Required parameter
Expand Down
14 changes: 14 additions & 0 deletions bin/cert-gen
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ DEF_EMAIL=

# v3 subject alt names
DEF_ALT_NAME=
DEF_ALT_IP_NAME=

# Verbosity
DEF_VERBOSE=
Expand All @@ -46,6 +47,7 @@ print_help() {
echo " -u OU Subject organizational unit (OU)"
echo " -e Email Subject email (emailAddress)"
echo " -a names Comma separated list of alt names (subjectAltName)"
echo " -i ips Comma separated list of alt ip addresses (subjectAltName)"
echo " -v Verbose output"
echo
echo "Required parameter"
Expand Down Expand Up @@ -128,6 +130,11 @@ while [ ${#} -gt 0 ]; do
DEF_ALT_NAME="${1}"
shift
;;
-i)
shift
DEF_ALT_IP_NAME="${1}"
shift
;;
# ---- Stop here
--) # End of all options
shift
Expand Down Expand Up @@ -215,6 +222,13 @@ if [ -n "${DEF_ALT_NAME}" ]; then
done
fi

i=1
if [ -n "${DEF_ALT_IP_NAME}" ]; then
for cn in ${DEF_ALT_IP_NAME//,/ }; do
ALT_NAMES="${ALT_NAMES},IP.${i}:${cn}"
done
fi

###
### Build commands
###
Expand Down

0 comments on commit 52dbf6e

Please sign in to comment.