#!/bin/sh
# this script can make certificate of each line in file you point which one!
if [ $# -ne 1 ];then
echo -e "\033[33m Input your domain's file \033[0m"
exit 1
fi
for line in `cat $1`
do
hostname=$line
line="`echo $line|awk -F" " '{print $1}'`.key"
echo "==$line=="
echo -e "\n\n\033[32m Make certificate of $line \033[0m\n\n"
csr_file=`echo $line|awk -F".key" '{print $1}'`
expect -c "
set timeout 20;
spawn openssl genrsa -des3 -out $line 2048
expect {
: {send 12345678\r;exp_continue}
: {send 12345678\r;}
} spawn openssl rsa -in $line -out $line
expect {
\"Enter pass phrase\" {send 12345678\r;exp_continue}
} spawn openssl req -new -key $line -out $csr_file.csr
expect {
\"Enter pass phrase\" {send 12345678\r;exp_continue}
\"Country Name\" {send CN\r;exp_continue}
\"State or Province Name\" {send Beijing\r;exp_continue}
\"Locality Name\" {send Beijing\r;exp_continue}
\"Organization Name\" {send \"Beijing Yuanxin Technology Co., Ltd.\r\";exp_continue}
\"Organizational Unit Name\" {send \"Beijing Yuanxin Technology Co., Ltd.\r\";exp_continue}
\"Common Name*\" {send \"$hostname\r\";exp_continue}
\"Email Address\" {send \r;exp_continue}
\"A challenge password\" {send 12345678\r;exp_continue}
\"An optional company name\" {send \"Beijing Yuanxin Technology Co., Ltd\r\";exp_continue}
}"
done

证书脚本--生成csr,key的更多相关文章

  1. SSL证书请求文件(CSR)生成指南 - Tomcat

    SSL证书请求文件(CSR)生成指南 - Tomcat http://www.zhenssl.com/support/CSRgen/tomcat_CSR.htm   重要注意事项 An Importa ...

  2. 使用OpenSSL生成CSR文件,并申请全球通用SSL证书

    http://www.openssl.org 上只有OpenSSL的原代码下载,为了方便Windows用户使用OpenSSL,我们特地为您准备了OpenSSL 0.9.8.a for win32的可执 ...

  3. linux服务器上生成CSR和KEY

    CSR表示“ 证书签名请求 ”,这个该证书将用于服务器上.一个CSR包含有关您的组织和域名,地方和国家,将包含在证书中的公钥信息. 本文有3个简单的步骤来创建CSR上的Linux系统(证书签名请求). ...

  4. linux下使用openssl生成 csr crt CA证书

    证书文件生成:一.服务器端1.生成服务器端    私钥(key文件);openssl genrsa -des3 -out server.key 1024运行时会提示输入密码,此密码用于加密key文件( ...

  5. SSL证书的生成

    openssl工具下载路径:链接:https://pan.baidu.com/s/1o0-s8OplHZt55Cio2HmjVA 密码:u759 1.使用openssl工具生成一个RSA秘钥      ...

  6. openssl 生成CSR

    openssl 生成CSR 2013-12-27 15:05 3699人阅读 评论(1) 收藏 举报  分类: Security(38)  C/C++(105)  版权声明:本文为博主原创文章,未经博 ...

  7. SSL证书的生成方法

    在Linux下,我们进行下面的操作前都须确认已安装OpenSSL软件包. 1.创建根证书密钥文件root.key: [root@mrlapulga:/etc/pki/CA/private]#opens ...

  8. iOS最新企业证书的生成

     PS:不知道什么原因  图片显示不出来 请看我简书里面的文章 http://www.jianshu.com/p/baab03ac43e9 1.生成CSR文件 SpotLight搜索>钥匙串访问 ...

  9. Https系列之一:https的简单介绍及SSL证书的生成

    Https系列会在下面几篇文章中分别作介绍: 一:https的简单介绍及SSL证书的生成二:https的SSL证书在服务器端的部署,基于tomcat,spring boot三:让服务器同时支持http ...

随机推荐

  1. 【leetcode刷题笔记】Median of Two Sorted Arrays

    There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted ...

  2. Android L 64位兼容32 应用程序的认识

    http://blog.csdn.net/louyong0571/article/details/44223481 关于Android L 64位系统兼容32位应用的实现的简单分析. Android ...

  3. 混淆Android JAR包的方法

    http://blog.csdn.net/vurtne_ye/article/details/35599491 1)导出jar包 如何在eclipse上Android工程中导出jar包?google, ...

  4. Mysql 主从复制搭建

    Mysql 主重复制搭建 Linux版本:Linux Centos 6.4 32位 Mysql版本:Mysql-5.6.38-linux-glibc2.12-i686 Mysql安装:Mysql安装教 ...

  5. java图形验证码

    用java实现验证码的生成,以下代码是一个controller,可以直接使用 package org.jxnd.tongxuelu.controller; import java.awt.Color; ...

  6. Service Meth and SideCar

    本文转自:http://philcalcado.com/2017/08/03/pattern_service_mesh.html SideCar: SideCar就是与Application一起运行的 ...

  7. 多校hdu5754(博弈)

    ©此题中在N×M的棋盘中从(1,1)走到(N,M)B先走G后走,谁先到(N,M)谁赢,走法分为4中分别是国际象棋中的国王,车,马,王后的发,在四种走法下谁能赢: 我们依次分析每一种棋子. ①王. 首先 ...

  8. Elasticsearch6.4.3安装

    Linux内存一定要1g以上! 首先要有jdk环境 要求1.8版本以上   elasticsearch是Java写的 将上传的 elasticSearch安装包解压 cd /home/elastics ...

  9. Bluetooth Profile for iPhone from the functional perspectives

    Classic Bluetooth Profile for iPhone from the functional perspectives Function Description BT Profil ...

  10. hadoop hdfs java api操作

    package com.duking.util; import java.io.IOException; import java.util.Date; import org.apache.hadoop ...