openwisp / openwisp/openwisp-controller

[feature:gsoc26] Introduce DeviceCertificate relational model for standalone certificates

Open
#1,377 1 comment 0 reactions 1 assignee View on GitHub

@stktyagi is already working on this.

Since May 26, 2026.

enhancement gsoc
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.
Currently, there is no robust relational way to track which standalone X.509 certificates belong to which device configurations, or which template originally generated them. Relying on string-matching the common_name to bind certificates to devices is fragile and prone to edge-case collisions, especially in large-scale deployments.

Describe the solution you'd like
I will introduce a DeviceCertificate intermediate Many-To-Many (M2M) model to act as a strict relational bridge. This directly mirrors OpenWISP's proven VpnClient architecture, enforcing strong Foreign Key constraints between the device configuration, the template, and the generated physical certificate.

Create a DeviceCertificate model with the following fields:

  • config: ForeignKey to the Config model, the device's configuration.
  • template: ForeignKey to the Template model, the template that triggered creation.
  • cert: OneToOneField to the django_x509.Cert model, the actual generated X.509 certificate.
  • auto_cert: BooleanField to track whether the certificate is auto-managed by the system.
  • Enforce unique_together = ('config', 'template') at the database level to ensure a single device configuration cannot generate multiple conflicting certificates from the same template.

Relationship with lifecycle issue

This issue tracks the relational model described in the proposal. The lifecycle behavior that uses this model, including assignment, generation, revocation, renewal, and config status updates, is tracked in #1358.

Measurable outcome: 3
Implementation point: 2, 3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.