Compare Page Revisions
« Older Revision - Back to Page History - Newer Revision »
HOSTNAME
ROOTCA
SET HOSTNAME=PublicDnsOfServer SET ROOTCA=MyRootCA
HOSTNAME='PublicDnsOfServer' ROOTCA='MyRootCA' export HOSTNAME export ROOTCA
mkdir %ROOTCA% cd %ROOTCA%
mkdir $ROOTCA cd $ROOTCA
openssl genrsa -out %ROOTCA%.key 2048 openssl rsa -in %ROOTCA%.key -out %ROOTCA%.key
openssl genrsa -out $ROOTCA.key 2048 openssl rsa -in $ROOTCA.key -out $ROOTCA.key
openssl req -x509 -new -key %ROOTCA%.key -days 365 -out %ROOTCA%.crt
openssl req -x509 -new -key $ROOTCA.key -days 365 -out $ROOTCA.crt
type %ROOTCA%.crt %ROOTCA%.key > %ROOTCA%.pem
cat $ROOTCA.crt $ROOTCA.key > $ROOTCA.pem
mkdir %HOSTNAME% CD %HOSTNAME%
mkdir $HOSTNAME cd $HOSTNAME
openssl genrsa -out %HOSTNAME%.key 2048 openssl rsa -in %HOSTNAME%.key -out %HOSTNAME%.key
openssl genrsa -out $HOSTNAME.key 2048 openssl rsa -in $HOSTNAME.key -out $HOSTNAME.key
openssl req -new -key %HOSTNAME%.key -out %HOSTNAME%.csr
openssl req -new -key $HOSTNAME.key -out $HOSTNAME.csr
%HOSTNAME%
$HOSTNAME
openssl x509 -req -in %HOSTNAME%.csr -CA ..\%ROOTCA%\%ROOTCA%.crt -CAkey ..\%ROOTCA%\%ROOTCA%.key -CAcreateserial -out %HOSTNAME%.crt -days 365
openssl x509 -req -in $HOSTNAME.csr -CA ../$ROOTCA/$ROOTCA.crt -CAkey ../$ROOTCA/$ROOTCA.key -CAcreateserial -out $HOSTNAME.crt -days 365
openssl verify -CAfile ..\%ROOTCA%\%ROOTCA%.crt %HOSTNAME%.crt
openssl verify -CAfile ../$ROOTCA/$ROOTCA.crt $HOSTNAME.crt
HOSTNAME.crt: OK
type %HOSTNAME%.crt %HOSTNAME%.key > %HOSTNAME%.pem
cat $HOSTNAME.crt $HOSTNAME.key > $HOSTNAME.pem
/home/ec2-user
MyRootCA.crt
MyMongoServer.com.pem
cd /etc/ssl mv /home/ec2-user/$ROOTCA.crt . mv /home/ec2-user/$HOSTNAME.pem .
chown root:root $ROOTCA.crt chown root:root $HOSTNAME.pem
/etc/mongod.conf
net:
ssl: mode: requireSSL PEMKeyFile: /etc/ssl/MyMongoServer.com.pem CAFile: /etc/ssl/MyRootCA.com.crt
cat /etc/mongod.conf | grep ssl
service mongod status service mongod stop service mongod status service mongod start service mongod status
mongo --ssl --sslCAFile "/etc/ssl/$ROOTCA.crt" --sslPEMKeyFile "/etc/ssl/$HOSTNAME.pem" --host $HOSTNAME -u root admin -p
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.