annotate bin/startssl-nginx @ 274:38cb6a866d3f

StartSSL appender for nginx.
author Edho Arief <edho@myconan.net>
date Tue, 06 Dec 2011 23:56:23 -0500
parents
children c52680b34356
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
274
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
1 #!/bin/sh
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
2
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
3 _err_fatal() {
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
4 printf "%s\n" "$*"
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
5 exit 1
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
6 }
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
7
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
8 certfile="${1}"
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
9
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
10 command -v curl 2> /dev/null || _err_fatal "This script requires cURL. Please install it first."
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
11 test -z "${certfile}" && _err_fatal "Please specify certificate file."
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
12 test -f "${certfile}" && _err_fatal "Error reading certificate file ${certfile}."
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
13
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
14 for ca in sub.class1.server.ca.pem ca.pem; do
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
15 curl "http://www.startssl.com/certs/${ca}" >> "${certfile}"
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
16 done
38cb6a866d3f StartSSL appender for nginx.
Edho Arief <edho@myconan.net>
parents:
diff changeset
17