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 Timeweb Cloud #2301

Merged
merged 3 commits into from
Oct 13, 2024
Merged

Add DNS provider for Timeweb Cloud #2301

merged 3 commits into from
Oct 13, 2024

Conversation

paveloom
Copy link
Contributor

@paveloom paveloom commented Oct 13, 2024

@ldez ldez self-requested a review October 13, 2024 18:24
@ldez
Copy link
Member

ldez commented Oct 13, 2024

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

@paveloom

This comment was marked as outdated.

@ldez

This comment was marked as outdated.

@paveloom
Copy link
Contributor Author

paveloom commented Oct 13, 2024

Oh, right! I didn't notice that I deleted the one in my home directory.

$ rm -rf .lego
$ ./dist/lego -m contact@paveloom.dev --dns timewebcloud -d "*.paveloom.dev" -d paveloom.dev -s https://acme-staging-v02.api.letsencrypt.org/directory run
2024/10/13 21:41:29 No key found for account contact@paveloom.dev. Generating a P256 key.
2024/10/13 21:41:29 Saved key to /home/paveloom/Playground/lego-env/lego/.lego/accounts/acme-staging-v02.api.letsencrypt.org/contact@paveloom.dev/keys/contact@paveloom.dev.key
2024/10/13 21:41:30 Please review the TOS at https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf
Do you accept the TOS? Y/n
Y
2024/10/13 21:41:34 [INFO] acme: Registering account for contact@paveloom.dev
!!!! HEADS UP !!!!

Your account credentials have been saved in your Let's Encrypt
configuration directory at "/home/paveloom/Playground/lego-env/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.
2024/10/13 21:41:35 [INFO] [*.paveloom.dev, paveloom.dev] acme: Obtaining bundled SAN certificate
2024/10/13 21:41:35 [INFO] [*.paveloom.dev] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/14411159803
2024/10/13 21:41:35 [INFO] [paveloom.dev] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/14411159813
2024/10/13 21:41:35 [INFO] [*.paveloom.dev] acme: use dns-01 solver
2024/10/13 21:41:35 [INFO] [paveloom.dev] acme: Could not find solver for: tls-alpn-01
2024/10/13 21:41:35 [INFO] [paveloom.dev] acme: Could not find solver for: http-01
2024/10/13 21:41:35 [INFO] [paveloom.dev] acme: use dns-01 solver
2024/10/13 21:41:35 [INFO] [*.paveloom.dev] acme: Preparing to solve DNS-01
2024/10/13 21:41:36 [INFO] [paveloom.dev] acme: Preparing to solve DNS-01
2024/10/13 21:41:36 [INFO] [*.paveloom.dev] acme: Trying to solve DNS-01
2024/10/13 21:41:36 [INFO] [*.paveloom.dev] acme: Checking DNS record propagation. [nameservers=127.0.0.53:53]
2024/10/13 21:41:41 [INFO] Wait for propagation [timeout: 1m0s, interval: 5s]
2024/10/13 21:41:42 [INFO] [*.paveloom.dev] acme: Waiting for DNS record propagation.
2024/10/13 21:41:53 [INFO] [*.paveloom.dev] The server validated our request
2024/10/13 21:41:53 [INFO] [paveloom.dev] acme: Trying to solve DNS-01
2024/10/13 21:41:53 [INFO] [paveloom.dev] acme: Checking DNS record propagation. [nameservers=127.0.0.53:53]
2024/10/13 21:41:58 [INFO] Wait for propagation [timeout: 1m0s, interval: 5s]
2024/10/13 21:42:02 [INFO] [paveloom.dev] The server validated our request
2024/10/13 21:42:02 [INFO] [*.paveloom.dev] acme: Cleaning DNS-01 challenge
2024/10/13 21:42:02 [INFO] [paveloom.dev] acme: Cleaning DNS-01 challenge
2024/10/13 21:42:02 [INFO] [*.paveloom.dev, paveloom.dev] acme: Validations succeeded; requesting certificates
2024/10/13 21:42:02 [INFO] Wait for certificate [timeout: 30s, interval: 500ms]
2024/10/13 21:42:06 [INFO] [*.paveloom.dev] Server responded with a certificate.
$ tree .lego/
.lego/
├── accounts
│   └── acme-staging-v02.api.letsencrypt.org
│       └── contact@paveloom.dev
│           ├── account.json
│           └── keys
│               └── contact@paveloom.dev.key
└── certificates
    ├── _.paveloom.dev.crt
    ├── _.paveloom.dev.issuer.crt
    ├── _.paveloom.dev.json
    └── _.paveloom.dev.key

6 directories, 6 files

@ldez ldez added this to the v4.20 milestone Oct 13, 2024
@ldez
Copy link
Member

ldez commented Oct 13, 2024

Notes for the future me:

There is an official API client but this client is completely broken:

  • the code is generated and the module name is github.com/GIT_USER_ID/GIT_REPO_ID
  • the code contains redeclared constants
  • Even with fixes to the module name and the redeclared constants, the module doesn't compile.

timeweb-cloud/sdk-go#1

So, for now, this API client is unusable.

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.

LGTM

@ldez ldez merged commit 755164c into go-acme:master Oct 13, 2024
7 checks passed
@paveloom paveloom deleted the timeweb branch October 14, 2024 07:12
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.

Support for provider: Timeweb Cloud
2 participants