zoukankan      html  css  js  c++  java
  • 证书脚本--生成csr,key

    #!/bin/sh
    # this script can make certificate of each line in file  you point which one!
    if [ $# -ne 1 ];then
       echo -e "33[33m Input your domain's file 33[0m"
       exit 1
    fi
    for line in `cat $1`
    do
        hostname=$line
        line="`echo $line|awk -F" " '{print $1}'`.key"
        echo "==$line=="
        echo -e "
    
    33[32m Make certificate of $line 33[0m
    
    "
        csr_file=`echo $line|awk -F".key" '{print $1}'`
        expect -c "
            set timeout 20;
            spawn openssl genrsa -des3 -out $line 2048
            expect {
                : {send 12345678
    ;exp_continue}
                : {send 12345678
    ;}
            }
    
            spawn openssl rsa -in $line -out $line
            expect {
                "Enter pass phrase" {send 12345678
    ;exp_continue}
            }
    
            spawn openssl req -new -key $line -out  $csr_file.csr
            expect {
                "Enter pass phrase"  {send 12345678
    ;exp_continue}
                "Country Name" {send CN
    ;exp_continue}
                "State or Province Name" {send Beijing
    ;exp_continue}
                "Locality Name" {send Beijing
    ;exp_continue}
                "Organization Name" {send "Beijing Yuanxin Technology Co., Ltd.
    ";exp_continue}
                "Organizational Unit Name" {send "Beijing Yuanxin Technology Co., Ltd.
    ";exp_continue}
                "Common Name*" {send "$hostname
    ";exp_continue}
                "Email Address" {send 
    ;exp_continue}
                "A challenge password" {send 12345678
    ;exp_continue}
                "An optional company name" {send "Beijing Yuanxin Technology Co., Ltd
    ";exp_continue}
           }"
    done
  • 相关阅读:
    .net web开发经典图书总结
    Asp.net Web API实战
    扩展方法之二分查找
    在线转换图片文件等
    如何减少代码中的分支语句
    web插件化解决方案 开发分享
    .NET 4.5 MEF 基于约定的编程模型重典
    所有排序总结(内排序)
    生成zip文件
    open source ESB and integration platform
  • 原文地址:https://www.cnblogs.com/wangmo/p/9078297.html
Copyright © 2011-2022 走看看