Skip to content

Automatic TLS certificates with set-certificate - #115

Merged
DavidePrincipi merged 5 commits into
mainfrom
feat-7669
Oct 15, 2025
Merged

DavidePrincipi merged 5 commits into
mainfrom
feat-7669

Conversation

@DavidePrincipi

@DavidePrincipi DavidePrincipi commented Oct 14, 2025 •

Copy link
Copy Markdown
Member

This PR propose the following changes:

  1. the set-certificate behavior no longer alters the default Traefik certificate. It now configures a Traefik router, like HTTP routes do. This strategy allows to obtain a single-name certificate of type Automatic, like the minio1.dp.nethserver.net entry of the screenshot.
  2. the get-certificate returns a lets_encrypt attribute, similar to get-route. The UI can use this boolean to know if a Let's Encrypt certificate for the given FQDN exists. Useful for the toggle widget.
  3. Doc fixes
image

Refs NethServer/dev#7669

This action is no longer used by UI. It is designed for applications
only. Checking if the certificate name overlaps with HTTP routes is a
required by UI only.
Change the behavior of set-certificate to obtain a TLS certificate for
the specified FQDN using a Traefik router configuration, instead of
modifying the default certificate configuration. The resulting
certificate is now of type Automatic rather than Requested.
Since a Traefik router is defined also by set-certificate we have
different types of routers to manage.

- Renamed helper function read_host_names_of_traefik_routers()
- Renamed variables for consistency
- Added only_http_routes=True argument to set-default-certificate validator
The "lets_encrypt" boolean attribute tells if at least one of the
matching certificates was obtained from Let's Encrypt.
- New set-certificate behavior
- set-route parameters are optional
- Fixed formatting
@DavidePrincipi
DavidePrincipi requested a review from Amygos October 14, 2025 15:30
@Amygos
Amygos requested a review from Copilot October 15, 2025 07:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the set-certificate action from modifying the default Traefik certificate to configuring individual Traefik routers for single-name automatic certificates. This enables obtaining Let's Encrypt certificates that are marked as "Automatic" like HTTP routes, while preserving backward compatibility.

Key changes:

  • Replace default certificate modification with dedicated Traefik router configuration in set-certificate
  • Add lets_encrypt flag to get-certificate response to indicate if a Let's Encrypt certificate exists
  • Update function names and logic to handle both HTTP routes and certificate routers consistently

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
imageroot/actions/set-certificate/20writeconfig Replaces certificate request logic with router configuration approach
imageroot/pypkg/cert_helpers.py Renames function to handle both HTTP routes and certificate routers
imageroot/actions/get-certificate/20readconfig Adds lets_encrypt flag to response
imageroot/actions/set-certificate/validate-input.json Updates input schema to use lets_encrypt instead of check_routes
imageroot/actions/set-certificate/validate-output.json Simplifies output schema for backward compatibility
imageroot/actions/set-certificate/05check_routes Converts validation step to placeholder
tests/20_traefik_certificates_api.robot Updates test expectations for new error handling
imageroot/actions/list-certificates/50list_certificates Updates function call to renamed helper
imageroot/actions/set-default-certificate/50set_default_certificate Updates function call with new parameter
README.md Updates documentation to reflect new behavior and API changes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread imageroot/pypkg/cert_helpers.py Resolved
@DavidePrincipi
DavidePrincipi merged commit 57e833e into main Oct 15, 2025
@DavidePrincipi
DavidePrincipi deleted the feat-7669 branch October 15, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants