Roll out "custom certificate" updates via shell / api?

Nov 12, 2025
57
6
8
Hi,
is it possible to replace "custom certificates" from shell or via api? I'm speaking of this ones here:
1780400869742.png
My goal is, to do cert-renewal automatically.
What service(s) need to be restarted after exchanging the certs?
Many thanks in advance!
 
  • Like
Reactions: ChrisTG74
  • Like
Reactions: ChrisTG74
Thank for your reply.
I have a last question about the parameters the pmgconfig expects here:
Code:
pmgconfig cert set <type> <certificates> <key> [OPTIONS] [FORMAT_OPTIONS]
Upload or update custom certificate chain and key.
<type>: <api | smtp>
The TLS certificate type (API or SMTP certificate).

<certificates>: <string>
PEM encoded certificate (chain).

<key>: <string>
PEM encoded private key.

--force <boolean> (default =0)
Overwrite existing custom or ACME certificate files.

--restart <boolean> (default =0)
Restart services.

Does this really mean to pass the whole cert and key as strings here? Or is a filepath expected instead?
Pasting multi-line strings via commands is always a hassle from scripts IMHO.

Thank you.
 
Yes, the raw certificate/key as strings are expected since pmgconfig mostly just wraps the API a bit more neatly for command-line usage.

But if you already got the files somewhere, you can invoke it e.g. as
Bash:
pmgconfig cert set api "$(cat /var/lib/certs/cert.pem)" "$(cat /var/lib/certs/key.pem)"

Being able to pass filepaths instead seems like a pretty reasonable thing to have for CLIs, though - feel free to create a feature request over at https://bugzilla.proxmox.com/ :)
 
Hm, the syntax with "$(cat ..." does not work:

Unknown option: ---begin private key-----
(...)
<content of file is shown here>
(....)
400 unable to parse option
pmgconfig cert set <type> <certificates> <key> [OPTIONS] [FORMAT_OPTIONS]