Skip to content

Commit 0963742

Browse files
Merge v0.0.9 into main (#68)
* Adds ajax support for calculating public key if a private key is entered manually * Introduce new function wg_status_json() * wg_status now returns an array of current wg status, wg_status_json is a wrapper for wg_status * Refinements to API and status page * Working on new status page * More work on cleaning up some UI code * Status page work * Status page tweaks * Status page tweaks * Status page tweaking * Accidently broke the tunnel edit page, fixed. * Small UI changes * Small change to UI * Testing UI work * Testing * backing out some fubar code * more status-fu (#49) * more status-fu * change icon Co-authored-by: R. Christian McDonald <rcmcdonald91@gmail.com> * Some cleanup * Moving GUI related backend to a new include file * Trying to work around pfSense menu bug * Testing * Settling on a workaround, status menu renamed to "WireGuard " (with a space) * Testing * Testing * Test * Cleaning up * Fix string escaping * syntax bug * Fixed typo * Fix * Cleanup * Typo * Testing * Add addressess popup everywhere * Enabled links on addresses popups to relevant pages * Add hover tooltip on status icons * Syntax error on new tooltip definitions * All address popups are now links to either a tunnel or a peer. * Syntax fix * Ensure wg_status includes a peer array, even if empty. * Bunk logic on the latest fix, now fixed for real * Refinements * Working on upgrading xml structure for addresses and allowedips * Working on modifying address xml tree * Working on modifying address xml structure * Syntax bug * Working on xml upgrade * More work on upgrading XML * Cosmetic * popup fix due to restructure * Working on new address xml structure reading and writing * Working on new address xml structure * Working on new xml structure for addresses * Syntax bug * More work on xml address structure * Tweaked css/html on popover * More work on xml * Cleaning up some bits * Syntax fix * Cleaning up * Working xml upgrade routines * Fixed incorrect logic * More work on new XML structure for addresses * Added a delete tunnel button to tunnel edit page * Should be usepost * Reverting from the previous commit * Now working on peers * slight tweaks * Another tweak * More cleanups and testing * Syntax bug * Tweaked the peer edit page, now hides address entry if allowing all ipv4 and ipv6 * UI improvements * UI Improvements * UI Improvements * Some more UI cleanups * Fix toggle icon generator rewrite * Cleanups * Syntax bug fix * More UI cleanups * Fixed input field id * This should restore config file generation after the latest changes to the XML structure * Should fix allowed ip popup on status page * Fix conf generation * This should be moved up to count peers properly * Fixes allowedips on tunnel edit peer list * add routes * add routes again * update status output to match new xml format * change update interfval and remove all the older code * fix javascript clone bug * Fix allowed ips list on peers * Add wg_foot.inc shim for fixing some javascript bugs * Fix pkglist to include foot shim * More UI refinements * More UI refinements * Counting the wrong array * Tweaks * Typo * sort address to be shown, consistency * check for assigned interface if no address items are assinged to the wg tunnel * oops left in var_dump * oops left in var_dump (#63) * add back sort * move to builins from preg_match * roll this back * move to builtin from preg_match * Merge backend rewrite into devel (#66) - Replaces wg-quick with native tools like `wg` , `ifconfig`, and pfSense built-ins - Updates package dependencies to remove `bash` and replace `wireguard-tools` with `wireguard-tools-lite` - Fixes issues with services like dpinger and frr not working correctly with tunnel interfaces after system startup - Lots of additional code improvements and cleanups * Fix peer re-saving with same public key * Improved earlyshellcmd handling * Rewriting some install/deinstall routines for robustness * Switched to using pfSense builtins for kernel muting * Destroy tunnels as deinstall * Working on kmod unloading at deinstall * Working on kmod unloading at deinstall Co-authored-by: vajonam <152501+vajonam@users.noreply.github.com> Co-authored-by: Manojav Sridhar <manojav@manojav.com>
1 parent 3f6a6ff commit 0963742

18 files changed

+2064
-921
lines changed

src/Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PORTNAME= pfSense-pkg-WireGuard
2-
PORTVERSION= 0.0.8
2+
PORTVERSION= 0.0.9
33
CATEGORIES= net
44
MASTER_SITES= # empty
55
DISTFILES= # empty
@@ -11,9 +11,8 @@ COMMENT= pfSense package WireGuard
1111

1212
LICENSE= APACHE20
1313

14-
RUN_DEPENDS= bash>0:shells/bash \
15-
wireguard-kmod>0:net/wireguard-kmod \
16-
wireguard-tools>0:net/wireguard-tools
14+
RUN_DEPENDS= wireguard-kmod>0:net/wireguard-kmod \
15+
wireguard-tools-lite>0:net/wireguard-tools-lite
1716

1817
NO_BUILD= yes
1918
NO_MTREE= yes
@@ -27,10 +26,12 @@ do-extract:
2726
do-install:
2827
${MKDIR} ${STAGEDIR}/etc/inc/priv
2928

29+
${MKDIR} ${STAGEDIR}${PREFIX}/etc
30+
3031
${MKDIR} ${STAGEDIR}${PREFIX}/pkg/wireguard
3132

3233
${MKDIR} ${STAGEDIR}${PREFIX}/www/shortcuts
33-
${MKDIR} ${STAGEDIR}${PREFIX}/www/wg
34+
${MKDIR} ${STAGEDIR}${PREFIX}/www/wg/js
3435

3536
${MKDIR} ${STAGEDIR}${DATADIR}
3637

@@ -40,6 +41,9 @@ do-install:
4041
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/wireguard.xml \
4142
${STAGEDIR}${PREFIX}/pkg
4243

44+
${INSTALL_DATA} -m 0755 ${FILESDIR}${PREFIX}/etc/rc.* \
45+
${STAGEDIR}${PREFIX}/etc
46+
4347
${INSTALL_DATA} ${FILESDIR}${PREFIX}/pkg/wireguard/*.inc \
4448
${STAGEDIR}${PREFIX}/pkg/wireguard
4549

@@ -49,6 +53,9 @@ do-install:
4953
${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/wg/*.php \
5054
${STAGEDIR}${PREFIX}/www/wg
5155

56+
${INSTALL_DATA} ${FILESDIR}${PREFIX}/www/wg/js/*.js \
57+
${STAGEDIR}${PREFIX}/www/wg/js
58+
5259
${INSTALL_DATA} ${FILESDIR}${DATADIR}/info.xml \
5360
${STAGEDIR}${DATADIR}
5461

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/local/bin/php-cgi -f
2+
<?php
3+
/*
4+
* rc.reload_wireguard
5+
*
6+
* part of pfSense (https://www.pfsense.org)
7+
* Copyright (c) 2021 R. Christian McDonald
8+
* All rights reserved.
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License");
11+
* you may not use this file except in compliance with the License.
12+
* You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing, software
17+
* distributed under the License is distributed on an "AS IS" BASIS,
18+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
* See the License for the specific language governing permissions and
20+
* limitations under the License.
21+
*/
22+
23+
// pfSense includes
24+
require_once('globals.inc');
25+
require_once('service-utils.inc');
26+
require_once('util.inc');
27+
28+
// WireGuard includes
29+
require_once('wireguard/wg.inc');
30+
31+
global $wgg, $g;
32+
33+
wg_globals();
34+
35+
// This is a hack to get text onto the console during booting
36+
function print_message($message) {
37+
38+
$message = gettext($message);
39+
40+
$message = escapeshellarg($message);
41+
42+
mwexec("printf {$message} >&2");
43+
44+
}
45+
46+
$booting = platform_booting();
47+
48+
if ($booting) {
49+
50+
print_message("Configuring WireGuard tunnels...");
51+
52+
mute_kernel_msgs();
53+
54+
}
55+
56+
//wg_resync_all();
57+
58+
service_control_restart('unbound', null);
59+
60+
service_control_restart('dpinger', null);
61+
62+
if ($booting) {
63+
64+
unmute_kernel_msgs();
65+
66+
print_message("done. \n");
67+
68+
}
69+
70+
?>

src/files/usr/local/pkg/wireguard.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,25 @@
3737
<url>/wg/vpn_wg_tunnels.php</url>
3838
</menu>
3939
<menu>
40-
<name>WireGuard Status</name>
40+
<name>WireGuard </name>
4141
<section>Status</section>
4242
<url>/wg/status_wireguard.php</url>
4343
</menu>
4444
<custom_php_install_command>
45+
<![CDATA[
4546
wg_install();
47+
]]>
4648
</custom_php_install_command>
4749
<custom_php_pre_deinstall_command>
50+
<![CDATA[
4851
wg_deinstall();
52+
]]>
4953
</custom_php_pre_deinstall_command>
5054
<custom_php_validation_command>
5155
</custom_php_validation_command>
5256
<custom_php_resync_config_command>
53-
wg_resync();
57+
<![CDATA[
58+
wg_resync_all();
59+
]]>
5460
</custom_php_resync_config_command>
55-
</packagegui>
61+
</packagegui>

0 commit comments

Comments
 (0)