fix(setup): Force-Flag für cluster-join — Bootstrap-Cert wird automatisch ersetzt

Der API-Boot erstellt für Single-Node-Betrieb automatisch ein selbst-signiertes
peer-Cert. Beim Join über die GUI wurde das als Fehler gemeldet.

clusterjoin.Request.Force=true im Setup-Handler überspringt die HasPeer-Prüfung;
CLI (edgeguard-ctl cluster-join) bleibt vorsichtig (Force=false, manuelles rm nötig).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-29 17:14:34 +02:00
parent afe2c951b9
commit 60e2aec5d9
6 changed files with 11 additions and 5 deletions

View File

@@ -165,6 +165,7 @@ func (h *SetupHandler) JoinCluster(c *gin.Context) {
Token: strings.TrimSpace(body.Token),
CommonName: fqdn,
Insecure: body.Insecure,
Force: true, // bootstrap self-signed cert must be replaced
Version: h.Version,
NodeID: h.NodeID,
}); err != nil {

View File

@@ -38,6 +38,11 @@ type Request struct {
// because security depends on the HMAC-signed token, not TLS trust.
Insecure bool
// Force overwrites existing peer cert material. The CLI keeps this
// false (explicit rm required); the setup-wizard handler sets it
// true because the bootstrap self-signed cert must be replaced.
Force bool
// TLSDir is where ca.crt + peer.{crt,key} are written.
// Zero value → clustertls.DefaultDir.
TLSDir string
@@ -73,7 +78,7 @@ func Join(req Request) error {
}
store := clustertls.New(tlsDir)
if store.HasPeer() {
if store.HasPeer() && !req.Force {
return fmt.Errorf("peer cert already present under %s — remove it first if this is intentional", tlsDir)
}