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
  • 相关阅读:
    全选+批量删除
    ssm异步上传图片
    抽象类与接口区别
    请求转发和重定向区别
    switch
    一道有点绕弯,考察的知识也是最基础的题
    线程安全之集合
    会话跟踪技术
    关于异常说明
    mybatis总结(三)之多表查询
  • 原文地址:https://www.cnblogs.com/wangmo/p/9078297.html
Copyright © 2011-2022 走看看