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

Error trying to start HTTP API - cenkalti/backoff timer exception #205

Closed
Elte156 opened this issue Jan 9, 2020 · 3 comments · Fixed by #206
Closed

Error trying to start HTTP API - cenkalti/backoff timer exception #205

Elte156 opened this issue Jan 9, 2020 · 3 comments · Fixed by #206

Comments

@Elte156
Copy link

Elte156 commented Jan 9, 2020

I am getting an error trying to run the binary. Steps to reproduce:

docker run -it ubuntu:18.04 bash

apt-get update
apt-get -y install wget git gcc
wget --no-check-certificate https://dl.google.com/go/go1.13.5.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.13.5.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile
source /etc/profile
go version
cd

# Original instructions to build binary
git clone https://github.com/joohoi/acme-dns
cd acme-dns
export GOPATH=/tmp/acme-dns
go build

# This is needed otherwise a database file cannot be created
adduser --system --gecos "acme-dns Service" --disabled-password --group --home /var/lib/acme-dns acme-dns
# Start binary using default config.cfg from repo
./acme-dns

This ends up with the following output:

root@796d06c1261c:~/acme-dns# ./acme-dns
INFO[0000] Using config file                             file=./config.cfg
INFO[0000] Connected to database
DEBU[0000] Adding new record to domain                   domain=auth.example.org. recordtype=A
DEBU[0000] Adding new record to domain                   domain=auth.example.org. recordtype=NS
DEBU[0000] Adding new record to domain                   domain=auth.example.org. recordtype=SOA
INFO[0000] Listening DNS                                 addr="127.0.0.1:53" proto=udp
INFO[0000] Listening DNS                                 addr="127.0.0.1:53" proto=tcp
INFO[0000] 2020/01/09 01:50:26 [INFO][cache:0xc0000aa550] Started certificate maintenance routine
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x887735]

goroutine 24 [running]:
time.(*Timer).Stop(...)
        /usr/local/go/src/time/sleep.go:74
github.com/cenkalti/backoff/v3.(*defaultTimer).Stop(0xc0000a20b0)
        /tmp/acme-dns/pkg/mod/github.com/cenkalti/backoff/[email protected]/timer.go:32 +0x25
github.com/cenkalti/backoff/v3.RetryNotifyWithTimer.func1(0xb8ae60, 0xc0000a20b0)
        /tmp/acme-dns/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:45 +0x31
github.com/cenkalti/backoff/v3.RetryNotifyWithTimer(0xc0002ae0c8, 0x7f5378069438, 0xc00028c3a0, 0x0, 0xb8ae60, 0xc0000a20b0, 0x0, 0x0)
        /tmp/acme-dns/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:53 +0x34d
github.com/cenkalti/backoff/v3.RetryNotify(...)
        /tmp/acme-dns/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:31
github.com/cenkalti/backoff/v3.Retry(...)
        /tmp/acme-dns/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:25
github.com/go-acme/lego/v3/acme/api.(*Core).retrievablePost(0xc0001241e0, 0xc00040c400, 0x3a, 0xc000290260, 0x1d, 0x20, 0x9d4a80, 0xc0000704e0, 0xc000116208, 0xc0000705a0, ...)
        /tmp/acme-dns/pkg/mod/github.com/go-acme/lego/[email protected]/acme/api/api.go:107 +0x210
github.com/go-acme/lego/v3/acme/api.(*Core).post(0xc0001241e0, 0xc00040c400, 0x3a, 0xa7e460, 0xc0000705a0, 0x9d4a80, 0xc0000704e0, 0x0, 0xc0001162d0, 0x8886ce)
        /tmp/acme-dns/pkg/mod/github.com/go-acme/lego/[email protected]/acme/api/api.go:70 +0xf5
github.com/go-acme/lego/v3/acme/api.(*AccountService).New(0xc0001242a0, 0x0, 0x0, 0x1170730, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, ...)
        /tmp/acme-dns/pkg/mod/github.com/go-acme/lego/[email protected]/acme/api/account.go:16 +0x150
github.com/go-acme/lego/v3/registration.(*Registrar).Register(0xc00028c2c0, 0xc000087e01, 0xc0000de640, 0x3a, 0xc00028e568)
        /tmp/acme-dns/pkg/mod/github.com/go-acme/lego/[email protected]/registration/registar.go:58 +0x139
github.com/mholt/certmagic.(*Config).newACMEClient(0xc0001240f0, 0x0, 0x0, 0x0, 0x0)
        /tmp/acme-dns/pkg/mod/github.com/mholt/[email protected]/client.go:221 +0x3d7
github.com/mholt/certmagic.(*Config).newManager(0xc0001240f0, 0xc0000a0600, 0x10, 0x0, 0x0, 0x0)
        /tmp/acme-dns/pkg/mod/github.com/mholt/[email protected]/client.go:121 +0x3ad
github.com/mholt/certmagic.(*Config).ObtainCert(0xc0001240f0, 0xb8cae0, 0xc00009e030, 0xc0000a06c0, 0x10, 0x0, 0x0, 0x0)
        /tmp/acme-dns/pkg/mod/github.com/mholt/[email protected]/config.go:455 +0xc6
github.com/mholt/certmagic.(*Config).manageOne(0xc0001240f0, 0xb8cae0, 0xc00009e030, 0xc0000a06c0, 0x10, 0xa96dc0, 0xc000109120)
        /tmp/acme-dns/pkg/mod/github.com/mholt/[email protected]/config.go:411 +0x115
github.com/mholt/certmagic.(*Config).manageAll(0xc0001240f0, 0x0, 0x0, 0xc0002af3d8, 0x1, 0x1, 0x0, 0x0, 0x0)
        /tmp/acme-dns/pkg/mod/github.com/mholt/[email protected]/config.go:394 +0x1d1
github.com/mholt/certmagic.(*Config).ManageSync(...)
        /tmp/acme-dns/pkg/mod/github.com/mholt/[email protected]/config.go:320
main.startHTTPAPI(0xc000070960, 0xc00009e440, 0xc, 0xc00009e468, 0x4, 0xc0000a06c0, 0x10, 0xc0000a0700, 0x10, 0xc0000a0740, ...)
        /root/acme-dns/main.go:166 +0x1025
created by main.main
        /root/acme-dns/main.go:92 +0x977

If this is an issue caused by using the default config.cfg, what do I need to change to make it work?

@joohoi
Copy link
Owner

joohoi commented Jan 9, 2020

Oh, I'm awfully sorry. The first attempt to fix the original issue in #201 apparently introduced this bug. The module update commit is reverted by the PR referenced above.

@Elte156
Copy link
Author

Elte156 commented Jan 9, 2020

To be honest, I don't think PR #203 introduced this.

See my comment from the other closed #201 .
#201 (comment)
I was getting this same exact error prior to you merging in #203 .

Are you able to follow my steps above and get the same errors?

@Elte156
Copy link
Author

Elte156 commented Jan 9, 2020

Nevermind.

I rebuilt against:

commit 3d5a512d1ed5c437d133ac9839a7cd31b8275c89 (HEAD -> master, origin/master, origin/HEAD)

It seems to be working now.

root@796d06c1261c:~/acme-dns# ./acme-dns
INFO[0000] Using config file                             file=./config.cfg
INFO[0000] Connected to database
DEBU[0000] Adding new record to domain                   domain=auth.example.org. recordtype=A
DEBU[0000] Adding new record to domain                   domain=auth.example.org. recordtype=NS
DEBU[0000] Adding new record to domain                   domain=auth.example.org. recordtype=SOA
INFO[0000] Listening DNS                                 addr="127.0.0.1:53" proto=udp
INFO[0000] Listening DNS                                 addr="127.0.0.1:53" proto=tcp
INFO[0000] 2020/01/09 07:04:22 [INFO][cache:0xc0000a85f0] Started certificate maintenance routine
INFO[0000] 2020/01/09 07:04:23 [INFO][auth.example.org] Obtain certificate
INFO[0000] [INFO] [auth.example.org] acme: Obtaining bundled SAN certificate
INFO[0001] [INFO] [auth.example.org] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/31791525
INFO[0001] [INFO] [auth.example.org] acme: Could not find solver for: tls-alpn-01
INFO[0001] [INFO] [auth.example.org] acme: Could not find solver for: http-01
INFO[0001] [INFO] [auth.example.org] acme: use dns-01 solver
INFO[0001] [INFO] [auth.example.org] acme: Preparing to solve DNS-01
INFO[0001] [INFO] [auth.example.org] acme: Trying to solve DNS-01
INFO[0001] [INFO] [auth.example.org] acme: Checking DNS record propagation using [192.168.65.1:53]
INFO[0001] [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
INFO[0008] [INFO] [auth.example.org] acme: Cleaning DNS-01 challenge
INFO[0008] [INFO] Unable to deactivate the authorization: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/31791525
INFO[0008] 2020/01/09 07:04:31 [ERROR][auth.example.org] failed to obtain certificate: acme: Error -> One or more domains had a problem:
INFO[0008] [auth.example.org] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.auth.example.org, url: (attempt 1/3; challenge=dns-01)
INFO[0009] [INFO] [auth.example.org] acme: Obtaining bundled SAN certificate
INFO[0010] [INFO] [auth.example.org] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/31791553
INFO[0010] [INFO] [auth.example.org] acme: Could not find solver for: tls-alpn-01
INFO[0010] [INFO] [auth.example.org] acme: Could not find solver for: http-01
INFO[0010] [INFO] [auth.example.org] acme: use dns-01 solver
INFO[0010] [INFO] [auth.example.org] acme: Preparing to solve DNS-01
INFO[0010] [INFO] [auth.example.org] acme: Trying to solve DNS-01
INFO[0010] [INFO] [auth.example.org] acme: Checking DNS record propagation using [192.168.65.1:53]
INFO[0010] [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
INFO[0017] [INFO] [auth.example.org] acme: Cleaning DNS-01 challenge
INFO[0017] [INFO] Unable to deactivate the authorization: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/31791553
INFO[0017] 2020/01/09 07:04:40 [ERROR][auth.example.org] failed to obtain certificate: acme: Error -> One or more domains had a problem:
INFO[0017] [auth.example.org] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.auth.example.org, url: (attempt 2/3; challenge=dns-01)
INFO[0018] [INFO] [auth.example.org] acme: Obtaining bundled SAN certificate
INFO[0018] [INFO] [auth.example.org] AuthURL: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/31791591
INFO[0018] [INFO] [auth.example.org] acme: Could not find solver for: tls-alpn-01
INFO[0018] [INFO] [auth.example.org] acme: Could not find solver for: http-01
INFO[0018] [INFO] [auth.example.org] acme: use dns-01 solver
INFO[0018] [INFO] [auth.example.org] acme: Preparing to solve DNS-01
INFO[0018] [INFO] [auth.example.org] acme: Trying to solve DNS-01
INFO[0018] [INFO] [auth.example.org] acme: Checking DNS record propagation using [192.168.65.1:53]
INFO[0018] [INFO] Wait for propagation [timeout: 1m0s, interval: 2s]
INFO[0018] [INFO] [auth.example.org] acme: Cleaning DNS-01 challenge
INFO[0019] [INFO] Unable to deactivate the authorization: https://acme-staging-v02.api.letsencrypt.org/acme/authz-v3/31791591
INFO[0019] 2020/01/09 07:04:41 [ERROR][auth.example.org] failed to obtain certificate: acme: Error -> One or more domains had a problem:
INFO[0019] [auth.example.org] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.auth.example.org, url: (attempt 3/3; challenge=dns-01)
FATA[0020] auth.example.org: obtaining certificate: failed to obtain certificate: acme: Error -> One or more domains had a problem:
[auth.example.org] acme: error: 400 :: urn:ietf:params:acme:error:dns :: DNS problem: NXDOMAIN looking up TXT for _acme-challenge.auth.example.org, url:
root@796d06c1261c:~/acme-dns#

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants