FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
fhscripts:create:create_ssl_csr_key.sh.html [2017/12/31 23:38] kurihara |
fhscripts:create:create_ssl_csr_key.sh.html [2018/03/29 00:06] (current) kurihara |
||
---|---|---|---|
Line 1: | Line 1: | ||
[[: | [[: | ||
- | ====== | + | ====== |
- | $FHHOME/fhscripts/ | + | $FHHOME/bin/ |
{{INLINETOC}} | {{INLINETOC}} | ||
\\ | \\ | ||
+ | ===== What is create_ssl_csr_key.sh ===== | ||
+ | *Creating SSL CSR and Key | ||
- | ===== How to use ===== | + | ==WARNING== |
+ | If you want to create a Self-Signed CSR, you must use create_sslsan_csr_key.sh . | ||
+ | Because from Chrome 58 onwards, you must use SSL SAN. | ||
+ | <WRAP box 90%> | ||
+ | Related Script | ||
+ | *[[fhscripts: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== How to use create_ssl_csr_key.sh | ||
<sxh bash toolbar: | <sxh bash toolbar: | ||
$ create_ssl_csr_key.sh | $ create_ssl_csr_key.sh | ||
$ create_ssl_csr_key.sh | $ create_ssl_csr_key.sh | ||
</ | </ | ||
+ | |||
+ | == Example Output == | ||
+ | |||
+ | <sxh bash toolbar: | ||
+ | $ create_ssl_csr_key.sh 192.168.0.15 | ||
+ | Generating a 2048 bit RSA private key | ||
+ | ....................................+++ | ||
+ | .....+++ | ||
+ | writing new private key to ' | ||
+ | ----- | ||
+ | ========================================================== | ||
+ | Check | ||
+ | ========================================================== | ||
+ | |||
+ | # ls -lh 192.168.0.15* | ||
+ | -rw-r--r-- 1 root root 1013 Dec 19 01:02 192.168.0.15.csr | ||
+ | -rw-r--r-- 1 root root 1.7K Dec 19 01:02 192.168.0.15.key | ||
+ | |||
+ | #openssl req -text -in 192.168.0.15.csr |grep " | ||
+ | Subject: C=JP, ST=Tokyo, L=Shibuya-ku, | ||
+ | |||
+ | </ | ||
+ | |||
Line 17: | Line 51: | ||
===== create_ssl_csr_key.sh ===== | ===== create_ssl_csr_key.sh ===== | ||
- | $FHHOME/fhscripts/ | + | $FHHOME/bin/ |
<sxh bash toolbar: | <sxh bash toolbar: | ||
Line 25: | Line 59: | ||
# | # | ||
# How to use | # How to use | ||
- | # create_csr_key.sh example.com | + | # create_ssl_csr_key.sh example.com |
- | # create_csr_key.sh 192.168.0.10 | + | # create_ssl_csr_key.sh 192.168.0.10 |
# | # | ||
if [ -z $1 ]; then | if [ -z $1 ]; then | ||
- | echo 'ERROR: | + | cat << @ |
- | echo 'How to use:' | + | ERROR: |
- | echo 'create_csr_key.sh 192.168.0.10' | + | How to use: |
- | exit 1 | + | create_csr_key.sh 192.168.0.10 |
+ | @ | ||
+ | exit 1 | ||
fi | fi | ||
Line 42: | Line 78: | ||
OU=" | OU=" | ||
CN=" | CN=" | ||
+ | |||
+ | |||
+ | test -f ${CN}.csr && mv ${CN}.csr ${CN}.csr.`date +%Y%m%d_%H%M` | ||
+ | test -f ${CN}.key && mv ${CN}.key ${CN}.key.`date +%Y%m%d_%H%M` | ||
openssl req -new -newkey rsa:2048 -nodes -out ${CN}.csr -keyout ${CN}.key -sha256 -subj "/ | openssl req -new -newkey rsa:2048 -nodes -out ${CN}.csr -keyout ${CN}.key -sha256 -subj "/ | ||
Line 50: | Line 90: | ||
========================================================== | ========================================================== | ||
- | # ls -lh | + | # ls -ltrh |
- | `ls -lh ${CN}*` | + | `ls -ltrh ${CN}* |
#openssl req -text -in ${CN}.csr |grep " | #openssl req -text -in ${CN}.csr |grep " | ||
Line 59: | Line 99: | ||
</ | </ | ||
- | \\ | ||
- | ===== Example Output ===== | ||
- | <sxh bash toolbar: | + | \\ |
- | $ create_ssl_csr_key.sh 192.168.0.15 | + | \\ |
- | Generating a 2048 bit RSA private key | + | <WRAP box 90%> |
- | ....................................+++ | + | < |
- | .....+++ | + | </WRAP> |
- | writing new private key to ' | + | |
- | ----- | + | |
- | ========================================================== | + | |
- | Check | + | |
- | ========================================================== | + | |
- | + | ||
- | # ls -lh 192.168.0.15* | + | |
- | -rw-r--r-- 1 root root 1013 Dec 19 01:02 192.168.0.15.csr | + | |
- | -rw-r--r-- 1 root root 1.7K Dec 19 01:02 192.168.0.15.key | + | |
- | + | ||
- | #openssl req -text -in 192.168.0.15.csr |grep " | + | |
- | Subject: C=JP, ST=Tokyo, L=Shibuya-ku, | + | |
- | + | ||
- | </sxh> | + | |
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.