-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73dbc41
commit 01ffbeb
Showing
2 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
|
||
IP=$(echo $1 | egrep -o "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$") | ||
|
||
if [ ! $IP ] | ||
then | ||
echo "Usage: generate-ip-cert.sh 127.0.0.1" | ||
exit 1 | ||
fi | ||
|
||
echo "[req] | ||
default_bits = 2048 | ||
distinguished_name = req_distinguished_name | ||
req_extensions = req_ext | ||
x509_extensions = v3_req | ||
prompt = no | ||
[req_distinguished_name] | ||
countryName = XX | ||
stateOrProvinceName = N/A | ||
localityName = N/A | ||
organizationName = Self-signed certificate | ||
commonName = $IP: Self-signed certificate | ||
[req_ext] | ||
subjectAltName = @alt_names | ||
[v3_req] | ||
subjectAltName = @alt_names | ||
[alt_names] | ||
IP.1 = $IP | ||
" > san.cnf | ||
|
||
openssl req -x509 -nodes -days 730 -newkey rsa:2048 -keyout key.pem -out cert.pem -config san.cnf | ||
rm san.cnf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters