#!/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刷题笔记】4Sum

    Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = tar ...

  2. JSP笔记02——概述(转)

    不完全翻译,结合谷歌,一定主观性,还可能有误,原始内容地址:https://www.tutorialspoint.com/jsp/jsp_overview.htm 主要内容如下: 什么是JSP? 为什 ...

  3. [SCOI2013]火柴棍数字(背包)

    题目 做饭 由于越高位越好,我们先得出能组成的最高位 \(f[i][j][k]\)表示从低到高位第\(i\)位,手里拿着\(j\)根火柴,第\(i\)位是否为\(0\)所需要的最少火柴 我们转移仅需得 ...

  4. 查看oracle当前连接数和进程数

    查询数据库当前进程的连接数: select count(*) from v$process; 查看数据库当前会话的连接数: select count(*) from v$session; 查看数据库的 ...

  5. SQL单行函数和多行函数

    单行函数和多行函数示意图: 单行函数分为五种类型:字符函数.数值函数.日期函数.转换函数.通用函数 单行函数: --大小写控制函数 select lower('Hello World') 转小写, u ...

  6. 20145240 《Java程序设计》第二次实验报告

    20145240 <Java程序设计>第二次实验报告 北京电子科技学院(BESTI)实验报告 课程:Java程序设计 班级:1452 指导教师:娄嘉鹏 实验日期:2016.04.12 实验 ...

  7. Qt使用QCustomPlot开发

    一.入门 1.下载源文件http://www.qcustomplot.com/: 2.把.cpp和.h放在工程目录下,并将cpp和h加入工程: 3.在.pro中:QT += printsupport: ...

  8. Mysql -- You can't specify target table 'address' for update in FROM clause

    做地址管理时,需要先根据要设为默认的地址的用户将用户的其他地址都设置为非默认 需要select出用户id然后update 原语句 update address set isdeafult = 0 wh ...

  9. Linux嵌入式 -- Bootloader , Uboot

    1. Bootloader作用 PC机中的引导加载程序由BIOS(其本质是一段固件程序)和GRUB或LILO一起组成.BIOS在完成硬件检测和资源分配后,将硬盘中的引导程序读到系统内存中然后将控制权交 ...

  10. nova instance启动中的同步与异步

    instance create:nova/api/servers.create -- self.compute_api.create -- self.compute_task_api.build_in ...