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 nicmanager #1473

Merged
merged 2 commits into from
Aug 27, 2021
Merged

Add DNS provider for nicmanager #1473

merged 2 commits into from
Aug 27, 2021

Conversation

BeryJu
Copy link
Contributor

@BeryJu BeryJu commented Aug 26, 2021

This PR adds support for https://www.nicmanager.com/ which is a german DNS Provider.

API Documentation can be found here https://api.nicmanager.com/docs/v1/

This provider offers both "Anycast" and "FreeDNS", both of which have the same API, just on a different path.

@ldez
Copy link
Member

ldez commented Aug 26, 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 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.

make checks
  • do go mod tidy

@BeryJu
Copy link
Contributor Author

BeryJu commented Aug 26, 2021

Not quite sure what you mean by that

  • have a homogeneous design with the other providers
  • add tests (units)
make test
  • add tests ("live")
make test

Generate with wildcard (substituted the domain I tested with for example.com):

rm -rf .leg
wks jens in ~/lego on ﴱ beryjuorg-prd (authentik)bash -x test.sh
+ export NICMANAGER_API_EMAIL=jens@beryju.org
+ NICMANAGER_API_EMAIL=jens@beryju.org
+ export 'NICMANAGER_API_PASSWORD=xxxxxxxxxxx'
+ NICMANAGER_API_PASSWORD='xxxxxxxxxxx'
+ export NICMANAGER_API_OTP=xxxxxxxxxxxx
+ NICMANAGER_API_OTP=xxxxxxxxxxxx
  + ./main --dns.resolvers 8.8.8.8:53 --server=https://acme-staging-v02.api.letsencrypt.org/directory --dns nicmanager --email jens.langhammer@haufe-lexware.co--domains '*.example.com' --domains example.com run
2021/08/26 12:06:25 No key found for account jens@beryju.org. Generating a P256 key.
  2021/08/26 12:06:25 Saved key to /home/jens/lego/.lego/accounts/acme-staging-v02.api.letsencrypt.org/jens@beryju.org/keys/jens@beryju.org.key
2021/08/26 12:06:25 Please review the TOS at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
Do you accept the TOS? Y/n
y
2021/08/26 12:06:38 [INFO] acme: Registering account for jens@beryju.org
!!!! HEADS UP !!!
Your account credentials have been saved in your Let's Encrypt
configuration directory at "/home/jens/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.
2021/08/26 12:06:38 [INFO] [*.example.com, example.com] acme: Obtaining bundled SAN certificate
2021/08/26 12:06:39 [INFO] [*.example.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/361009418
2021/08/26 12:06:39 [INFO] [example.com] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/361009428
2021/08/26 12:06:39 [INFO] [*.example.com] acme: use dns-01 solver
2021/08/26 12:06:39 [INFO] [example.com] acme: Could not find solver for: tls-alpn-01
2021/08/26 12:06:39 [INFO] [example.com] acme: Could not find solver for: http-01
2021/08/26 12:06:39 [INFO] [example.com] acme: use dns-01 solver
2021/08/26 12:06:39 [INFO] [*.example.com] acme: Preparing to solve DNS-01
2021/08/26 12:06:39 [INFO] Create a new record for [zone: example.com, fqdn: _acme-challenge.example.com., domain: example.com]
2021/08/26 12:06:40 [INFO] [example.com] acme: Preparing to solve DNS-01
2021/08/26 12:06:40 [INFO] Create a new record for [zone: example.com, fqdn: _acme-challenge.example.com., domain: example.com]
2021/08/26 12:06:40 [INFO] [*.example.com] acme: Trying to solve DNS-01
2021/08/26 12:06:40 [INFO] [*.example.com] acme: Checking DNS record propagation using [8.8.8.8:53]
2021/08/26 12:06:42 [INFO] Wait for propagation [timeout: 5m0s, interval: 2s]
2021/08/26 12:06:42 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:44 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:46 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:48 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:50 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:52 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:54 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:56 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:06:58 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:00 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:02 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:04 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:07 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:09 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:11 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:13 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:15 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:17 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:19 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:21 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:23 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:25 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:27 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:29 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:31 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:33 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:35 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:37 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:39 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:41 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:43 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:45 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:47 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:49 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:51 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:53 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:55 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:57 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:07:59 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:01 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:03 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:05 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:07 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:09 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:11 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:13 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:15 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:17 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:19 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:22 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:24 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:26 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:28 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:30 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:32 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:34 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:36 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:38 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:40 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:42 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:44 [INFO] [*.example.com] acme: Waiting for DNS record propagation.
2021/08/26 12:08:52 [INFO] [*.example.com] The server validated our request
2021/08/26 12:08:52 [INFO] [example.com] acme: Trying to solve DNS-01
2021/08/26 12:08:52 [INFO] [example.com] acme: Checking DNS record propagation using [8.8.8.8:53]
2021/08/26 12:08:54 [INFO] Wait for propagation [timeout: 5m0s, interval: 2s]
2021/08/26 12:09:01 [INFO] [example.com] The server validated our request
2021/08/26 12:09:01 [INFO] [*.example.com] acme: Cleaning DNS-01 challenge
2021/08/26 12:09:02 [WARN] [*.example.com] acme: cleaning up failed: nicmanager: no record found to cleanup
2021/08/26 12:09:02 [INFO] [example.com] acme: Cleaning DNS-01 challenge
2021/08/26 12:09:02 [WARN] [example.com] acme: cleaning up failed: nicmanager: no record found to cleanup
2021/08/26 12:09:02 [INFO] [*.example.com, example.com] acme: Validations succeeded; requesting certificates
2021/08/26 12:09:03 [INFO] [*.example.com] Server responded with a certificate
wks jens in ~/lego on ﴱ beryjuorg-prd (authentik)

@ldez
Copy link
Member

ldez commented Aug 26, 2021

Offtopic
Did you know that each commit produces a notification?
I recommend creating a PR only when your PR is ready, and cleaning the git history to help the review.

@BeryJu
Copy link
Contributor Author

BeryJu commented Aug 26, 2021

Offtopic
Did you know that each commit produces a notification?
I recommend creating a PR only when your PR is ready, and cleaning the git history to help the review.

My bad, I was hoping that when I create the PR as a draft it wouldn't do that

dns/nicmanager: fix loading of env

dns/nicmanager: allow selection of mode (anycast/zone) and fix zone lookup

dns/nicmanager: fix missing Accept header

dns/nicmanager: fix password not being loaded, missing content type

dns/nicmanager: minimum allowed ttl is 900

dns/nicmanager: add generated files

dns/nicmanager: linting pass

dns/nicmanager: use correct http client

dns/nicmanager: bump default propagation timeout

dns/nicmanager: fix cleanup not working, check value of record

dns/nicmanager: always create record and don't update

dns/nicmanager: add additional checks for username, add basic tests

dns/nicmanager: add full unittests, squash commits
@BeryJu BeryJu marked this pull request as ready for review August 26, 2021 13:52
@ldez ldez self-requested a review August 26, 2021 15:04
@ldez ldez changed the title add nicmanager Add DNS provider for nicmanager Aug 26, 2021
@ldez ldez added this to the v4.5 milestone Aug 26, 2021
@ldez
Copy link
Member

ldez commented Aug 26, 2021

Are you a customer or a member of nicmanager?

@BeryJu
Copy link
Contributor Author

BeryJu commented Aug 27, 2021

Are you a customer or a member of nicmanager?

I am a customer

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.

Thank you 👍

@ldez ldez merged commit d2e526e into go-acme:master Aug 27, 2021
@BeryJu BeryJu deleted the add-nicmanager branch August 27, 2021 12:22
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