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
  • 相关阅读:
    LG P2473 [SCOI2008]奖励关
    三分法
    P2521 [HAOI2011]防线修建
    金融分析-ipython
    vue --webpack的使用
    Vue-npm命令解析
    Vue-router VUE路由系统
    爬虫--总目录
    爬虫-scrapy框架
    爬虫-性能相关- twisted-tornado
  • 原文地址:https://www.cnblogs.com/wangmo/p/9078297.html
Copyright © 2011-2022 走看看