This README shows how to:
- Create a new internal Certificate Authority (CA)
- Issue a 10-year certificate signed by that CA
- List CAs and certs
- Set the WebUI to use the new certificate
- Restart the WebUI so the cert takes effect
Notes
• Commands are for TrueNAS CORE, usingmidclt.
• Your build may require certain subject fields and SAN. The examples include conservative defaults that satisfy strict validators.
• Replace hostnames, org info, and emails as needed.
Edit the values if you like. The san field is included because some CORE builds require it for CA creation too.
midclt call certificateauthority.create '{
"create_type": "CA_CREATE_INTERNAL",
"name": "My-Default-CA",
"key_length": 2048,
"lifetime": 3650,
"digest_algorithm": "SHA256",
"country": "US",
"state": "California",
"city": "Los Angeles",
"organization": "TrueNAS",
"email": "admin@localhost.lan",
"common": "nas.local",
"san": ["nas.local"]
}'midclt call certificateauthority.query | jq -r 'sort_by(.id) | .[] | "\(.id)\t\(.name)\t\(.issuer)\t\(.until)"'Use the CA_ID returned above.
JOB_ID=$(midclt call certificate.create '{
"create_type": "CERTIFICATE_CREATE_INTERNAL",
"name": "My-UI-Cert",
"key_length": 2048,
"lifetime": 3650,
"digest_algorithm": "SHA256",
"country": "US",
"state": "California",
"city": "Los Angeles",
"organization": "TrueNAS",
"email": "admin@localhost.lan",
"common": "nas.local",
"san": ["nas.local"],
"signedby": '"<CA-ID>"'
}')
echo "JOB_ID=$JOB_ID"
# Check job result for success / certificate ID
midclt call core.get_jobs "[[\"id\",\"=\",$JOB_ID]]" | jq '.[0] | {id,state,error,result}'midclt call certificate.query | jq -r 'sort_by(.id) | .[] | "\(.id)\t\(.name)\t\(.common)\t\(.until)"'Replace <CERT_ID> with the certificate ID shown in the job result above.
midclt call system.general.update "{\"ui_certificate\": <CERT_ID>}"Verify the new assignment:
midclt call system.general.config | jq '.ui_certificate, .ui_certificate_name'Option A — restart middleware:
service middlewared restartif that does not work, please reboot TrueNAS:
reboot