Created
August 27, 2017 21:29
-
-
Save keshihoriuchi/052ea79e39fa257cccebbc7d87230648 to your computer and use it in GitHub Desktop.
CA用ファイル作成
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
#!/bin/bash | |
# Ubuntuデフォルトの/etc/ssl/openssl.cnf 前提。ベースは/usr/lib/ssl/misc/CA.sh | |
set -ex | |
CATOP="./demoCA" | |
mkdir ${CATOP} | |
mkdir -p ${CATOP}/certs | |
mkdir -p ${CATOP}/crl | |
mkdir -p ${CATOP}/newcerts | |
mkdir -p ${CATOP}/private | |
touch ${CATOP}/index.txt | |
openssl genrsa -out ${CATOP}/private/cakey.pem 2048 | |
openssl req -new \ | |
-key ${CATOP}/private/cakey.pem \ | |
-out ${CATOP}/careq.pem \ | |
-subj "/C=JP/ST=Tokyo/L=Chiyoda/O=Example Company/CN=example.com" | |
openssl ca -create_serial -out ${CATOP}/cacert.pem -days 3650 -batch \ | |
-keyfile ${CATOP}/private/cakey.pem -selfsign \ | |
-extensions v3_ca \ | |
-infiles ${CATOP}/careq.pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment