Customizing SSL certificates

Source: Internet
Author: User
Tags openssl openssl rsa openssl x509 ssl certificate
#!/bin/sh


# Create self-signed server certificate:


Read-p "Enter your domain [www.example.com]:" Domain


echo "Create root certificate key with password ..."


OpenSSL genrsa-des3-out $DOMAIN. Root.key 2048


echo "Create root certificate Signing request ..."
Org= "Wenxiaoyou (Beijing) Technology,co.,ltd"
subject= "/c=cn/st=beijing/l=beijing/o= $ORG/ou=itdept./cn= $DOMAIN"


OpenSSL req-new-subj $SUBJECT-key $DOMAIN. Root.key-out $DOMAIN. ROOT.CSR


echo "Remove password ..."


OpenSSL rsa-in $DOMAIN. Root.key-out $DOMAIN. Key


echo "Create server certificate signing request ..."
OpenSSL req-new-subj $SUBJECT-key $DOMAIN. Key-out $DOMAIN. SERVER.CSR


echo "Sign SSL Certificate ..."


OpenSSL x509-req-days 3650-in $DOMAIN. Root.csr-signkey $DOMAIN. Root.key-out $DOMAIN. root.crt
OpenSSL x509-req-days 3650-ca $DOMAIN. Root.crt-cakey $DOMAIN. key-cacreateserial-in $DOMAIN. server.csr-out $DOMAIN. S Erver.crt


echo "TODO:"
echo "Copy $DOMAIN. CRT to/etc/nginx/ssl/$DOMAIN. CRT"
echo "Copy $DOMAIN. Key to/etc/nginx/ssl/$DOMAIN. Key"
echo "ADD configuration in Nginx:"
echo "Server {"
echo "..."
echo "Listen 443 SSL;"
echo "ssl_certificate/etc/nginx/ssl/$DOMAIN. crt;"
echo "ssl_certificate_key/etc/nginx/ssl/$DOMAIN. Key;"
echo "}"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.