证书脚本--生成csr,key
2024-08-23 14:10:55
#!/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
最新文章
- android studio 中依赖库compile 的一些库的地址
- Linux内核分析——进程描述与创建
- 寻找表达式(dfs)
- 用sql 语句给字段添加描述
- mysql链接数据库时报错
- HTML 5 Web Sockets应用初探
- javascript数据结构和算法[转]
- T-SQL 基于关系分割字符串
- linux下查找某个文件
- 有JSON中字段最好是【字符】而非【enum】想到
- 怎样以学习单片机为契机,逐步成为优秀的project师
- Vue-cli安装教程
- 《程序设计语言——实践之路(英文第三版)》【PDF】下载
- Linux 安装多个版本JDK并设置默认版本
- WIN10远程连接,报错身份验证错误,要求的函数不受支持
- Eclipse块选择快捷键
- 根据框架的dtd或xsd生成xml文件
- InvocationHandler和Proxy(Class)的动态代理机制详解
- Delphi Excel导入 的通用程序转载
- python使用原始套接字 解析原始ip头数据
热门文章
- console.log()方法中%s的作用
- R中的参数传递函数:commandArgs(),getopt().
- java内置注解、元注解和自定义注解
- Kubernetes Metrics-Server
- JSP--内置对象&;动作标签介绍
- Linux查看文件编码格式及文件编码转换<;转>;
- mysql启动报can&#39;t create/write to file &#39;var/run/mysqld/mysqld.pid 错误解决办法
- vue-router scrollBehavior无效的问题及解决方案
- json数据与Gson工具类的使用
- UVA 11186 Circum Triangle (枚举三角形优化)(转)