#!/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

最新文章

  1. android studio 中依赖库compile 的一些库的地址
  2. Linux内核分析——进程描述与创建
  3. 寻找表达式(dfs)
  4. 用sql 语句给字段添加描述
  5. mysql链接数据库时报错
  6. HTML 5 Web Sockets应用初探
  7. javascript数据结构和算法[转]
  8. T-SQL 基于关系分割字符串
  9. linux下查找某个文件
  10. 有JSON中字段最好是【字符】而非【enum】想到
  11. 怎样以学习单片机为契机,逐步成为优秀的project师
  12. Vue-cli安装教程
  13. 《程序设计语言——实践之路(英文第三版)》【PDF】下载
  14. Linux 安装多个版本JDK并设置默认版本
  15. WIN10远程连接,报错身份验证错误,要求的函数不受支持
  16. Eclipse块选择快捷键
  17. 根据框架的dtd或xsd生成xml文件
  18. InvocationHandler和Proxy(Class)的动态代理机制详解
  19. Delphi Excel导入 的通用程序转载
  20. python使用原始套接字 解析原始ip头数据

热门文章

  1. console.log()方法中%s的作用
  2. R中的参数传递函数:commandArgs(),getopt().
  3. java内置注解、元注解和自定义注解
  4. Kubernetes Metrics-Server
  5. JSP--内置对象&动作标签介绍
  6. Linux查看文件编码格式及文件编码转换<转>
  7. mysql启动报can't create/write to file 'var/run/mysqld/mysqld.pid 错误解决办法
  8. vue-router scrollBehavior无效的问题及解决方案
  9. json数据与Gson工具类的使用
  10. UVA 11186 Circum Triangle (枚举三角形优化)(转)