免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1323 | 回复: 0
打印 上一主题 下一主题

Create the /usr/bin/sign.sh program file [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-05-23 19:08 |只看该作者 |倒序浏览
Apache中的TLS Howto里面经常提到的sign.sh文件,由于不是所有人都安装mod_ssl,在apache2.0以后也不用这个包了,所以单独弄出来
Securing and Optimizing Linux: RedHat Edition -A Hands on Guide
Prev
Chapter 24. Software -Networking/Encryption
Next
24.5. Create the /usr/bin/sign.sh program file
The openssl ca commands has some strange requirements and the default OpenSSL config doesn't allow one easily to use openssl ca directly. Therefore, well create this sign.sh program to replace it. Create the sign.sh program file, touch /usr/bin/sign.sh and add to this file:
         #!/bin/sh
         ##
         ##  sign.sh -- Sign a SSL Certificate Request (CSR)
         ##  Copyright (c) 1998-1999 Ralf S. Engelschall, All Rights Reserved.
         ##
         #   argument line handling
         CSR=$1
         if [ $# -ne 1 ]; then
         echo "Usage: sign.sign .csr"; exit 1
         fi
         if [ ! -f $CSR ]; then
         echo "CSR not found: $CSR"; exit 1
         fi
         case $CSR in
         *.csr ) CERT="`echo $CSR | sed -e 's/.csr/.crt/'`" ;;
         * ) CERT="$CSR.crt" ;;
         esac
         #   make sure environment exists
         if [ ! -d ca.db.certs ]; then
         mkdir ca.db.certs
         fi
         if [ ! -f ca.db.serial ]; then
         echo '01' >ca.db.serial
         fi
         if [ ! -f ca.db.index ]; then
         cp /dev/null ca.db.index
         fi
         #   create an own SSLeay config
         cat >ca.config  $CERT:"
         openssl ca -config ca.config -out $CERT -infiles $CSR
         echo "CA verifying: $CERT  CA cert"
         openssl verify -CAfile /etc/ssl/certs/ca.crt $CERT
         #  cleanup after SSLeay
         rm -f ca.config
         rm -f ca.db.serial.old
         rm -f ca.db.index.old
         #  die gracefully
         exit 0
         
Now, make this program executable, and change its default permissions:
         [root@deep] /# chmod 755 /usr/bin/sign.sh
         


:
You can also find this program sign.sh in the mod_ssl distribution under the mod_ssl-version/pkg.contrib/ subdirectory, or on our floppy.tgz archive file. Also note that the section [ CA_own ] must be changed to refect your own environment and don't forget to change the openssl verify -CAfile /etc/ssl/certs/ca.crt $CERT line too.
Prev
Home
Next
The /etc/ssl/openssl.cnf file
Up
Commands -often used

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/2389/showart_27364.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP