217 |
|
|
218 |
|
|
219 |
panel_link("wireguard", "manager"); |
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`; |