refactor wg keys

main
Ricard Illa 2022-09-06 18:10:43 +02:00
parent a370a6ab15
commit ec014c67f5
3 changed files with 44 additions and 85 deletions

34
group_vars/all/vault_wg Normal file
View File

@ -0,0 +1,34 @@
$ANSIBLE_VAULT;1.1;AES256
34346331643930623463333539653466323166643430343264616237393231636130383630663264
3634656661663537346265346439636364373131383364640a383565393363383532383136303464
31323264643932323832316465616163383438383865656436623038316533373738356664623131
3062313635643862390a653932376465636538613366333062383034633336373065343566326464
65306139636664373865386362333533643636306332666133363230646165373735353938303234
37623831346130363239333363396535313364343066303562356130343232376134383531386465
35646362366266393061613636323230326163383861666163313338613638623266643732366162
65323431333636343965666132363832613066326337666539346430333639393638626464353533
61343466336165313034336235333264303861626166393138653731333936343530343133333262
63363236653930303562396266373038633661383161336463653465326232353362316261623535
63633836306630636464613233393064346230633565353365616364386132356637656433383039
62393930363766356437636465393364623061306536366239333863333462323336386266653665
39313430343763353766623037343532323639613331326638653561386535653530346637363162
31646165613063343930386531396166626535383331666630363634346537636662323263333865
63653763636232666434376162636264303738323732653562386638323465313133333136316366
62363261306131313231353064383133326432343235316634343238656535356336353064313139
33653165623831623734353338656363303732663135393161663736313865363139643865386436
63353736306439363261616465623333383631653538353065306330386638393266666235323830
38356262626631376139333732373138333334306639643465663366383061356663326131303332
64636566316434613634323537343439653431663232623030353930613163313061396361646533
30373338326364326161303034613235643866356531626439323264373137343563323332613234
39333966306466323862623866353834306665663866333334643865336565646366643261363237
65373333653739386534663261633235373137336235383439643638366661633966383834653666
34633036343430613839343966373662663334333538323133336332613539353363393439393633
62626437386339633534376366333932663330656239326539303062333131316361333031626263
39366164333634326532653634646630383335353361623338616363636432316637323033313561
35613262336634666534623536356537303539323663393635366364366661633538653936376135
64633834343561323561616564376239313963356130373434343130333736616466333564363632
66323466343538643965353461336137383630363735663530323837616134633238333162353138
39656164633734363364336630656331623735613466313863653163336634363562336637396666
32663338613062623761643863346636626635336530633466326433666233303162326534663233
61306164306532613865383164656535333063646463343666313461386530353761376131303330
3966

View File

@ -8,99 +8,24 @@ wg_peers:
endpoint: monotremata.xyz
address: "10.1.0.2/24"
allowed_ips: "10.1.0.2/32"
private_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
32316538626436333364666235613663663633333139663462363163646630346363363033326634
3931613161666162616231323132623233383535616434640a353766613533636137393864396331
30313333373133323035626538323938353832626161303532643738613539313737393865326365
6638303235396437310a613833633365393831656337623162386233313037646635346437346437
31623665346664393739646539333235313336623062303038373738383961616261336631326438
6366346238356136373938663266366463666462363332333432
public_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
30366462356635313038396238363433353965633836333236373863323331616130376262336530
3865663030313637323163373738626436336331396166650a366164333465313038663563653166
35363261346332666237616262643137366665653865656631316564613035626337316361386263
3266303533303438350a376530306462316231323763366435356663386230353031366134383130
61313235336565313564353933623366626162393933663766633635326233313166343164643635
3737393832396138333135313638383064616365353434363934
private_key: "{{ vault_wg_peers.caladan.private_key }}"
public_key: "{{ vault_wg_peers.caladan.public_key }}"
fugu:
endpoint: mail.monotremata.xyz
address: "10.1.0.3/24"
allowed_ips: "10.1.0.3/32"
private_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
61623837393532316135383262643233386466316466616264646138383734343761313363376130
3162646464626634333531343466366466353862643936660a323466336463313232623162376139
66633565303234373762313732303239633765363932643966336335666237343763316461386630
3966363261316366360a613435626564663262346464326366663662663031643663643831323565
38306135353038303836326138383262623037333265663962316638336465333030393135613130
6130326566643134343830323531663932386236393666353261
public_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
37386231353361303238323430636534343538613038386564343063363064353464643965653432
3235343764323937363534323731343038643230343831610a666366336463646232323462623064
63333433393332303963653733383436373034653231663836646531656233626238356638613136
3336303064646330320a373632313734653034613439353738353331353465353763333438613564
39663630306163623533383635643430346166616637313566323737316261303132383663623866
6537396339306366393430393431616234393834353039316530
private_key: "{{ vault_wg_peers.fugu.private_key }}"
public_key: "{{ vault_wg_peers.fugu.public_key }}"
# openwrt is added as a peer but not managed by ansible
openwrt:
allowed_ips: "10.0.0.0/8"
endpoint: wg.monotremata.xyz
public_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
35393164366137313939356539343565633736613335636635343031663632303034373038303432
6138646366636431313938386565643534373634343934340a323536313161336232333534393264
62343231333464613136353964333166356162393437303630386666323731383965626639633462
6539386436373162370a656538366634623761663130663063303265343966383035346135636464
61306338616261646566353830613566323334623662373461346166303766386261333438376266
3833343366353531666162663137633430306234326338653864
preshared_keys:
caladan: !vault |
$ANSIBLE_VAULT;1.1;AES256
35356436653232353331666262343364323764383234346638383430363230373766636530346533
6465396461393063356330643638323162643539383434320a626139616332333364663865623965
65636566363766343332343738323835613539333463656231326535653361373733383566333363
3463323033653764300a336365363264353863343362656433623331333934323563306436376262
37663765386231396230373333353139336261326261623636393639396330666564666536356337
6434303231613331396636363333383931376236613433323063
fugu: !vault |
$ANSIBLE_VAULT;1.1;AES256
65613566393936356361376262386166653966326262623837633935333162653938666665326564
3032373366666533366234363734636333626333303339320a636464616665306432303161643235
64646630326430656330383434656263336661383030633662616130663566656262373364643061
3633333261383865360a396239646137643366303232396435666534626666376237653932363066
65373532623230343461613834346633366131303832396632313839353565333439373439663035
3363626663393136313865626431306335653833616666396266
public_key: "{{ vault_wg_peers.openwrt.public_key }}"
wg_preshared_keys:
caladan-openwrt: !vault |
$ANSIBLE_VAULT;1.1;AES256
35356436653232353331666262343364323764383234346638383430363230373766636530346533
6465396461393063356330643638323162643539383434320a626139616332333364663865623965
65636566363766343332343738323835613539333463656231326535653361373733383566333363
3463323033653764300a336365363264353863343362656433623331333934323563306436376262
37663765386231396230373333353139336261326261623636393639396330666564666536356337
6434303231613331396636363333383931376236613433323063
caladan-fugu: !vault |
$ANSIBLE_VAULT;1.1;AES256
31396637326464343238663736326530636139323263653464336430363530636261653433613166
3566613763653061396662616666393639656532336131620a323462333463666430376336396436
35353938383961343931343862653534663261373531356138336565396634333239643163663462
3565303233376138350a363736363664633963343261363835306334343130333130626666326364
61313937636635363666346665326131663763383639323666376236336234303162636565633830
3065643134616164323530396562613035633063356561336131
fugu-openwrt: !vault |
$ANSIBLE_VAULT;1.1;AES256
65613566393936356361376262386166653966326262623837633935333162653938666665326564
3032373366666533366234363734636333626333303339320a636464616665306432303161643235
64646630326430656330383434656263336661383030633662616130663566656262373364643061
3633333261383865360a396239646137643366303232396435666534626666376237653932363066
65373532623230343461613834346633366131303832396632313839353565333439373439663035
3363626663393136313865626431306335653833616666396266
caladan_openwrt: "{{ vault_wg_preshared_keys.caladan_openwrt }}"
caladan_fugu: "{{ vault_wg_preshared_keys.caladan_fugu }}"
fugu_openwrt: "{{ vault_wg_preshared_keys.fugu_openwrt }}"

View File

@ -13,8 +13,8 @@ AllowedIPs = {{ peer_data.allowed_ips }}
PersistentKeepalive = {{ wg_persistent_keepalive }}
PresharedKey = {{
wg_preshared_keys.get(
inventory_hostname + "-" + peer_hostname,
wg_preshared_keys.get(peer_hostname + "-" + inventory_hostname)
inventory_hostname + "_" + peer_hostname,
wg_preshared_keys.get(peer_hostname + "_" + inventory_hostname)
)
}}