Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Follow-up: agent-tunnel cert renewal review comments from #1775

Abierto
#1,788 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
rust

Línea de trabajo

Comienza con try_renew_certificate en devolutions-agent/src/tunnel.rs alrededor de las líneas 498-521 y compara persist_enrollment_response con el patrón existente de permisos de archivo. Lee los helpers de renovación en devolutions-agent/src/enrollment.rs alrededor de las líneas 248-318 y añade la cobertura de pruebas unitarias solicitada. Se considera terminado cuando las escrituras de renovación sean atómicas, los fallos locales irrecuperables durante la preparación de la CSR puedan recuperarse, las pruebas de los helpers pasen y el comentario de la línea 282 sea preciso.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Follow-up to the Copilot review on #1775 (feat(agent): implement certificate renewal). The PR is merged as-is because none of the items below affect the happy path, but they should be cleaned up.

Items

[P0] Atomic write for renewed cert + CA — devolutions-agent/src/tunnel.rs:521
  • Replace the two std::fs::write(cert_path, ...) / std::fs::write(ca_path, ...) calls with a write-temp-then-rename sequence (same directory, then std::fs::rename).
  • On Unix, set 0o600 on the temp file before rename — match what persist_enrollment_response already does for the initial enrollment.

Why this matters: the current std::fs::write truncates in place. A crash, power loss, or full disk between the two writes leaves the client cert / CA file half-written; future mTLS handshakes then fail and the agent cannot recover remotely — admin has to re-enroll the machine on-site. Happy path is fine; only the failure mode is bad, and the failure mode is expensive.

[P1] Don't fail the connection on local CSR-prep errors — devolutions-agent/src/tunnel.rs:498
  • In try_renew_certificate, replace the ? on read_agent_name_from_cert and generate_csr_from_existing_key with match arms that log a warning and return Ok(None).

Why this matters: the doc comment on try_renew_certificate says only control-stream IO / protocol errors should be Err, but right now a transient local file read failure (e.g. permission blip) bubbles up to run_single_connection's Err branch and forces a backoff/reconnect on an otherwise healthy QUIC connection. Should be a recoverable "skip renewal, keep using existing cert" path.

[P2] Unit tests for new renewal helpers — devolutions-agent/src/enrollment.rs:248-318
  • is_cert_expiring: generate a short-lived rcgen cert, assert true above threshold and false below.
  • read_agent_name_from_cert: round-trip a known CN.
  • generate_csr_from_existing_key: assert the produced PEM parses back via rcgen::CertificateSigningRequestParams::from_pem and that the public key matches the input key.
[P3] Fix misleading comment — devolutions-agent/src/enrollment.rs:282
  • Rewrite the comment on read_agent_name_from_cert. The current text implies the gateway looks the agent up in its registry by CommonName, but AgentRegistry is keyed by agent_id (UUID, extracted from SAN urn:uuid:). The real reason to reuse the CN in the renewal CSR is just to keep the issued cert's CN stable across renewals — the gateway ignores the CSR subject anyway.

Original review

https://github.com/Devolutions/devolutions-gateway/pull/1775#pullrequestreview-4200093301

Lenguaje dominante
Rust
Estrellas
163
Forks
30
Merge medio
1 d 10 h
PR fusionados (30 d)
66

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Devolutions/devolutions-gateway

Todos los issues de Devolutions/devolutions-gateway

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.