#!/bin/bash ##mkdir cert_root cd ./cert_root ## Gen Key #openssl genrsa -out rootCAKey.pem 2048 ## Gen CA Cert ##openssl req -x509 -extensions v3_ca -key rootCAKey.pem -new -nodes -out rootCA.pem -days 3650 -subj "/C=IL/ST=North/L=Acre/O=Dr Frucht Ltd/OU=R&D Dep./CN=Evgeny Gagua/emailAddress=evgeny_g@smartsecsystems.com" -passout pass:123456 ## Gen Web CERT ##openssl req -x509 -sha256 -new -nodes -key rootCAKey.pem -days 3650 -out rootCACert.pem -multivalue-rdn -subj "/C=IL/ST=North/L=Acre/O=Dr. Frucht Ltd./OU=R&D Department/emailAddress=evgeny_g@smartsecsystems.com//DC=org/DC=OpenSSL/DC=users/UID=123456+CN=10.0.0.1+CN=192.168.200.121" ##openssl req -x509 -sha256 -new -nodes -key rootCAKey.pem -days 3650 -out rootCACert.pem -issuer "/CN=DRFRU" -subj "/C=IL/ST=North/L=Acre/O=Dr. Frucht Ltd./OU=R&D Department/emailAddress=evgeny_g@smartsecsystems.com/CN=Argus Sensor Module/subjectAltName=IP.1=10.0.0.1,IP.2=192.168.200.121" ##openssl req -x509 -sha256 -new -nodes -key rootCAKey.pem -days 3650 -out rootCACert.pem -subj "/C=IL/ST=North/L=Acre/O=Dr. Frucht Ltd./OU=R&D Department/emailAddress=evgeny_g@smartsecsystems.com/CN=Argus Sensor Module/subjectAltName=IP.1=10.0.0.1,IP.2=192.168.200.121" ##openssl req -x509 -sha256 -new -nodes -key rootCAKey.pem -days 3650 -out rootCACert.pem ##openssl req -x509 -sha256 -verbose -config cert.conf -extensions req_ext -new -nodes -key rootCAKey.pem -days 3650 -out webCert.pem #openssl req -sha256 -verbose -config cert.conf -extensions req_ext -new -nodes -key rootCAKey.pem -out rootCA.csr ##review Cert ##openssl x509 -in rootCA.pem -text -noout #openssl x509 -signkey rootCAKey.pem -in rootCA.csr -req -days 3650 -out rootCA.crt #openssl x509 -in rootCA.crt -text -noout ##openssl x509 -in rootCACert.pem -out rootCACert.crt ## Next step took 8 hours on ATOM ##openssl dhparam -out dhparam.pem 4096 #Generating Domain Cert # Don't Gen Host Key!!! -> All systems have same key! #openssl genrsa -out domain.key 2048 openssl req -sha256 -verbose -config dom.conf -extensions req_ext -new -nodes -key domain.key -out domain.csr openssl x509 -req -CA rootCA.crt -CAkey rootCAKey.pem -in domain.csr -out domain.crt -days 365 -CAcreateserial -extfile dom.conf -extensions req_ext #Generating Backup Cert #openssl genrsa -out back.key 2048 #openssl req -sha256 -verbose -config back.conf -extensions req_ext -new -nodes -key back.key -out back.csr #openssl req -verbose -config back.conf -new -key back.key -out back.csr #openssl req -new -config back.conf -keyout back.key -out back.csr #openssl x509 -req -CA rootCA.crt -CAkey rootCAKey.pem -in back.csr -out back.crt -days 365 -CAcreateserial #-extfile back.conf openssl x509 -text -noout -in domain.crt -certopt no_header,no_version,no_serial,no_signame,no_validity,no_issuer,no_pubkey,no_sigdump,no_aux #### openssl verify -verbose -CAfile rootCA.crt domain.crt #### openssl x509 -ext subjectAltName -noout -in domain.crt