184 |
- |
- |
185 |
-#TODO |
-#TODO |
186 |
- |
- |
187 |
|
diff -Nur --no-dereference smeserver-wireguard-1.0.old/createlink smeserver-wireguard-1.0/createlink |
188 |
|
--- smeserver-wireguard-1.0.old/createlink 2021-10-27 23:25:06.319000000 -0400 |
189 |
|
+++ smeserver-wireguard-1.0/createlink 2021-10-27 23:33:11.426000000 -0400 |
190 |
|
@@ -16,7 +16,7 @@ |
191 |
|
|
192 |
|
event_services($event, qw( |
193 |
|
masq restart |
194 |
|
- 'wg-quick@wg0' restart |
195 |
|
+ wg-quick@wg0 restart |
196 |
|
)); |
197 |
|
event_link("wireguard-network", $event, "30"); |
198 |
|
templates2events("/etc/systemd/system-preset/49-koozali.preset", $event); |
199 |
|
@@ -54,7 +54,7 @@ |
200 |
|
/etc/wireguard/server_public.key |
201 |
|
)); |
202 |
|
event_services($event, qw( |
203 |
|
- 'wg-quick@wg0' restart |
204 |
|
+ wg-quick@wg0 restart |
205 |
|
)); |
206 |
|
event_link("wireguard-user-create", $event, "03"); |
207 |
|
|
208 |
|
@@ -67,6 +67,11 @@ |
209 |
|
event_services($event, qw( |
210 |
|
wg-quick@wg0 restart |
211 |
|
)); |
212 |
|
+ |
213 |
|
+$event="remoteaccess-update"; |
214 |
|
+event_services($event, qw( |
215 |
|
+ wg-quick@wg0 restart |
216 |
|
+)); |
217 |
|
|
218 |
|
|
219 |
|
panel_link("wireguard", "manager"); |
220 |
|
diff -Nur --no-dereference smeserver-wireguard-1.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/wireguard.pm smeserver-wireguard-1.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/wireguard.pm |
221 |
|
--- smeserver-wireguard-1.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/wireguard.pm 2021-10-26 23:15:10.000000000 -0400 |
222 |
|
+++ smeserver-wireguard-1.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/wireguard.pm 2021-10-31 22:37:41.238000000 -0400 |
223 |
|
@@ -224,6 +224,7 @@ |
224 |
|
my $wg0 = $cdb->get('wg-quick@wg0'); |
225 |
|
my $ServPublic = $wg0->prop('public'); |
226 |
|
my $Port = $wg0->prop('UDPPort'); |
227 |
|
+my $allowedips = $wg0->prop('allowedips') || "0.0.0.0/0"; |
228 |
|
|
229 |
|
#here we guess wan IP |
230 |
|
# are we server-gateway mode ? so external lan, should do |
231 |
|
@@ -233,15 +234,20 @@ |
232 |
|
# dig @resolver4.opendns.com myip.opendns.com +short -4 |
233 |
|
# dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6 |
234 |
|
|
235 |
|
+#DNS |
236 |
|
+my $IPAddress = $cdb->get('InternalInterface')->prop('IPAddress'); |
237 |
|
+my $dns = ($allowedips =~ /0.0.0.0\/0/)? "DNS = $IPAddress" : "" ; |
238 |
|
+ |
239 |
|
|
240 |
|
my $fulltext ="#configuration for $key $info |
241 |
|
[Interface] |
242 |
|
PrivateKey = $private |
243 |
|
Address = $key |
244 |
|
+$dns |
245 |
|
|
246 |
|
[Peer] |
247 |
|
PublicKey = $ServPublic |
248 |
|
-AllowedIPs = 0.0.0.0/0 |
249 |
|
+AllowedIPs = $allowedips |
250 |
|
Endpoint = $ExternalIP:$Port |
251 |
|
"; |
252 |
|
# we could add a DNS field in [Interface] |
253 |
|
diff -Nur --no-dereference smeserver-wireguard-1.0.old/root/etc/e-smith/db/configuration/migrate/wireguard smeserver-wireguard-1.0/root/etc/e-smith/db/configuration/migrate/wireguard |
254 |
|
--- smeserver-wireguard-1.0.old/root/etc/e-smith/db/configuration/migrate/wireguard 2021-11-01 21:46:45.647000000 -0400 |
255 |
|
+++ smeserver-wireguard-1.0/root/etc/e-smith/db/configuration/migrate/wireguard 2021-11-01 21:50:17.661000000 -0400 |
256 |
|
@@ -1,4 +1,6 @@ |
257 |
|
{ |
258 |
|
+my $wireguard = $DB->get('wg-quick@wg0') || $DB->new_record('wg-quick@wg0', {type => 'service'}); |
259 |
|
+ |
260 |
|
# add private and public key if not present |
261 |
|
unless (defined ${'wg-quick@wg0'}{'private'}) { |
262 |
|
$value= `/usr/bin/wg genkey`; |