--- rpms/smeserver-wireguard/contribs10/smeserver-wireguard-1.0-bz11721-init.patch 2021/10/28 03:29:13 1.5 +++ rpms/smeserver-wireguard/contribs10/smeserver-wireguard-1.0-bz11721-init.patch 2021/11/02 01:51:58 1.8 @@ -184,3 +184,79 @@ diff -Nur --no-dereference smeserver-wir - -#TODO - +diff -Nur --no-dereference smeserver-wireguard-1.0.old/createlink smeserver-wireguard-1.0/createlink +--- smeserver-wireguard-1.0.old/createlink 2021-10-27 23:25:06.319000000 -0400 ++++ smeserver-wireguard-1.0/createlink 2021-10-27 23:33:11.426000000 -0400 +@@ -16,7 +16,7 @@ + + event_services($event, qw( + masq restart +- 'wg-quick@wg0' restart ++ wg-quick@wg0 restart + )); + event_link("wireguard-network", $event, "30"); + templates2events("/etc/systemd/system-preset/49-koozali.preset", $event); +@@ -54,7 +54,7 @@ + /etc/wireguard/server_public.key + )); + event_services($event, qw( +- 'wg-quick@wg0' restart ++ wg-quick@wg0 restart + )); + event_link("wireguard-user-create", $event, "03"); + +@@ -67,6 +67,11 @@ + event_services($event, qw( + wg-quick@wg0 restart + )); ++ ++$event="remoteaccess-update"; ++event_services($event, qw( ++ wg-quick@wg0 restart ++)); + + + panel_link("wireguard", "manager"); +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 +--- smeserver-wireguard-1.0.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/wireguard.pm 2021-10-26 23:15:10.000000000 -0400 ++++ smeserver-wireguard-1.0/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/wireguard.pm 2021-10-31 22:37:41.238000000 -0400 +@@ -224,6 +224,7 @@ + my $wg0 = $cdb->get('wg-quick@wg0'); + my $ServPublic = $wg0->prop('public'); + my $Port = $wg0->prop('UDPPort'); ++my $allowedips = $wg0->prop('allowedips') || "0.0.0.0/0"; + + #here we guess wan IP + # are we server-gateway mode ? so external lan, should do +@@ -233,15 +234,20 @@ + # dig @resolver4.opendns.com myip.opendns.com +short -4 + # dig @resolver1.ipv6-sandbox.opendns.com AAAA myip.opendns.com +short -6 + ++#DNS ++my $IPAddress = $cdb->get('InternalInterface')->prop('IPAddress'); ++my $dns = ($allowedips =~ /0.0.0.0\/0/)? "DNS = $IPAddress" : "" ; ++ + + my $fulltext ="#configuration for $key $info + [Interface] + PrivateKey = $private + Address = $key ++$dns + + [Peer] + PublicKey = $ServPublic +-AllowedIPs = 0.0.0.0/0 ++AllowedIPs = $allowedips + Endpoint = $ExternalIP:$Port + "; + # we could add a DNS field in [Interface] +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 +--- smeserver-wireguard-1.0.old/root/etc/e-smith/db/configuration/migrate/wireguard 2021-11-01 21:46:45.647000000 -0400 ++++ smeserver-wireguard-1.0/root/etc/e-smith/db/configuration/migrate/wireguard 2021-11-01 21:50:17.661000000 -0400 +@@ -1,4 +1,6 @@ + { ++my $wireguard = $DB->get('wg-quick@wg0') || $DB->new_record('wg-quick@wg0', {type => 'service'}); ++ + # add private and public key if not present + unless (defined ${'wg-quick@wg0'}{'private'}) { + $value= `/usr/bin/wg genkey`;