36 Commits

Author SHA1 Message Date
Aditya Bhargava
a1537c4d22 acme: version bump
* Bump acme-common to 1.5.0
  * New `abort` command added and logging behaviour improved
* Bump acme-acmesh to 3.1.1-r4
  * Fix logging and support killing from procd (`stop` and `abort`) via SIGTERM

Signed-off-by: Aditya Bhargava <rightaditya@gmail.com>
2025-10-08 20:27:32 +02:00
Aditya Bhargava
fbf38647fd acme.sh: add abort service command and improve interactive messages
For runs started interactively, improve messaging and allow a run to be
aborted with `service acme abort`.

Signed-off-by: Aditya Bhargava <rightaditya@gmail.com>
2025-10-08 20:27:32 +02:00
Aditya Bhargava
76b676e4eb acme.sh: move to procd to ensure logging gets to syslog
acme.sh error output never made it to the syslog, so:
* Add procd setup to catch stderr
* Make sure a message goes to syslog if acme.sh dies due to SIGINT

Signed-off-by: Aditya Bhargava <rightaditya@gmail.com>
2025-10-08 20:27:32 +02:00
Vladimir Kochnev
9f4e7726ec acme-common: support listen_port option
listen_port option allows to redefine the default 80/443 port
used in standalone/alpn challenges.

It's also useful for other types of challenges which require
accepting a connection on some TCP port so we need to expose
it via nft as well.

Signed-off-by: Vladimir Kochnev <hashtable@yandex.ru>
2025-10-02 13:14:11 +02:00
Satadru Pramanik, DO, MPH, MEng
b3098fe68a acme-common: cleanup acme start crontab migration
The '/etc/init.d/acme start' crontab migration
should also delete the existing
'/etc/init.d/acme start' line.

Otherwise, on every sysupgrade that carries
forward existing configurations, a new
'0 0 * * * /etc/init.d/acme renew' line is
added to the crontab.

Furthermore, do not add an 'acme renew' crontab
line if it already exists.

Signed-off-by: Satadru Pramanik, DO, MPH, MEng <satadru@gmail.com>
2025-09-03 23:25:08 +02:00
Florian Eckert
97dc4cf820 acme-common: update PKG_RELEASE
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2025-04-01 22:53:08 +02:00
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
Bartosz Cieślik
d4cf046433 acme-common: Resolve problem with webroot symlink
Signed-off-by: Bartosz Cieślik <bartoszcieslik2@gmail.com>
2025-02-16 19:47:00 +08: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
56e98f78b8 acme-common: migrate deprecated options
Add to uci-defaults script a migration from old deprecated options to new:
  use_staging to staging
  keylength to key_type
  remove standalone
  add missing validation_method

We still support the old options in the acme.init if old config was copied after installing of the newer version of the acme-common.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-06-03 10:09:09 +02:00
Sergey Ponomarev
6ffc7a2717 acme-common: create a symlink to webroot
The webroot option was deprecated and users should use the /var/run/acme/challenge by default.
The folder itself should be exposed to web.
The simplest way to do this is to create a symlink from /www.
This is a default web location for most routers and should cover most cases.

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-05-31 09:32:21 +02:00
Sergey Ponomarev
0b5ff1e1c5 acme-common: v1.2.0
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-05-27 10:28:24 +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
Toke Høiland-Jørgensen
d701cae191 net/acme-common: Fix example config
Make sure we quote all strings, and add missing "option" in second example.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2024-03-20 17:18:45 +01:00
Sergey Ponomarev
04ac8c177d acme-common: simplify config example
Make it more practical to easier get an idea

Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
2024-03-01 17:01:40 +01: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
8589f298a1 acme: remove redundant postinst
opkg runs uci-defaults if a package installs one, in acme-common's case
that's identical to postinst.

prerm shouldn't be run a image builder, so it's unnecessary to check
IPKG_INSTROOT

Signed-off-by: Glen Huang <me@glenhuang.com>
2023-04-26 22:42:26 +02: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
Toke Høiland-Jørgensen
e3d6422dc5 acme-common: Export canonical paths for storing certificates and challenges
The contract between the acme-common framework and consumers and hook
scripts is that certificates can be consumed from /etc/ssl/acme and that
web challenges are stored in /var/run/acme/challenge. Make this explicit by
exporting $CERT_DIR and $CHALLENGE_DIR as environment variables as well,
instead of having knowledge of those paths depend on out-of-band
information. We already exported $challenge_dir, but let's change it to
upper-case to make it clear that it's not a user configuration variable.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2022-12-14 15:28:23 +01:00
Glen Huang
b907223d57 acme: deprecate state_dir
state_dir is actually a hardcoded value in conffiles. Allowing users to
customize it could result in losing certificates after upgrading if they
don't also specify the dir as being preserved. We shouldn't default to
this dangerous behavior.

With the new ACME package, certificates live in the standard location
/etc/ssl/acme, users who need to do certificate customizations should
look for them in that dir instead.

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-12-14 21:15:52 +08:00
Glen Huang
8edcd33fb7 acme: simplify flock usage
Signed-off-by: Glen Huang <i@glenhuang.com>
2022-11-11 19:19:02 +08:00
Glen Huang
230c2d5fc4 acme: update changed packages' versions
Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-24 10:48:34 +08:00
Glen Huang
4e369cf780 acme: add dns_wait option
acme.sh by default use public DNS resolvers to check if TXT record was
correctly added when using DNS-01. This can be undesirable in a private
environment where the DNS server is not publicly accessible.

This option allows bypassing such check and simply waiting for a
specific length of time for the TXT record to take effect.

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-24 10:48:34 +08:00
Glen Huang
9d2d8787ca acme: fix staging option
Legacy use_staging option was not respected, and the example config
still use the legacy name.

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-24 10:48:34 +08:00
Glen Huang
7f04710579 amce: use procd to restart services
Directly calling `/etc/init.d/<service> reload` in a hotplug script can
inadvertently start a stopped service.

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-24 10:07:06 +08:00
Glen Huang
035cc09e7f acme: prevent concurrent running of acme get
Issuing certificates concurrently should not be supported.

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-24 10:06:49 +08:00
Glen Huang
cbc06f45b9 acme: make package create dir /etc/ssl/acme
Since the dir is a standardized one, it should not be created
dynamically

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-22 21:42:10 +08:00
Glen Huang
465f56adc2 acme: not creating state_dir in Makefile
Since state_dir can be customized, it should be create dynamically,
which it already does.

Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-22 21:38:44 +08:00
Glen Huang
671594bec2 acme: remove help info of unused command
Signed-off-by: Glen Huang <i@glenhuang.com>
2022-10-06 18:38:47 +02: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