openwisp / openwisp/openwisp-controller
[feature:gsoc26] Expose certificate data as template variables
@stktyagi is already working on this.
Since May 15, 2026.
- Dominant language
- Python
- Stars
- 773
- Forks
- 315
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 14
Description
Is your feature request related to a problem? Please describe.
Once a standalone certificate is generated, its payload, PEM and Private Key, is stored securely in the database. However, this payload is currently inaccessible to the OpenWISP configuration engine, meaning administrators cannot actually deploy the certificates into the device's configuration files.
Describe the solution you'd like
I will extend the configuration variable context to inject certificate payloads directly into the templating engine:
-
Context Generation: implement a
get_cert_context()method extendingConfig.get_context(). This will iterate over thedevicecertificate_setand build an Ordered Dictionary of the active certificates. -
UUID Namespacing: to prevent variable collisions when multiple cert templates are assigned to a single device, generate predictable, UUID-namespaced variables. Specifically:
cert_{template_pk_hex}_pem: the generated certificate.cert_{template_pk_hex}_key: the private key.cert_{template_pk_hex}_id: the object UUID.
-
Template Usage: administrators will then be able to reference these variables dynamically inside standard OpenWISP templates using the
{{ variable_name }}syntax.
Requirement from the GSoC proposal
The proposal requires exposing the certificate PEM, private key PEM, and certificate UUID in Config.get_context() using a UUID-based namespace to avoid conflicts.
Decision to keep open
The proposal example uses names like cert_<template_uuid>_pem, while this issue currently uses cert_{template_pk_hex}_pem. The exact UUID-based namespace should be confirmed during implementation and documented before merging.
Measurable outcomes: 5Is your feature request related to a problem? Please describe.
Once a standalone certificate is generated, its payload, PEM and Private Key, is stored securely in the database. However, this payload is currently inaccessible to the OpenWISP configuration engine, meaning administrators cannot actually deploy the certificates into the device's configuration files.
Describe the solution you'd like
I will extend the configuration variable context to inject certificate payloads directly into the templating engine:
-
Context Generation: implement a
get_cert_context()method extendingConfig.get_context(). This will iterate over thedevicecertificate_setand build an Ordered Dictionary of the active certificates. -
UUID Namespacing: to prevent variable collisions when multiple cert templates are assigned to a single device, generate predictable, UUID-namespaced variables. Specifically:
cert_{template_pk_hex}_pem: the generated certificate.cert_{template_pk_hex}_key: the private key.cert_{template_pk_hex}_id: the object UUID.
-
Template Usage: administrators will then be able to reference these variables dynamically inside standard OpenWISP templates using the
{{ variable_name }}syntax.
Requirement from the GSoC proposal
The proposal requires exposing the certificate PEM, private key PEM, and certificate UUID in Config.get_context() using a UUID-based namespace to avoid conflicts.
Decision to keep open
The proposal example uses names like cert_<template_uuid>_pem, while this issue currently uses cert_{template_pk_hex}_pem. The exact UUID-based namespace should be confirmed during implementation and documented before merging.
Measurable outcomes: 5
Implementation points: 4, 5
Is your feature request related to a problem? Please describe.
Once a standalone certificate is generated, its payload, PEM and Private Key, is stored securely in the database. However, this payload is currently inaccessible to the OpenWISP configuration engine, meaning administrators cannot actually deploy the certificates into the device's configuration files.
Describe the solution you'd like
I will extend the configuration variable context to inject certificate payloads directly into the templating engine:
-
Context Generation: implement a
get_cert_context()method extendingConfig.get_context(). This will iterate over thedevicecertificate_setand build an Ordered Dictionary of the active certificates. -
UUID Namespacing: to prevent variable collisions when multiple cert templates are assigned to a single device, generate predictable, UUID-namespaced variables. Specifically:
cert_{template_pk_hex}_pem: the generated certificate.cert_{template_pk_hex}_key: the private key.cert_{template_pk_hex}_id: the object UUID.
-
Template Usage: administrators will then be able to reference these variables dynamically inside standard OpenWISP templates using the
{{ variable_name }}syntax.
Requirement from the GSoC proposal
The proposal requires exposing the certificate PEM, private key PEM, and certificate UUID in Config.get_context() using a UUID-based namespace to avoid conflicts.
Decision to keep open
The proposal example uses names like cert_<template_uuid>_pem, while this issue currently uses cert_{template_pk_hex}_pem. The exact UUID-based namespace should be confirmed during implementation and documented before merging.
Measurable outcomes: 5
Implementation points: 4, 5
Implementation points: 4, 5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.