gen.sh 1.1 KB

123456789101112131415161718192021222324
  1. Country="CN"
  2. State="Shanghai"
  3. Location="Shanghai"
  4. Organization="milvus"
  5. Organizational="milvus"
  6. CommonName="localhost"
  7. echo "generate ca.key"
  8. openssl genrsa -out ca.key 2048
  9. echo "generate ca.pem"
  10. openssl req -new -x509 -key ca.key -out ca.pem -days 3650 -subj "/C=$Country/ST=$State/L=$Location/O=$Organization/OU=$Organizational/CN=$CommonName"
  11. echo "generate server SAN certificate"
  12. openssl genpkey -algorithm RSA -out server.key
  13. openssl req -new -nodes -key server.key -out server.csr -days 3650 -subj "/C=$Country/O=$Organization/OU=$Organizational/CN=$CommonName" -config ./openssl.cnf -extensions v3_req
  14. openssl x509 -req -days 3650 -in server.csr -out server.pem -CA ca.pem -CAkey ca.key -CAcreateserial -extfile ./openssl.cnf -extensions v3_req
  15. echo "generate client SAN certificate"
  16. openssl genpkey -algorithm RSA -out client.key
  17. openssl req -new -nodes -key client.key -out client.csr -days 3650 -subj "/C=$Country/O=$Organization/OU=$Organizational/CN=$CommonName" -config ./openssl.cnf -extensions v3_req
  18. openssl x509 -req -days 3650 -in client.csr -out client.pem -CA ca.pem -CAkey ca.key -CAcreateserial -extfile ./openssl.cnf -extensions v3_req