Commit Graph

12 Commits

Author SHA1 Message Date
Florian Eckert
692f3afe4a acme: remove crontab entry if service is stopped
Until now it was not possible to stop the acme service, because the handling
was done via cron. With this change, the acme handler can now be stopped by
calling '/etc/init.d/acme' stop. This call removes the entry from the crontab.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 22:53:08 +02:00
Florian Eckert
e73688d178 acme: remove lock handling
Since procd is now used, the call of '/etc/init.d/acme' does not have to be
locked separately. This code block can therefore be removed.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 22:53:08 +02:00
Florian Eckert
420210b318 acme: fix service_triggers on config change
In the current implementation, the config change trigger is no longer set
at boot time. This is because during boot, only the '$CHALLENGE_DIR' is
created with the boot function. The 'start_service' is first called by first
cron call at midnight. This call is installing the service_triggers reload
handling.

To fix this, add a new extra_command 'renew' that is responsible to renew
the acme. This function is called from cron and the start_service
function does the rest.

* Create directories
* Install service reload trigger form acme config change

Fixes: 76f17ab15b (acme-common: Create challenge directory on boot)

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 22:53:08 +02:00
Toke Høiland-Jørgensen
76f17ab15b acme-common: Create challenge directory on boot
The challenge directory (for webroot challenges) is on a tmpfs, which
means it doesn't exist on boot. Some web servers (uhttpd in particular)
don't like being configured to serve files from a non-existent
directory. So add a boot() section to the ACME init script that just
creates the challenge directory, and make sure it runs relatively early.
That should take care of the non-existent directory issue, while still
keeping the actual certificate renewal controlled by cron.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2024-12-12 20:49:06 +01:00
Sergey Ponomarev
e2d21302f2 acme-common: export main_domain
To avoid confusion, first create the main_domain var and only then export it.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-06-03 10:09:09 +02:00
Sergey Ponomarev
dd662f8a12 acme-common: fallback to deprecated use_staging if the staging option is not set
The use_staging option was deprecated in 9d2d8787ca.
But it still has a bigger priority than the staging option.
This happens because config_get_bool returns 0 when the use_staging option wasn't set.
So the next check for the staging var emptiness is always false.

As the simplest fix, use the config_get staging that returns a plain string when the option is not set and if it's empty then fallback to the use_staging.

Once the use_staging option is removed we should get back to the config_get_bool staging.

Also use config_get_bool debug.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-05-26 09:53:22 +02:00
Sergey Ponomarev
7d07c75154 acme-common: use validation_method option instead of guessing
The new validation_method option can be: dns, webroot or standalone.
Previously we guessed the challenge type:
1. if the DNS provider is specified then it's dns
2. if standalone=1
3. fallback to webroot

The logic is preserved and if the validation_method wasn't set explicitly we'll guess it in old manner.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-03-01 17:01:40 +01:00
Glen Huang
6d61014e51 acme: standardize key_type
keylength, being an acme.sh value type, uses pure numbers for rsa keys.
This can be disorienting for other acme clients. This change introduces
a new option "key_type" that aims to remove this ambiguity, and makes
all key type names follow the same pattern, making acme-common more
client agnostic.

Signed-off-by: Glen Huang <me@glenhuang.com>
2023-05-18 12:48:47 +08:00
Glen Huang
38eeca5df9 acme-common: no exporting webroot
ACME clients shouldn't deal with deprecated values. They should be
processed by acme-common.

Reformatting is done by shfmt.

Signed-off-by: Glen Huang <me@glenhuang.com>
2023-05-17 17:27:38 +08:00
Glen Huang
e1f03d7ee4 acme: fix incompatibilty with image builder
Signed-off-by: Glen Huang <i@glenhuang.com>
2023-03-03 23:43:01 +01:00
Glen Huang
c6960a2bdc acme: merge cli into init script
Signed-off-by: Glen Huang <i@glenhuang.com>
2023-03-01 15:38:02 +01:00
Glen Huang
e84f651453 acme: use the hotplug system
Signed-off-by: Glen Huang <heyhgl@gmail.com>
2022-08-16 00:32:04 +02:00