go-acme / lego

Let's Encrypt/ACME client and library written in Go
https://go-acme.github.io/lego/
MIT License
7.84k stars 1.01k forks source link

Add DNS provider for Metaname #1952

Closed nzdjb closed 1 year ago

nzdjb commented 1 year ago

Adds Metaname.net as a DNS provider. Fixes #1586

I'm a customer of Metaname and happy to maintain this.

This implementation is mostly based on the existing ones for Efficient IP and Hosttech.

Tests are added and pass. Linting does as well. Docs are generated.

Sanitised example run including wildcard domain:

$ METANAME_ACCOUNT_REFERENCE=xxxx \
  METANAME_API_KEY=xxxxxxxxxxxxxxxxxxxxxx \
  ./dist/lego -m lego-test@example.com --dns metaname --accept-tos \
  -d test.example.com -d "*.test.example.com" \
  -s https://acme-staging-v02.api.letsencrypt.org/directory run
2023/07/15 09:03:18 No key found for account lego-test@example.com. Generating a P256 key.
2023/07/15 09:03:18 Saved key to /workspaces/lego/.lego/accounts/acme-staging-v02.api.letsencrypt.org/lego-test@example.com/keys/lego-test@example.com.key
2023/07/15 09:03:19 [INFO] acme: Registering account for lego-test@example.com
!!!! HEADS UP !!!!

Your account credentials have been saved in your Let's Encrypt
configuration directory at "/workspaces/lego/.lego/accounts".

You should make a secure backup of this folder now. This
configuration directory will also contain certificates and
private keys obtained from Let's Encrypt so making regular
backups of this folder is ideal.
2023/07/15 09:03:19 [INFO] [test.example.com, *.test.example.com] acme: Obtaining bundled SAN certificate
2023/07/15 09:03:20 [INFO] [*.test.example.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/7312090804
2023/07/15 09:03:20 [INFO] [test.example.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/7312090814
2023/07/15 09:03:20 [INFO] [*.test.example.com] acme: use dns-01 solver
2023/07/15 09:03:20 [INFO] [test.example.com] acme: Could not find solver for: tls-alpn-01
2023/07/15 09:03:20 [INFO] [test.example.com] acme: Could not find solver for: http-01
2023/07/15 09:03:20 [INFO] [test.example.com] acme: use dns-01 solver
2023/07/15 09:03:20 [INFO] [*.test.example.com] acme: Preparing to solve DNS-01
2023/07/15 09:03:22 [INFO] [test.example.com] acme: Preparing to solve DNS-01
2023/07/15 09:03:23 [INFO] [*.test.example.com] acme: Trying to solve DNS-01
2023/07/15 09:03:23 [INFO] [*.test.example.com] acme: Checking DNS record propagation using [192.168.65.7:53]
2023/07/15 09:03:25 [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
2023/07/15 09:03:33 [INFO] [*.test.example.com] The server validated our request
2023/07/15 09:03:33 [INFO] [test.example.com] acme: Trying to solve DNS-01
2023/07/15 09:03:33 [INFO] [test.example.com] acme: Checking DNS record propagation using [192.168.65.7:53]
2023/07/15 09:03:35 [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
2023/07/15 09:03:36 [INFO] [test.example.com] The server validated our request
2023/07/15 09:03:36 [INFO] [*.test.example.com] acme: Cleaning DNS-01 challenge
2023/07/15 09:03:37 [INFO] [test.example.com] acme: Cleaning DNS-01 challenge
2023/07/15 09:03:39 [INFO] [test.example.com, *.test.example.com] acme: Validations succeeded; requesting certificates
2023/07/15 09:03:39 [INFO] Wait for certificate [timeout: 30s, interval: 500ms]
2023/07/15 09:03:40 [INFO] [test.example.com] Server responded with a certificate.
ldez commented 1 year ago

Hello, in order for a PR adding a DNS provider to be accepted, you have to:

make test

./lego -m your@email.com --dns YOUR_PROVIDER_NAME -d *.example.com -d example.com -s https://acme-staging-v02.api.letsencrypt.org/directory run

Note the wildcard domain is important.
- [x] pass the linter ([golangci-lint](https://github.com/golangci/golangci-lint#install) must be installed):
```shell
make checks