OPNsense Forum

English Forums => Development and Code Review => Topic started by: Mad-Onion on May 06, 2020, 03:07:19 pm

Title: Access a certificate from a template
Post by: Mad-Onion on May 06, 2020, 03:07:19 pm
Hi everyone,

I'm developing a plugin where I need to write the content of a certificate from the OPNsense's truststore to a local file. I already have a corresponding dropdown in the form and selecting / saving works well.

How can I access the certificates "content" from within a template? When I access it via the model's property, I just get a string like "5eb0efc71fa7f" - maybe its id / hash?

Best regards
Tobias
Title: Re: Access a certificate from a template
Post by: Mad-Onion on May 07, 2020, 10:05:03 am
I'm writing these files from a php-script now. Much easier ;-)
Good example: https://github.com/opnsense/plugins/blob/master/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportCerts.php (https://github.com/opnsense/plugins/blob/master/net/haproxy/src/opnsense/scripts/OPNsense/HAProxy/exportCerts.php).
Title: Re: Access a certificate from a template
Post by: fabian on May 08, 2020, 06:59:16 am
You find that Id in the certificate section of the config as well together with the certificate itself.