Skip to content

Commit

Permalink
build(wip): acme.sh 2.9.0 -> 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
buchdag committed Jan 14, 2024
1 parent 06a5f5e commit 48477e8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM nginxproxy/docker-gen:0.11.0 AS docker-gen
FROM alpine:3.19.0

ARG GIT_DESCRIBE
ARG ACMESH_VERSION=2.9.0
ARG ACMESH_VERSION=3.0.0

ENV COMPANION_VERSION=$GIT_DESCRIBE \
DOCKER_HOST=unix:///var/run/docker.sock \
Expand Down
11 changes: 7 additions & 4 deletions app/letsencrypt_service
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,12 @@ function update_cert {

# Set relevant --server parameter and ca folder name
params_base_arr+=(--server "$acme_ca_uri")
local ca_dir="${acme_ca_uri##*://}" \
&& ca_dir="${ca_dir%%/*}" \
&& ca_dir="${ca_dir%%:*}"


local ca_host_dir
ca_host_dir="$(echo "$acme_ca_uri" | cut -d : -f 2 | tr -s / | cut -d / -f 2)"
local ca_path_dir
ca_path_dir="$(echo "$acme_ca_uri" | cut -d : -f 2- | tr -s / | cut -d / -f 3-)"

local certificate_dir
# If we're going to use one of LE stating endpoints ...
Expand All @@ -223,7 +226,7 @@ function update_cert {

[[ ! -d "$config_home" ]] && mkdir -p "$config_home"
params_base_arr+=(--config-home "$config_home")
local account_file="${config_home}/ca/${ca_dir}/account.json"
local account_file="${config_home}/ca/${ca_host_dir}/${ca_path_dir}/account.json"

# External Account Binding (EAB)
local -n eab_kid="ACME_${cid}_EAB_KID"
Expand Down
19 changes: 16 additions & 3 deletions test/tests/acme_accounts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,21 @@ run_nginx_container --hosts "${domains[0]}"
# Wait for a symlink at /etc/nginx/certs/${domains[0]}.crt
wait_for_symlink "${domains[0]}" "$le_container_name"

# Hard set the account dir based on the test ACME CA used.
case $ACME_CA in
pebble)
account_dir="pebble/dir"
;;
boulder)
account_dir="boulder/directory"
;;
*)
echo "$0 $ACME_CA: invalid option."
exit 1
esac

# Test if the expected folder / file / content are there.
json_file="/etc/acme.sh/default/ca/$ACME_CA/account.json"
json_file="/etc/acme.sh/default/ca/$account_dir/account.json"
if [[ "$ACME_CA" == 'boulder' ]]; then
no_mail_str='[]'
elif [[ "$ACME_CA" == 'pebble' ]]; then
Expand Down Expand Up @@ -64,7 +77,7 @@ run_nginx_container --hosts "${domains[1]}"
wait_for_symlink "${domains[1]}" "$le_container_name"

# Test if the expected folder / file / content are there.
json_file="/etc/acme.sh/${default_email}/ca/$ACME_CA/account.json"
json_file="/etc/acme.sh/${default_email}/ca/$account_dir/account.json"
if docker exec "$le_container_name" [[ ! -d "/etc/acme.sh/$default_email" ]]; then
echo "The /etc/acme.sh/$default_email folder does not exist."
elif docker exec "$le_container_name" [[ ! -f "$json_file" ]]; then
Expand All @@ -82,7 +95,7 @@ run_nginx_container --hosts "${domains[2]}" --cli-args "--env LETSENCRYPT_EMAIL=
wait_for_symlink "${domains[2]}" "$le_container_name"

# Test if the expected folder / file / content are there.
json_file="/etc/acme.sh/${container_email}/ca/$ACME_CA/account.json"
json_file="/etc/acme.sh/${container_email}/ca/$account_dir/account.json"
if docker exec "$le_container_name" [[ ! -d "/etc/acme.sh/$container_email" ]]; then
echo "The /etc/acme.sh/$container_email folder does not exist."
elif docker exec "$le_container_name" [[ ! -f "$json_file" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions test/tests/acme_eab/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ run_nginx_container --hosts "${domains[1]}" \
wait_for_symlink "${domains[0]}" "$le_container_name"

# Test if the expected file is there.
config_path="/etc/acme.sh/default/ca/$ACME_CA"
config_path="/etc/acme.sh/default/ca/$ACME_CA/dir"
json_file="${config_path}/account.json"
conf_file="${config_path}/ca.conf"
if docker exec "$le_container_name" [[ ! -f "$json_file" ]]; then
Expand All @@ -59,7 +59,7 @@ fi
wait_for_symlink "${domains[1]}" "$le_container_name"

# Test if the expected file is there.
config_path="/etc/acme.sh/${container_email}/ca/$ACME_CA"
config_path="/etc/acme.sh/${container_email}/ca/$ACME_CA/dir"
json_file="${config_path}/account.json"
conf_file="${config_path}/ca.conf"
if docker exec "$le_container_name" [[ ! -f "$json_file" ]]; then
Expand Down

0 comments on commit 48477e8

Please sign in to comment.