This Go application automates the process of obtaining SSL certificates from Let's Encrypt and binding them to custom domains for Alibaba Cloud OSS (Object Storage Service) buckets. It uses DNS-01 challenge validation through Alibaba Cloud DNS service to prove domain ownership.
- Automatically requests SSL certificates from Let's Encrypt
- Uses DNS-01 challenge for domain validation via Alibaba Cloud DNS
- Binds the obtained certificate to a custom domain for OSS bucket
- Secure credential management through environment variables
Before running this application, ensure you have:
-
An Alibaba Cloud account with:
- OSS bucket created
- DNS domain managed by Alibaba Cloud DNS
- AccessKey ID and AccessKey Secret with appropriate permissions
-
Go 1.24 or higher installed
-
Required permissions for:
- Managing DNS records (for ACME challenge)
- Managing OSS bucket CNAME configurations
go mod tidySet the following environment variables:
export ALIDNS_ACCESS_KEY_ID="your_alibaba_dns_access_key_id"
export ALIDNS_ACCESS_KEY_SECRET="your_alibaba_dns_access_key_secret"go run main.go -region=<region> -bucket=<bucket_name> -domain=<custom_domain>Example:
go run main.go -region=cn-hangzhou -bucket=my-bucket -domain=example.com-region: The region where your OSS bucket is located (e.g., cn-hangzhou)-bucket: The name of your OSS bucket-domain: The custom domain for which you want to request a certificate
- The application uses
certmagicto automatically request a certificate from Let's Encrypt - It performs DNS-01 challenge by creating temporary DNS records in your Alibaba Cloud DNS zone
- Once validated, Let's Encrypt issues the certificate
- The application loads the issued certificate and private key from storage
- Finally, it binds the certificate to your specified OSS bucket custom domain
- Never commit your
ALIDNS_ACCESS_KEY_IDandALIDNS_ACCESS_KEY_SECRETto version control - Use dedicated AccessKey with minimal required permissions
- The application uses Let's Encrypt Production CA by default
- caddyserver/certmagic - Certificate management
- libdns/alidns - Alibaba Cloud DNS provider
- aliyun/alibabacloud-oss-go-sdk-v2 - OSS SDK
MIT License