[SOLVED] Unable to update certificate with ACME Client API

Started by cmdrwalrus, May 04, 2023, 02:56:31 AM

Previous topic - Next topic
Hello!

I've been trying to update a certificate in ACME Client via the API, to add more altNames.  I've been successful with /add and /get, but when I try to use /set it says '{"result":"saved"}' but nothing is changed in the record.

I've attached my script, if anyone can take a look at it and see if I'm missing something.

Thanks!
Chad.



OK, I figured it out!

I looked at the source code [1] for the ACME Client plugin and noticed the set method is called 'updateAction'.  So I changed my POST to use /api/acmeclient/certificates/update/<uuid>, and removed the spaces from the CSV value for altNames, and it works now!

I've attached the working version of my script in case it helps anyone.

1. https://github.com/opnsense/plugins/blob/master/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/Api/CertificatesController.php