Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Banain

#1
General Discussion / Set WebUI Certificate via API
September 30, 2024, 12:06:31 PM
I'm looking for a way to define via API which certificate to use for the WebUI.

I managed to use the API to list installed certificates and also to add new ones (see below). But I fail to configure the freshly uploaded certificate to be used for the WebUI.

Any help is appreciated.

best regards
    Thomas

VSCode REST Plugin Sample for Certificate API:

key=super
secret=secret


### list all installed certificates
GET https://opnsense.example.com/api/trust/cert/search HTTP/1.1
Authorization: Basic {{key}}:{{secret}}

### get a specific certificate
GET https://opnsense.example.com/api/trust/cert/get/b2656c80-842c-452d-b2b5-be95bb745ee4 HTTP/1.1
Authorization: Basic {{key}}:{{secret}}

###
POST https://opnsense.example.com/api/trust/cert/add HTTP/1.1
Authorization: Basic {{key}}:{{secret}}
Content-Type: application/json

{"cert":
    {
        "action":"import",
        "descr":"testdummy3",
        "cert_type":"usr_cert",
        "private_key_location":"firewall",
        "crt_payload":"-----BEGIN CERTIFICATE-----\n[...]\n-----END CERTIFICATE-----",
        "prv_payload":"-----BEGIN PRIVATE KEY-----\n[...]\n-----END PRIVATE KEY-----",
        "csr_payload":""
    }   
}