-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.sh
executable file
·28 lines (21 loc) · 911 Bytes
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
DATE_STRING=`date +"%Y-%m-%d_%H-%M-%S"`
mkdir `echo $DATE_STRING`
docker run --rm --name certbot \
-v "`echo ~/.aws`:/root/.aws" \
-v "`pwd`/$DATE_STRING:/etc/letsencrypt/archive/" \
--env AWS_PROFILE=${AWS_PROFILE-default} \
certbot/dns-route53:v0.28.0 certonly \
-n --email $EMAIL \
--agree-tos --preferred-challenges dns \
--server https://acme-v02.api.letsencrypt.org/directory \
--dns-route53 --dns-route53-propagation-seconds 60 \
-d $DOMAIN -d "*.$DOMAIN"
if [[ $BUCKET ]]; then
aws s3 mb s3://$BUCKET
aws s3 sync `echo $DATE_STRING` s3://$BUCKET/
aws s3 mv s3://$BUCKET/$DOMAIN/fullchain1.pem s3://$BUCKET/$DOMAIN/fullchain.pem
aws s3 mv s3://$BUCKET/$DOMAIN/privkey1.pem s3://$BUCKET/$DOMAIN/privkey.pem
aws s3 mv s3://$BUCKET/$DOMAIN/cert1.pem s3://$BUCKET/$DOMAIN/cert.pem
aws s3 mv s3://$BUCKET/$DOMAIN/chain1.pem s3://$BUCKET/$DOMAIN/chain.pem
fi