FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

fhscripts:create:create_ssl_csr_key.sh.html



This is an old revision of the document!



FastHandle Scripts

create_csr_key.sh

How to use

$ create_csr_key.sh  example.com
$ create_csr_key.sh  192.168.0.10


Script

#!/bin/bash
#===============================================
# create_csr_key.sh
#
# How to use
#     create_csr_key.sh  example.com
#     create_csr_key.sh  192.168.0.10
#===============================================

if [ -z $1 ]; then
    echo 'ERROR:  $1 argument is null'
    echo 'How to use:'
    echo 'create_csr_key.sh 192.168.0.10'
    exit 1
fi

C="JP"
ST="Tokyo"
L="Shibuya-ku"
O="Example, Inc."
OU="IT"
CN="$1"

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}"

cat << @
==========================================================
Check
==========================================================

# ls -lh  ${CN}*
`ls -lh ${CN}*`

#openssl req -text -in ${CN}.csr |grep "Subject:"
`openssl req -text -in ${CN}.csr |grep "Subject:"`

@


Example Output

$ create_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



fhscripts/create/create_ssl_csr_key.sh.html.1513613018.txt.gz ยท Last modified: 2017/12/19 01:03 by kurihara