FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


fhscripts:create:create_ssl_csr_key.sh.html



Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
fhscripts:create:create_ssl_csr_key.sh.html [2017/12/15 01:04]
kurihara
fhscripts:create:create_ssl_csr_key.sh.html [2018/02/28 01:27]
kurihara
Line 1: Line 1:
-~~NOTOC~~ 
 [[:index.html#FastHandle Scripts|FastHandle Scripts]] [[:index.html#FastHandle Scripts|FastHandle Scripts]]
-====== create_csr_key.sh ======+====== Script for Creating SSL CSR and Key with one-line======
  
 +$FHHOME/fhscripts/create_ssl_csr_key.sh
  
-===== How to use =====+{{INLINETOC}} 
 +\\ 
 +===== What is create_ssl_csr_key.sh ===== 
 +  *Creating SSL CSR and Key 
 + 
 +==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:create:create_sslsan_csr_key.sh.html|]] 
 +</WRAP> 
 + 
 + 
 +===== How to use create_ssl_csr_key.sh =====
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
-check_rootpass.exp  192.168.0.10  'PASSWORD'+create_ssl_csr_key.sh  example.com 
 +$ create_ssl_csr_key.sh  192.168.0.10
 </sxh> </sxh>
 +
 +== Example Output ==
 +
 +<sxh bash toolbar:false gutter:false>
 +$ create_ssl_csr_key.sh 192.168.0.15
 +Generating a 2048 bit RSA private key
 +....................................+++
 +.....+++
 +writing new private key to '192.168.0.15.key'
 +-----
 +==========================================================
 +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:"
 +        Subject: C=JP, ST=Tokyo, L=Shibuya-ku, O=Example, Inc., OU=IT, CN=192.168.0.15
 +
 +</sxh>
 +
  
  
 \\ \\
-===== Script =====+===== create_ssl_csr_key.sh ===== 
 + 
 +$FHHOME/fhscripts/create_ssl_csr_key.sh
  
 <sxh bash toolbar:false gutter:false> <sxh bash toolbar:false gutter:false>
 #!/bin/bash #!/bin/bash
 #=============================================== #===============================================
-create_csr_key.sh+create_ssl_csr_key.sh
 # #
 # 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:  $1 argument is null' +cat << @ 
-    echo 'How to use:' +ERROR: \$1 argument is null 
-    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 36: Line 78:
 OU="IT" OU="IT"
 CN="$1" CN="$1"
 +
 +
 +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 "/C=${C}/ST=${ST}/L=${L}/O=${O}/OU=${OU}/CN=${CN}" openssl req -new -newkey rsa:2048 -nodes -out ${CN}.csr -keyout ${CN}.key -sha256 -subj "/C=${C}/ST=${ST}/L=${L}/O=${O}/OU=${OU}/CN=${CN}"
Line 43: Line 89:
 Check Check
 ========================================================== ==========================================================
-# ls -lh  ${CN}* + 
-`ls -lh ${CN}*`+# ls -ltrh  ${CN}* |tail -n 2 
 +`ls -ltrh ${CN}* |tail -n 2`
  
 #openssl req -text -in ${CN}.csr |grep "Subject:" #openssl req -text -in ${CN}.csr |grep "Subject:"
Line 52: Line 99:
 </sxh> </sxh>
  
-\\ 
-===== Example Output ===== 
  
-<sxh bash toolbar:false gutter:false+\\ 
-$ create_csr_key.sh 192.168.0.15 +\\ 
-Generating a 2048 bit RSA private key +<WRAP box 90%
-....................................................+++ +<catlist ..-noAddPageButton -smallHead -sortAscending  -sortAscending
-......................................+++ +</WRAP>
-writing new private key to '192.168.0.15.key' +
------ +
-========================================================== +
-Check +
-========================================================== +
-# ls -lh  192.168.0.15* +
--rw-rw-r-- 1 fasthandle fasthandle 1013 12月 15 01:03 192.168.0.15.csr +
--rw-rw-r-- 1 fasthandle fasthandle 1.7K 12月 15 01:03 192.168.0.15.key +
- +
-#openssl req -text -in 192.168.0.15.csr |grep "Subject:" +
-        Subject: C=JP, ST=Tokyo, L=Shibuya-ku, O=Example, Inc., OU=IT, CN=192.168.0.15 +
- +
-===== Script ===== +
-<sxh bash toolbar:false gutter:false> +
- +
-</sxh>+
  


fhscripts/create/create_ssl_csr_key.sh.html.txt · Last modified: 2018/03/29 00:06 by kurihara