Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DNS provider for Sonic #1392

Merged
merged 9 commits into from
Apr 25, 2021
Merged

Add DNS provider for Sonic #1392

merged 9 commits into from
Apr 25, 2021

Conversation

alexeiser
Copy link
Contributor

@alexeiser alexeiser commented Apr 24, 2021

Add support for SONIC as a DNS provider.

https://www.sonic.com/

@ldez ldez changed the title Sonic api Add DNS provider for Sonic Apr 24, 2021
@ldez
Copy link
Member

ldez commented Apr 24, 2021

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

  • add a description to your PR
  • be able to maintain this provider
  • have a homogeneous design with the other providers
  • add tests (units)
make test
  • add tests ("live")
    func TestLivePresent(t *testing.T) {
    if !envTest.IsLiveTest() {
    t.Skip("skipping live test")
    }
    envTest.RestoreEnv()
    provider, err := NewDNSProvider()
    require.NoError(t, err)
    err = provider.Present(envTest.GetDomain(), "", "123d==")
    require.NoError(t, err)
    }
    func TestLiveCleanUp(t *testing.T) {
    if !envTest.IsLiveTest() {
    t.Skip("skipping live test")
    }
    envTest.RestoreEnv()
    provider, err := NewDNSProvider()
    require.NoError(t, err)
    time.Sleep(2 * time.Second)
    err = provider.CleanUp(envTest.GetDomain(), "", "123d==")
    require.NoError(t, err)
    }
make test
make generate-dns
  • be able to do: (and put the output of this command to a comment in your PR)
rm -rf .lego

./lego -m [email protected] --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.

make checks
  • do go mod tidy

@alexeiser
Copy link
Contributor Author

alexeiser commented Apr 24, 2021

Sample multi request & * request.

$ go run cmd/lego/main.go --email [email protected]  --dns sonic  -d *.AAAA.example.com   -d AAAA.example.com    -s https://acme-staging-v02.api.letsencrypt.org/directory run 
2021/04/24 12:05:42 [INFO] [*.AAAA.example.com, AAAA.example.com] acme: Obtaining bundled SAN certificate
2021/04/24 12:05:44 [INFO] [*.AAAA.example.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/34183628
2021/04/24 12:05:44 [INFO] [AAAA.example.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/34183636
2021/04/24 12:05:44 [INFO] [*.AAAA.example.com] acme: use dns-01 solver
2021/04/24 12:05:44 [INFO] [AAAA.example.com] acme: Could not find solver for: tls-alpn-01
2021/04/24 12:05:44 [INFO] [AAAA.example.com] acme: Could not find solver for: http-01
2021/04/24 12:05:44 [INFO] [AAAA.example.com] acme: use dns-01 solver
2021/04/24 12:05:44 [INFO] [*.AAAA.example.com] acme: Preparing to solve DNS-01
2021/04/24 12:05:44 [INFO] [*.AAAA.example.com] acme: Trying to solve DNS-01
2021/04/24 12:05:44 [INFO] [*.AAAA.example.com] acme: Checking DNS record propagation using [192.168.120.1:53]
2021/04/24 12:05:46 [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
2021/04/24 12:05:52 [INFO] [*.AAAA.example.com] The server validated our request
2021/04/24 12:05:52 [INFO] [*.AAAA.example.com] acme: Cleaning DNS-01 challenge
2021/04/24 12:05:52 [INFO] sequence: wait for 1m0s
2021/04/24 12:06:52 [INFO] [AAAA.example.com] acme: Preparing to solve DNS-01
2021/04/24 12:06:52 [INFO] [AAAA.example.com] acme: Trying to solve DNS-01
2021/04/24 12:06:52 [INFO] [AAAA.example.com] acme: Checking DNS record propagation using [192.168.120.1:53]
2021/04/24 12:06:54 [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
2021/04/24 12:06:55 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:06:57 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:06:59 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:01 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:03 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:05 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:07 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:09 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:11 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:13 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:15 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:17 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:19 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:21 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:23 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:25 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:27 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:29 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:31 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:34 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:36 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:38 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:40 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:42 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:44 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:46 [INFO] [AAAA.example.com] acme: Waiting for DNS record propagation.
2021/04/24 12:07:50 [INFO] [AAAA.example.com] The server validated our request
2021/04/24 12:07:50 [INFO] [AAAA.example.com] acme: Cleaning DNS-01 challenge
2021/04/24 12:07:50 [INFO] [*.AAAA.example.com, AAAA.example.com] acme: Validations succeeded; requesting certificates
2021/04/24 12:07:51 [INFO] [*.AAAA.example.com] Server responded with a certificate.

@alexeiser
Copy link
Contributor Author

  • be able to maintain this provider
  • have a homogeneous design with the other providers

How can I provide details with respect to these items.

@ldez ldez added this to the v4.4 milestone Apr 24, 2021
@ldez
Copy link
Member

ldez commented Apr 24, 2021

be able to maintain this provider

This means that you have to explain a bit who you are (a Sonic customer, a Sonic employee, ...).

@alexeiser
Copy link
Contributor Author

be able to maintain this provider

This means that you have to explain a bit who you are (a Sonic customer, a Sonic employee, ...).

I am a Sonic customer - there has been an open request for them to provide an API for their DNS services for a couple of years. They finally added it.

@alexeiser
Copy link
Contributor Author

Thanks for removing that insecure_https flag - copy paste fail.

Verified the updated diff still works well with actual API keys.

Copy link
Member

@ldez ldez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@ldez ldez enabled auto-merge (squash) April 25, 2021 09:28
@ldez ldez merged commit 3da04e6 into go-acme:master Apr 25, 2021
@alexeiser alexeiser deleted the sonic_api branch April 25, 2021 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants