acme.sh/deploy
Pablo 41bdd4cd0e
Some checks are pending
DNS / CheckToken (push) Waiting to run
DNS / Fail (push) Blocked by required conditions
DNS / Docker (push) Blocked by required conditions
DNS / MacOS (push) Blocked by required conditions
DNS / Windows (push) Blocked by required conditions
DNS / FreeBSD (push) Blocked by required conditions
DNS / GhostBSD (push) Blocked by required conditions
DNS / OpenBSD (push) Blocked by required conditions
DNS / NetBSD (push) Blocked by required conditions
DNS / DragonFlyBSD (push) Blocked by required conditions
DNS / MidnightBSD (push) Blocked by required conditions
DNS / Solaris (push) Blocked by required conditions
DNS / Omnios (push) Blocked by required conditions
DNS / OpenIndiana (push) Blocked by required conditions
DNS / Tribblix (push) Blocked by required conditions
DNS / Haiku (push) Blocked by required conditions
DNS / Hurd (push) Blocked by required conditions
DNS / OpenEuler (push) Blocked by required conditions
Build DockerHub / CheckToken (push) Waiting to run
Build DockerHub / build (push) Blocked by required conditions
Shellcheck / ShellCheck (push) Waiting to run
Shellcheck / shfmt (push) Waiting to run
Add UniFi OS Server deploy hook (#7184)
* Add UniFi OS Server deploy hook

Uses UniFi OS Server's local REST API (login, list, upload, activate,
remove superseded) since it stores certificates in its own Postgres
database rather than flat config files, unlike the Cloud Key/UDM
hardware covered by the existing unifi deploy hook. Tested against
real instances on both macOS and Ubuntu 26.04 (self-hosted, remote).

* Address review: portable sed/grep, scoped HTTPS_INSECURE, fingerprint matching

- Replace GNU-only \n in sed replacement with a portable literal newline
  (matches dnsapi/dns_cpanel_uapi.sh, dnsapi/dns_glesys.sh); pipe the
  list response through _normalizeJson first for consistent formatting.
- Use grep -F for the domain-name match instead of an unescaped BRE --
  a wildcard cert name (*.example.com) broke the regex.
- Drop \W (undocumented, GNU-only) from the cookie lookup in favor of
  an anchored `^Set-Cookie: *NAME=` match.
- Scope HTTPS_INSECURE=1 inside the hook (matches deploy/proxmoxve.sh,
  deploy/fritzbox.sh) instead of requiring the caller to export it for
  the whole acme.sh run, which would also disable verification for the
  connection to the ACME CA.
- On a duplicate-certificate response, match the existing entry by
  fingerprint instead of taking the first name match -- with more than
  one stale entry for a domain, the wrong one could get activated.
- Check the list endpoint's response code before proceeding.
- Save username/password with the "base64" flag (matches
  deploy/synology_dsm.sh) since _save_conf wraps values in unescaped
  single quotes.

* Rework certificate handling: unique names per upload, drop cleanup

Testing against a real UniFi OS Server showed the server enforces name
uniqueness independently of fingerprint uniqueness, and that activation is
exclusive server-wide regardless of name/domain. A unique name per upload
avoids the name-collision path entirely (previously only handled as a
retry-of-identical-content edge case), and removes the need for the
post-hoc cleanup loop, which risked deleting the wrong entry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Shorten generated certificate name to Unix epoch seconds

Real-hardware testing showed the UniFi OS Server certificate list's name
column is fixed-width and doesn't wrap, so a full human-readable timestamp
overlaps the Expires column and makes both unreadable. Epoch seconds are
still short enough to fit while remaining unique.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Add scoped cleanup of old certificate entries, use _time helper

Per review: dropping cleanup entirely went further than the original bug
required, and left old entries (each holding a private key) accumulating
indefinitely. Since every upload now gets a name unique to its domain and
run, cleanup can safely target only entries whose name starts with that
domain -- entries this hook itself created -- excluding the one just
activated. Also swaps date +%s for the core _time helper, and rewrote the
design comments to make them clearer and match the current behavior
instead of the pre-redesign one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-13 14:57:44 +08:00
..
ali_cdn.sh Update timestamp variable in ali_cdn.sh 2025-12-22 17:00:22 +08:00
ali_dcdn.sh Update timestamp function in ali_dcdn.sh 2025-12-22 17:00:31 +08:00
apache.sh deploy apache script: fix comment (dovecot/apache) 2017-03-02 08:39:31 +01:00
baidu_cdn.sh Add Baidu Cloud CDN deploy hook (#6951) 2026-07-12 16:15:59 +08:00
byteplus_alb.sh fix bug for solaris. 2026-07-17 12:38:14 +08:00
cachefly.sh format adjustment 2024-04-07 12:36:19 +00:00
cleverreach.sh Make CI happy 2021-03-30 09:18:33 +02:00
consul.sh Fix the shfmt check 2021-05-07 12:12:30 +02:00
cpanel_uapi.sh fix cpanel_uapi: pass --user to DomainInfo list_domains when run as root 2026-07-19 10:20:58 +08:00
directadmin.sh deployhook Directadmin: Support for selecting the scheme of DirectAdmin , HTTP or HTTPS 2024-06-03 16:57:51 +08:00
docker.sh deploy/docker: allow setting key file mode and owner in the container 2026-07-05 16:30:46 +08:00
dovecot.sh fix format 2017-02-19 20:40:53 +08:00
edgio.sh format adjustment 2024-04-07 12:36:19 +00:00
exim4.sh fix format 2024-10-13 17:41:22 +02:00
fortigate.sh Deploy certificate to FortiGate firewall using API (#6236) 2026-07-14 09:02:34 +08:00
fritzbox.sh deploy/fritzbox: allow hook to be used with multiple fritzboxes 2022-01-06 16:20:43 +01:00
gcore_cdn.sh fix(gcore_cdn): renew login api url (#5143) 2026-07-04 20:14:32 +08:00
gitlab.sh fix shellcheck warnings 2022-11-23 21:33:29 +08:00
haproxy.sh deploy/haproxy: use printf instead of "echo -e" for the stats socket payload 2026-07-05 15:44:26 +08:00
ikuai.sh add deploy hook support for ikuai (#6456) 2026-08-13 14:52:48 +08:00
kemplm.sh Fixed missing error return value when certificate upload fails. 2026-02-23 09:24:06 +01:00
keychain.sh Remove template text 2018-03-22 13:45:43 -04:00
keyhelp.sh fix: grep -A is not portable, breaks ARI on Solaris 2026-07-25 16:00:03 +08:00
keyhelp_api.sh rename to keyhelp_api 2025-10-21 11:34:46 +02:00
kong.sh name="snis" => name="snis[]" 2021-09-04 16:59:50 +08:00
lighttpd.sh use ${ACME_OPENSSL_BIN:-openssl} instead of openssl 2021-09-30 19:00:39 -04:00
localcopy.sh align logic to acme.sh installcert(), fix perms on non-key files 2025-12-30 11:41:50 -05:00
mailcow.sh Merge pull request #4170 from SecT0uch/patch-1 2022-07-11 22:13:24 +08:00
multideploy.sh Fix multideploy MULTIDEPLOY_FILENAME conf read and allow an absolute path 2026-08-05 23:01:54 +08:00
myapi.sh exe 2017-02-05 23:14:25 +08:00
mydevil.sh mydevil: replace BSD-only cut -w with tr + plain cut 2026-07-12 10:49:49 +08:00
mysqld.sh fix format 2017-02-19 20:40:53 +08:00
netlify.sh format adjustment 2024-04-07 12:36:19 +00:00
nginx.sh fix format 2017-02-19 20:40:53 +08:00
openmediavault.sh omv deploy hook: add usage comments 2022-01-20 17:46:47 +08:00
opensshd.sh fix format 2017-02-19 20:40:53 +08:00
openstack.sh Fix CI test failure for deploy/openstack.sh 2020-07-16 13:53:21 +10:00
panos.sh deploy/panos: do not commit when the cert or key import failed (#4716) 2026-07-05 17:13:59 +08:00
peplink.sh Add Peplink deploy hook 2021-01-13 20:37:05 +00:00
proxmoxbs.sh fix proxmoxve/proxmoxbs deploy: fail on non-2xx API response 2026-07-20 10:02:54 +08:00
proxmoxve.sh fix proxmoxve/proxmoxbs deploy: fail on non-2xx API response 2026-07-20 10:02:54 +08:00
pureftpd.sh fix format 2017-02-19 20:40:53 +08:00
qiniu.sh feat(qiniu): make forceHttps configurable via environment variable 2026-01-01 13:26:02 +00:00
README.md update repo name 2020-01-30 12:06:39 +08:00
routeros.sh Fix RouterOS deploy (#7034) 2026-06-19 14:23:03 +02:00
ruckus.sh Don't deploy ECC certs to legacy Ruckus 2025-03-27 14:03:08 +13:00
shelly.sh Feat: Shelly deploy hook for firmware 2.0.0+ (#7145) 2026-07-25 13:03:56 +08:00
ssh.sh Feature: Support other shells then sh (#4877) 2026-07-10 21:02:06 +08:00
strongswan.sh Fix strongswan deploy hook 2025-12-19 18:12:45 +03:00
synology_dsm.sh Fix synology_dsm logging out after the temp admin is already deleted 2026-08-05 19:56:13 +08:00
truenas.sh fix: remove control characters 2024-12-31 18:04:39 +01:00
truenas_ws.sh Adding custom Port definitions for truenas (#7033) 2026-07-01 20:55:55 +08:00
unifi.sh disable shellcheck 2025-11-08 16:59:10 -05:00
unifios.sh Add UniFi OS Server deploy hook (#7184) 2026-08-13 14:57:44 +08:00
vault.sh check curl vault http return code 2025-04-18 00:25:10 +02:00
vault_cli.sh improve logging 2022-12-28 02:47:49 +08:00
vsftpd.sh fix format 2024-10-13 17:41:22 +02:00
windows_rdp.sh Add deployment plugin for Windows RDP via OpenSSH (#6925) 2026-05-02 10:56:13 +02:00
zyxel_gs1900.sh Apply suggested fixes from shfmt diffs 2025-05-17 21:25:39 -04:00