Skip to content

caddy removes expired cert resource and breaks auto renewal #4776

@liny01-nbsa

Description

@liny01-nbsa

I used Caddy a few weeks back, and at the time the certs works properly. And on the most recent usage, I see the below logs and error.

What the recommended steps to restore this setup in working order?

2022/05/09 12:10:04.504 INFO    admin   admin endpoint started  {"address": "tcp/localhost:3019", "enforce_origin": false, "origins": ["//localhost:3019", "//[::1]:3019", "//127.0.0.1:3019"]}
2022/05/09 12:10:04.505 INFO    tls.cache.maintenance   started background certificate maintenance      {"cache": "0xc000024cb0"}
2022/05/09 12:10:04.506 INFO    http    server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 443}
2022/05/09 12:10:04.506 INFO    http    enabling automatic HTTP->HTTPS redirects        {"server_name": "srv0"}
2022/05/09 12:10:04.562 INFO    pki.ca.local    root certificate is already trusted by system   {"path": "storage:pki/authorities/local/root.crt"}
2022/05/09 12:10:04.562 INFO    pki     intermediate expires soon; renewing     {"ca": "local", "time_remaining": -888682.5628871}
2022/05/09 12:10:04.568 INFO    pki     renewed intermediate    {"ca": "local", "new_expiration": "2022/05/16 12:10:04.000"}
2022/05/09 12:10:04.570 INFO    http    enabling automatic TLS certificate management   {"domains": ["localhost"]}
2022/05/09 12:10:04.595 WARN    tls     stapling OCSP   {"error": "no OCSP stapling for [localhost]: no OCSP server specified in certificate", "identifiers": ["localhost"]}
2022/05/09 12:10:04.596 INFO    tls     cleaning storage unit   {"description": "FileStorage:C:\\Users\\XXXXXX\\AppData\\Roaming\\Caddy"}
2022/05/09 12:10:04.597 INFO    autosaved config (load with --resume flag)      {"file": "C:\\Users\\XXXXXX\\AppData\\Roaming\\Caddy\\autosave.json"}
2022/05/09 12:10:04.598 INFO    admin.api       load complete
2022/05/09 08:10:04 [INFO] Certificate certificates/local/localhost/localhost.crt expired 370h41m40.6010362s ago; cleaning up
2022/05/09 08:10:04 [INFO] Deleting certificates/local/localhost/localhost.crt because resource expired
2022/05/09 08:10:04 [INFO] Deleting certificates/local/localhost/localhost.key because resource expired
2022/05/09 08:10:04 [INFO] Deleting certificates/local/localhost/localhost.json because resource expired
2022/05/09 08:10:04 [INFO] Deleting certificates/local/localhost because key is empty

Here the localhost key resources are being removed.

2022/05/09 12:10:04.603 INFO    tls     finished cleaning storage units
2022/05/09 12:10:04.605 INFO    admin   stopped previous server {"address": "tcp/localhost:2019"}
2022/05/09 12:10:04.608 INFO    tls.renew       acquiring lock  {"identifier": "localhost"}
2022/05/09 12:10:04.609 INFO    tls.renew       lock acquired   {"identifier": "localhost"}
2022/05/09 12:10:04.609 ERROR   tls.renew       will retry      {"error": "open C:\\Users\\XXXXXX\\AppData\\Roaming\\Caddy\\certificates\\local\\localhost\\localhost.key: The system cannot find the path specified.", "attempt": 1, "retrying_in": 60, "elapsed": 0, "max_duration": 2592000}
2022/05/09 12:11:04.622        ERROR   tls.renew       will retry      {"error": "open C:\\Users\\XXXXXX\\AppData\\Roaming\\Caddy\\certificates\\local\\localhost\\localhost.key: The system cannot find the path specified.", "attempt": 2, "retrying_in": 120, "elapsed": 60.0119546, "max_duration": 2592000}

Here is the error when it's used in renewal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐞Something isn't workingdeferred ⏰We'll come back to this later

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions