Commit Graph

36 Commits

Author SHA1 Message Date
Toke Høiland-Jørgensen d926da5182 acme: switch from iptables to nft
Use nft instead of iptables to open port 80 in the firewall when getting a
cert. Since nft doesn't allow deleting a rule by its contents, capture and
save the handle when creating the rule, and use that to delete.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2022-05-20 13:16:59 -07:00
Georgi Valkov 468fc5fca4 acme: update to 3.0.1
Default to letsencrypt because the upstream default may change.
Passing --staging is no longer needed, since --serever will
select a staging server if needed.

Signed-off-by: Georgi Valkov <gvalkov@abv.bg>
Tested-by: Georgi Valkov <gvalkov@abv.bg>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
2021-10-10 09:35:41 +02:00
Dennis Schüsselbauer d69534751e acme: Fix uhttpd restart to load new certificates
Fixes issue #16256

Signed-off-by: Dennis Schüsselbauer <scde@users.noreply.github.com>
2021-09-01 23:05:45 -07:00
Wakatatsu Ryou 98985a9561 acme: add haproxy support
Signed-off-by: Wakatatsu Ryou <lialosiu@gmail.com>
2021-09-01 14:13:53 -07:00
Rosen Penev a9bb04058a acme: run through shellcheck
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-06-25 22:09:19 -07:00
Rosen Penev f6ef44044d acme: update to 2.9.0
Switch to AUTORELEASE to avoid bumping PKG_RELEASE all the time.

Run shell scripts through shfmt -w -ci -bn -sr -s in order to have a
standard style.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2021-06-25 22:08:04 -07:00
Toke Høiland-Jørgensen c931276955 acme: Get listener name from /proc/PID/exe instead of netstat output
It seems the command name output from netstat can be truncated in weird
ways, so let's get the binary name from /proc instead and use that for
matching which listener we have.

Fixes #15071.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2021-03-26 20:06:34 +01:00
Peter Stadler e553f0cf70 acme: adopt to new behavior of nginx
Signed-off-by: Peter Stadler <peter.stadler@student.uibk.ac.at>
2021-02-08 23:51:55 +01:00
Jannis Pinter b5259ef5da Add option for days until renewal
Signed-off-by: Jannis Pinter <jannis+openwrt@pinterjann.is>
2020-10-29 10:44:57 +01:00
Meano 0a23f1f066 acme: fix the 'Unknown parameter' problem caused by acme_server
Signed-off-by: Meano <meano@foxmail.com>
2020-10-19 01:47:43 +08:00
Jannis Pinter 3f7d03eda6 acme: Allow custom ACME server directory URL
The underlying `acme.sh` allows custom ACME server URLs (using `--server`). Adding the necessary field to specify a custom ACME server URL from UCI.

Signed-off-by: Jannis Pinter <jannis+openwrt@pinterjann.is>
2020-10-16 21:47:42 +02:00
Toke Høiland-Jørgensen e6c1676cb4 acme: Make sure we don't handle the same listener twice
If a daemon listens on multiple addresses at once, it'll show up multiple
times in get_listeners() which will clobber the config for uhttpd. Fix this
by skipping subsequent handlings of the same daemon binary.

Fixes #13325.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2020-09-09 12:49:53 +02:00
Florian Eckert 8e34825f78 acme: fix alignment space vs tabs
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-08-05 11:33:19 +02:00
Will O'Neill 99cc5bbd97 acme: Update acme.sh URL, add support for challenge & domain alises.
Signed-off-by: Will O'Neill <0100wrxb@gmail.com>
2020-05-10 16:54:41 -07:00
Antti Seppälä debe65dffe acme: add support for user-provided setup and cleanup scripts
Add possibility for user to provide setup and cleanup scripts for
additional flexibility. Setup-script takes precedence over the built-in
behavior of acme.

This helps users with more complex use-cases to utilize acme to update
certificates without adding complexity to the provided run.sh script.

Signed-off-by: Antti Seppälä <a.seppala@gmail.com>
2020-04-30 19:17:54 +03:00
David Yang 0d2240481b acme: Handle ecc cert correctly
Error was:
  The domain 'example.com' seems to have a ECC cert already, please add '--ecc' parameter if you want to use that cert.

Signed-off-by: David Yang <mmyangfl@gmail.com>
2020-04-27 17:54:36 +08:00
David Yang 6a4c1b2051 acme: Handle log message correctly
Error was:
  logger: unrecognized option: renew

Signed-off-by: David Yang <mmyangfl@gmail.com>
2020-04-27 17:51:18 +08:00
Toke Høiland-Jørgensen 983cc995a3 acme: Correctly handle domain state dir for ECC certificates
When issuing an ECC certificate, acme.sh for some reason changes the name
of the directory used for the certificate state. Handle this correctly when
moving directories and updating config files.

Fixes #7941.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2020-01-12 19:59:01 +01:00
Toke Høiland-Jørgensen 7235249df6 acme: Log acme.sh command invocation
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2019-10-23 12:26:21 +02:00
Toke Høiland-Jørgensen 5ade8f3392 ACME: Fix missing quotes in variable comparisons
The variables can be empty if not set in the UCI config.

Reported-by: Petr Novák <petrn@me.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
2019-03-22 13:45:11 +01:00
Adrien DAURIAT 3439c008e5 acme: Fix loading credentials
Move loading credential function before cert renewal call as credentials might be needed for some renewal operations ( ex: DNS )

Signed-off-by: Adrien DAURIAT <16813527+dauriata@users.noreply.github.com>
[toke@toke.dk: Port to master branch]
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2019-02-08 17:17:13 +01:00
Alexey I. Froloff c636bf374f net/acme: commit uhttpd configuration if update_httpd set
uhttpd configuration should be commited when update_uhttpd set.

Signed-off-by: Alexey I. Froloff <raorn@raorn.name>
2019-02-07 15:22:56 +03:00
Alexey I. Froloff 8564f61d50 net/acme: issue_cert should always call post_checks on exit
issue_cert fuction may return without calling post_checks, which leaves
port 80 open and uhttpd configuration is not restored is listen_http was
set.

Always call post_checks when returning from issue_cert.

Signed-off-by: Alexey I. Froloff <raorn@raorn.name>
2019-02-07 15:22:39 +03:00
Toke Høiland-Jørgensen 6bd59471bb acme: Fix arithmetic syntax
Thanks to @jow- for pointing out the mistake.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2018-09-19 17:57:22 +02:00
Toke Høiland-Jørgensen a96c90b6f5 acme: Fix whitespace and long lines, bump package rev
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2018-09-19 16:29:55 +02:00
Ansuel Smith 924e2f53e2 acme: add support for nginx webserver
This adds a metapakcge for acme luci ap without uhttpd dependency and adds entities and check to stop handle nginx server and modify the certificate set automatically.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2018-09-19 16:21:00 +02:00
Toke Høiland-Jørgensen 56b6d49ce4 acme: Fix bugs from upstream's change to socat
The upstream acme.sh package changed to using socat instead of netcat;
update the dependencies to reflect this, and pass --listen-v6 when running
in standalone mode (since socat only listens on IPv4 by default).

Also add a missing cleanup call when certificate issuance fails.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2018-08-22 16:03:15 +02:00
Toke Høiland-Jørgensen 7e1dfc2dc5 acme: Change boot init script logic to invoke start
The new procd config dependency tracking requires the start method to be
called even on boot. So add a state file that is checked by the run script
to condition the special-case boot run instead of the previous independent
call to the run script.

Ref: https://github.com/openwrt/luci/pull/1769

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2018-05-07 11:48:26 +02:00
Zhong Jianxin b528ec5e79 acme: Support DNS mode
Tested with dynu.com ddns.

Install acme-dnsapi:

    # opkg install acme-dnsapi

Example `/etc/config/acme`:

    config acme
        option state_dir '/etc/acme'
        option account_email email@example.org'
        option debug '0'

    config cert 'foo'
        option enabled '1'
        option use_staging '1'
        option keylength '2048'
        option update_uhttpd '0'
        option dns 'dns_dynu'
        list domains 'foo.dynu.com'
        list domains '*.foo.dynu.com'
        list credentials 'Dynu_ClientId="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"'
        list credentials 'Dynu_Secret="yyyyyyyyyyyyyyyyyyyyyyyyy"'

Run:

    # /etc/init.d/acme start

Signed-off-by: Zhong Jianxin <azuwis@gmail.com>
2018-04-19 11:05:35 +02:00
Aleksei Nosachev 8599b8d7a3 Fix acme-challenge ./well-known check / webroot detection (#4339)
fixes webroot to be defined as 
_currentRoot='/www'
instead of being interpreted as
_currentRoot='"/www"'

Signed-off-by: Aleksei Nosachev <nos1609@hotmail.com>
2017-05-10 14:30:43 +02:00
Toke Høiland-Jørgensen 34ed7a9f2c acme: Support running in webroot mode, detect other daemons on port 80
For configurations where another web server is running on port 80, running
acme.sh in standalone mode fails. Try to detect this and refuse to run; and
allow the user to configure a webroot directory to use the running webserver for
certificate verification.

This also updates acme.sh to the latest version.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2017-04-26 16:32:24 +02:00
Daniel H 37f6cae850 acme: Fix for curl linked against mbed TLS. (#4254)
Use newest acme.sh release (2.6.8).
Remove dependency on ca-certificates and add dependency on ca-bundle.
Update environment variable.

Signed-off-by: Daniel Halmschlager <da@halms.at>
2017-04-12 22:51:57 +02:00
Toke Høiland-Jørgensen 4cebee84ca acme: Update to v1.4.
This updates to the latest git version of acme.sh and drops the patch to
disable timestamps from the output (since that is now supported
upstream).

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2016-11-28 23:14:24 +01:00
Toke Høiland-Jørgensen 5a90e41b30 acme: Update to v1.3.
This version handles transitioning from a previous certificate that was
issues using the staging server, adds more debug logging, and handles
state directories better if issuing fails.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2016-11-25 15:42:16 +01:00
Toke Høiland-Jørgensen 20d7233913 acme: New version 1.2.
This version will use the standalone (netcat) mode of acme.sh during
verification instead of exposing uhttpd to the internet for the duration
of the verification. It will also add an ip6tables rule to also support
verification over IPv6.

Also contains an updated version of acme.sh.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2016-11-04 12:43:16 +01:00
Toke Høiland-Jørgensen a1d617bd8b acme: Add package.
This adds a package wrapping the acme.sh script from
https://github.com/Neilpang/acme.sh in Uci config and hooks to interact
correctly with uhttpd.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2016-08-05 17:41:09 +02:00