feat(wireguard): selektiver .conf-Import — Auswahl einzelner Interfaces per Modal

- GET /wireguard/importable listet alle .conf-Dateien in /etc/wireguard/
  mit already_in-Flag (bereits in DB)
- POST /wireguard/import nimmt optionale Names-Liste; ohne Namen → alles
- edgeguard-ctl wg-import [iface…] importiert nur die genannten Interfaces
- UI: Checkbox-Modal mit "Alle neuen auswählen" + Einzelauswahl;
  bereits importierte Interfaces disabled + grüner Tag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Debian
2026-05-24 22:09:37 +02:00
parent ac068bc9dd
commit 8d7a43bc8c
10 changed files with 230 additions and 13 deletions

View File

@@ -60,7 +60,7 @@ import (
usersvc "git.netcell-it.de/projekte/edgeguard-native/internal/services/users"
)
var version = "1.1.94"
var version = "1.1.95"
func main() {
addr := os.Getenv("EDGEGUARD_API_ADDR")

View File

@@ -11,7 +11,7 @@ import (
"git.netcell-it.de/projekte/edgeguard-native/internal/services/setup"
)
var version = "1.1.94"
var version = "1.1.95"
const usage = `edgeguard-ctl — EdgeGuard CLI
@@ -26,7 +26,10 @@ Commands:
migrate dump [dir] Write embedded SQL files to dir (default: ./migrations)
initdb Create PostgreSQL role + database (idempotent)
render-config Regenerate haproxy / nftables configs from PG (--no-reload, --only=)
wg-import [--path <dir>] Import existing /etc/wireguard/*.conf files into the DB
wg-import [--path <dir>] [iface…]
Import /etc/wireguard/*.conf files into the DB.
Without iface arguments: imports all .conf files.
With iface args: imports only the named interfaces.
reset-password Generate a one-time token for the /reset-password UI flow
cluster-join <primary> --token <…>
Provision Cluster-TLS material on this node by

View File

@@ -46,7 +46,9 @@ func cmdWGImport(args []string) int {
wireguard.NewPeersRepo(pool),
box,
)
res, err := im.ImportDir(ctx, *path)
// Positional args after flags = specific interface names to import.
names := fs.Args()
res, err := im.ImportSelected(ctx, *path, names)
if err != nil {
fmt.Fprintln(os.Stderr, "wg-import:", err)
return 1

View File

@@ -35,7 +35,7 @@ import (
"git.netcell-it.de/projekte/edgeguard-native/internal/services/tlscerts"
)
var version = "1.1.94"
var version = "1.1.95"
const (
// renewTickInterval — how often we re-evaluate expiring certs.