File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
roles/cfg_openwrt/templates/common/config Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -122,15 +122,11 @@ wireguard_access:
122122 peers :
123123 - description : " Test"
124124 public_key : " 5dkLlAtOqcoT7ocNYnLvyJ5pIippsxBXgFJvtVoI0yI=" # gitleaks:allow
125- allowed_ips :
126- - " 10.248.105.130/32"
127- - " 2001:bf7:830:842a::2/128"
125+ id : 2
128126 persistent_keepalive : 25
129127 - description : " Friend"
130128 public_key : " iBUwLV7EU5odRoiK1GxQGNP1QruBbPp8Lk50yJ/iMno=" # gitleaks:allow
131- allowed_ips :
132- - " 10.248.105.131/32"
133- - " 2001:bf7:830:842a::3/128"
129+ id : 3
134130 persistent_keepalive : 25
135131
136132location_scharni__channel_assignments_11a_standard__to_merge :
Original file line number Diff line number Diff line change @@ -137,9 +137,16 @@ config wireguard_wg_access
137137{% if 'preshared_key' in peer %}
138138 option preshared_key '{{ peer['preshared_key'] }}'
139139{% endif %}
140+ {% if 'id' in peer %}
141+ list allowed_ips '{{ wg_ipv6_subnet | ansible.utils.ipaddr(peer['id'] ) | ansible.utils.ipaddr('address') }}/128'
142+ {% if wg_has_ipv 4 %}
143+ list allowed_ips '{{ wireguard_access['prefix'] | ansible.utils.ipaddr(peer['id'] ) | ansible.utils.ipaddr('address') }}/32'
144+ {% endif %}
145+ {% else %}
140146{% for allowed_ip in peer ['allowed_ips' ] %}
141147 list allowed_ips '{{ allowed_ip }}'
142148{% endfor %}
149+ {% endif %}
143150{% if 'persistent_keepalive' in peer %}
144151 option persistent_keepalive '{{ peer['persistent_keepalive'] }}'
145152{% endif %}
You can’t perform that action at this time.
0 commit comments