cluster: generate ring keys on scan if missing
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -240,6 +240,23 @@ func (m *Machine) applyZoneNodeID(zoneID, nodeID int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Machine) setRingDefaults(ri *RingInfo) error {
|
||||
if ri.Keys.PrivateKey.IsZero() {
|
||||
m.info().
|
||||
WithField("subsystem", "wireguard").
|
||||
WithField("node", m.Name).
|
||||
WithField("ring", ri.Ring).
|
||||
Print("generating key pair")
|
||||
|
||||
kp, err := wireguard.NewKeyPair()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ri.Keys = kp
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveWireguardConfig deletes wgN.conf from the machine's
|
||||
// config directory.
|
||||
func (m *Machine) RemoveWireguardConfig(ring int) error {
|
||||
|
||||
Reference in New Issue
Block a user