Pārlūkot izejas kodu

Automatically Generate Private Key

Allow Wireguard to automatically generate a private key if an
interface doesn't have one and private_key is set to auto. This
allows for auto key generation and distribution if using salt mines.
master
Nate Bohman pirms 6 gadiem
vecāks
revīzija
70c5f41ce9
1 mainītis faili ar 6 papildinājumiem un 0 dzēšanām
  1. +6
    -0
      _states/wireguard.py

+ 6
- 0
_states/wireguard.py Parādīt failu

@@ -34,6 +34,12 @@ def present(name, listen_port=None, fwmark=None, private_key=None):
new=fwmark,
)

if private_key == 'auto':
private_key = show.get('private key')
if private_key is None:
private_key = __salt__['wg.genkey']()
ret['changes']['private key'] = 'private key generated.'

if show.get('private key') != private_key:
__salt__['wg.set'](name, private_key=private_key)
ret['changes']['private key'] = 'private key changed.'

Notiek ielāde…
Atcelt
Saglabāt