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
  • 相关阅读:
    Qt 学习之路:Canvas
    Qt 学习之路:模型-视图高级技术
    Qt 学习之路 :视图代理
    Qt 学习之路 :动态视图
    Qt 学习之路 :Repeater
    Qt 学习之路 :Qt Quick Controls
    mysql-gdb--oracle
    redis-BOOK
    2016qconbeijing
    LINUX 内核月报 taobao
  • 原文地址:https://www.cnblogs.com/wangmo/p/9078297.html
Copyright © 2011-2022 走看看