Subversion Repositories ALCASAR

Rev

Rev 3169 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3169 Rev 3182
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#
2
#
3
# $Id: alcasar-letsencrypt.sh 3169 2024-01-18 16:15:23Z rexy $
3
# $Id: alcasar-letsencrypt.sh 3182 2024-03-06 23:39:43Z rexy $
4
#
4
#
5
# alcasar-letsencrypt.sh
5
# alcasar-letsencrypt.sh
6
# by Tom HOUDAYER & Rexy
6
# by Tom HOUDAYER & Rexy
7
#
7
#
8
# This script is distributed under the Gnu General Public License (GPL)
8
# This script is distributed under the Gnu General Public License (GPL)
Line 17... Line 17...
17
STAGING_SERVER=""
17
STAGING_SERVER=""
18
FORCE=""
18
FORCE=""
19
OPT_PARAMS=""
19
OPT_PARAMS=""
20
ACMESH_HOME="/usr/local/etc/letsencrypt"
20
ACMESH_HOME="/usr/local/etc/letsencrypt"
21
ACMESH_BIN="/opt/acme.sh/acme.sh"
21
ACMESH_BIN="/opt/acme.sh/acme.sh"
-
 
22
LE_SERVER="letsencrypt"
22
 
23
 
23
usage="Usage: alcasar-letsencrypt.sh
24
usage="Usage: alcasar-letsencrypt.sh
24
       --issue -d alcasar.domain.tld --email alcasar@domain.tld [--dns-api dns_registrar] [--force] [--staging]
25
       --issue -d alcasar.domain.tld --email alcasar@domain.tld [--dns-api dns_registrar] [--force] [--staging]
25
       --renew [-d alcasar.domain.tld] [--force] [--staging]"
26
       --renew [-d alcasar.domain.tld] [--force] [--staging]"
26
 
27
 
Line 45... Line 46...
45
	$ACMESH_BIN --config-home $ACMESH_HOME/data \
46
	$ACMESH_BIN --config-home $ACMESH_HOME/data \
46
		$STAGING_SERVER $FORCE $debugOpt \
47
		$STAGING_SERVER $FORCE $debugOpt \
47
		$emailField \
48
		$emailField \
48
		--issue --dns $dnsApiOpt -d $DOMAIN \
49
		--issue --dns $dnsApiOpt -d $DOMAIN \
49
		$OPT_PARAMS \
50
		$OPT_PARAMS \
-
 
51
		--server $LE_SERVER \
50
		> $TMP_OUTPUT 2>&1
52
		> $TMP_OUTPUT 2>&1
51
	exitCode=$?
53
	exitCode=$?
52
	$DEBUG && cat $TMP_OUTPUT && echo -e "\n\n"
54
	$DEBUG && cat $TMP_OUTPUT && echo -e "\n\n"
53
	sed -i "s/^domainRequest=.*/domainRequest=$DOMAIN/" $CONF_FILE
55
	sed -i "s/^domainRequest=.*/domainRequest=$DOMAIN/" $CONF_FILE
54
	sed -i "s/^dateIssueRequest=.*/dateIssueRequest=$(date +%s)/" $CONF_FILE
56
	sed -i "s/^dateIssueRequest=.*/dateIssueRequest=$(date +%s)/" $CONF_FILE
Line 80... Line 82...
80
	[ ! -z "$DNS_API" ] && dnsApiOpt="" || dnsApiOpt="--yes-I-know-dns-manual-mode-enough-go-ahead-please"
82
	[ ! -z "$DNS_API" ] && dnsApiOpt="" || dnsApiOpt="--yes-I-know-dns-manual-mode-enough-go-ahead-please"
81
	$ACMESH_BIN --config-home $ACMESH_HOME/data \
83
	$ACMESH_BIN --config-home $ACMESH_HOME/data \
82
		$STAGING_SERVER $FORCE $debugOpt \
84
		$STAGING_SERVER $FORCE $debugOpt \
83
		--renew -d $DOMAIN $dnsApiOpt \
85
		--renew -d $DOMAIN $dnsApiOpt \
84
		$OPT_PARAMS \
86
		$OPT_PARAMS \
-
 
87
		--server $LE_SERVER \
85
		> $TMP_OUTPUT 2>&1
88
		> $TMP_OUTPUT 2>&1
86
	exitCode=$?
89
	exitCode=$?
87
	$DEBUG && cat $TMP_OUTPUT && echo -e "\n\n"
90
	$DEBUG && cat $TMP_OUTPUT && echo -e "\n\n"
88
	if ! _handle_client_response $TMP_OUTPUT; then
91
	if ! _handle_client_response $TMP_OUTPUT; then
89
		if [ $exitCode -ne 0 ]; then
92
		if [ $exitCode -ne 0 ]; then