목차

, , , , , ,

acme.sh Configuration

acme.sh configuration은 account 공통 상태, domain별 발급 상태, certificate deployment 경로, DNS provider credential로 나뉜다. 이 file들은 private key나 API credential을 포함할 수 있으므로 wiki나 Git에 복사하지 않는다.

Summary

Locations

Scope Default Purpose
program home ~/.acme.sh/ script, hook, internal data
account ~/.acme.sh/account.conf CA account와 공통 setting
certificate ~/.acme.sh/DOMAIN/ domain key, certificate, managed renewal state
log ~/.acme.sh/acme.sh.log –log를 사용한 실행 기록

ECC와 RSA certificate를 함께 관리하거나 custom home을 사용하면 실제 directory 이름이 달라질 수 있다. path를 추측하지 말고 다음 command로 현재 상태를 확인한다.

acme.sh --info
acme.sh --info -d example.com
acme.sh --list

Storage Options

scheduled renewal은 interactive shell의 alias나 현재 directory에 의존하지 않도록 동일한 home을 명시한다.

0 0 * * * "/home/user/.acme.sh/acme.sh" --cron --home "/home/user/.acme.sh" > /dev/null

Authoring Workflow

managed configuration의 내부 variable 이름을 직접 수정하는 대신 public command option으로 상태를 만든다.

# account 연락처 변경
acme.sh --update-account --server letsencrypt -m you@example.com
 
# 기본 CA 저장
acme.sh --set-default-ca --server letsencrypt
 
# domain validation과 issuance setting 저장
acme.sh --issue -d example.com -w /var/www/html
 
# deployment path와 reload command 저장
acme.sh --install-cert -d example.com \
  --key-file /etc/nginx/tls/example.com.key \
  --fullchain-file /etc/nginx/tls/example.com.crt \
  --reloadcmd "nginx -t && systemctl reload nginx"

command line option은 현재 실행에 적용되고, 발급·설치·account command가 renewal에 필요한 값을 managed configuration에 기록한다. version이나 provider hook에 따라 내부 key가 바뀔 수 있으므로 account.conf와 domain .conf의 내부 이름을 automation interface로 사용하지 않는다.

DNS Credentials

DNS provider hook이 요구하는 environment variable을 현재 shell에 주입한 뒤 최초 issuance를 실행한다. 아래 이름은 Cloudflare token 방식의 redacted example이며 실제 값은 secret manager에서 읽는다.

export CF_Token='REDACTED'
export CF_Account_ID='REDACTED'
 
acme.sh --issue --dns dns_cf -d example.com -d '*.example.com'
실제 token을 shell script, command history, wiki, Git, process argument에 literal로 남기지 않는다. token에는 필요한 zone의 DNS record edit/read처럼 최소 권한만 부여한다. provider마다 variable 이름, token scope, account/zone ID 요구가 다르므로 공식 dnsapi 문서를 확인한다.

acme.sh가 renewal을 위해 credential을 configuration에 저장할 수 있으므로 file 접근 권한과 backup 범위를 점검한다.

chmod 700 ~/.acme.sh
chmod 600 ~/.acme.sh/account.conf

Certificate Deployment

internal certificate path를 web server configuration에 직접 넣지 않는다. 운영용 destination을 먼저 만들고 owner와 mode를 정한 뒤 –install-cert가 그 file을 갱신하게 한다.

아래 예시는 acme.sh를 root account에 설치해 root cron으로 갱신하는 server를 가정한다. 일반 user 설치에서는 destination write와 service reload에 필요한 최소 권한만 별도로 부여한다.

sudo -i
install -d -m 0750 /etc/nginx/tls
touch /etc/nginx/tls/example.com.key /etc/nginx/tls/example.com.crt
 
/root/.acme.sh/acme.sh --install-cert -d example.com \
  --key-file /etc/nginx/tls/example.com.key \
  --fullchain-file /etc/nginx/tls/example.com.crt \
  --reloadcmd "nginx -t && systemctl reload nginx"
exit

Precedence and Separation

Validation

acme.sh --version
acme.sh --info
acme.sh --info -d example.com
acme.sh --list
 
# 현재 설정한 CA의 staging endpoint에서 새 test domain 흐름 검증
acme.sh --issue --test -d test.example.com -w /var/www/html
 
# scheduled renewal check와 동일한 home 사용
acme.sh --cron --home ~/.acme.sh
staging certificate는 browser가 신뢰하지 않으며 운영 배포용이 아니다. test domain, DNS, webroot가 실제로 준비된 경우에만 staging issuance를 실행한다.

Troubleshooting

Compatibility

See Also

History