This is a port of the original WireGuard UI bits as implemented by Netgate in pfSense 2.5.0 to a package suitable for rapid iteration and more frequent updating on future releases of pfSense.

Overview

pfSense-pkg-WireGuard

This is a port of the original WireGuard*** UI bits as implemented by Netgate in pfSense 2.5.0 to a package suitable for sideloading and more frequent updating on future releases of pfSense.

This also includes some improvments such as a proper status page (found under Status / WireGuard Status) and improved assigned interface handling.

Because of the present limitations with pfSense internals and what packages can (and cannot) do on the system, this package includes several opinionated design changes that attempt to work around these limitations. The goal of this package is to use nothing more than what pfSense gives us and to leave the core codebase untouched. This will (should) greatly accelerate the review and testing required for consideration in the offical package repository.

These changes include:

  1. XML configuration bits have been moved from wireguard/tunnel to installedpackages/wireguard/tunnel (this package will currently NOT convert tunnels created using the old 2.5.0 schema and config location).
  2. Assigned interfaces are now configured under the traditional pfSense interfaces.php page. Unassigned tunnels are still configured through the WireGuard UI.
  3. Gateways are no longer automatically created for tunnels assigned to pfSense interfaces. Just like any other WAN, you will now be required to create your own gateway entries for the tunnel remote side if you intended to route traffic over the tunnel itself.
  4. There is now a proper status page at Status > WireGuard Status. This page includes various bits from wg(8), ifconfig(8), pkg(7), and kldstat(8).

Note: I have now moved development to the dev branch. Moving forward main will contain code that has been tested. If you want to run dev branch code, you will need to checkout the branch and make package yourself.

Developed on pfSense 2.6.0-DEVELOPMENT snapshots.

Now tested on pfSense 2.5.1 and 2.6.0-DEVELOPMENT

DO NOT INSTALL ON pfSense 2.5.0.

Build

The build process is similar to that of other FreeBSD and pfSense packages. You will need to set up a FreeBSD build environment and install or build wireguard and wireguard-kmod on it. Please check the pfSense package development documentation for more information.

wireguard-kmod requires headers found in the kernel source and header files in SRC_BASE=/usr/src . Here is one solution:

for 12.2-RELEASE , amd64

cd /tmp
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.2-RELEASE/src.txz
tar -C / -zxvf src.txz
rm /tmp/src.txz

Installation

This package depends on the wireguard-tools and wireguard-kmod ports for FreeBSD. Download or build these packages for that version of FreeBSD, then manually install them using pkg before installing this package.

Look for latest package links of wireguard-tools and wireguard-kmod in FreeBSD 12 repository.

NOTE: As of 4/6/2021, wireguard-kmod is not being actively built by FreshPorts. You will probably have to build these packages manually.

You can find pre-compiled binaries and packages here.

Configuration

https://docs.netgate.com/pfsense/en/latest/vpn/wireguard/index.html

Note: The Netgate documentation reflects WireGuard as implemented in 2.5.0. There are several differences due to the packaged nature of this implementation that diverge the configuration steps from the official Netgate docs. (See the notes above).

Recognition

*** "WireGuard" and the "WireGuard" logo are registered trademarks of Jason A. Donenfeld.

Comments
  • [FEATURE] Adding suggested ApprovedIP when adding peer

    [FEATURE] Adding suggested ApprovedIP when adding peer

    This PR should resolve RM ticket 11588.

    It adds a new setting option Suggest Next Approved IP.

    If the above setting is enabled, when a user creates a new peer (for an existing tunnel atm, need to look at breaking out to JS so we can pick it up when the user navigates to Add New Peer page without pre-selecting a tunnel) it will work out what the next available IP address is.

    It does this by working out the subnet value, broadcast value, and any existing peers. Once we have these values we can iterate from the subnet + 1 up until broadcast - 1, the first available IP address is "taken".

    So we have the following examples of expected behaviour:

    • Tunnel's assigned interface has static IPv4 address of 192.168.100.1 with cidr range of /24

      • Peers with the IP addresses: 192.168.100.2, 192.168.100.3, 192.168.100.4, 192.168.100.6, 192.168.100.7
      • With the above setting enabled, when click the "Add new peer for this tunnel" button, it will pre-fill the ApprovedIP list with the address 192.168.100.5/32 given it's available. Doing this a second time (if we create .100.5) will result in the IP address 192.168.100.8/32 being suggested
    • Tunnel's WG specified IP address of 192.168.150.254/24

      • Suggests IP address 192.168.150.1/32

    In this PR I'm iterating from subnet to broadcast as we can't assume the interface address is always lowest (.1/24 for example) as it could also be highest (.254/24 for example).

    This is currently a work in progress and should not be deployed.

    opened by GenericStudent 5
  • [FEATURE] Configurable peer status visibility

    [FEATURE] Configurable peer status visibility

    This PR allows the user to configure the default visibility for all Peers on the Status page.

    Personally I like to see all Peers on status page load as I don't have too many. It defaults to true (consistent with pre PR behaviour).

    enhancement 
    opened by GenericStudent 5
  • [FEATURE] Revised Peer Config QR Code Generation

    [FEATURE] Revised Peer Config QR Code Generation

    There are still a few TODO comments and QR config options left unfilled (DNS, MTU, Endpoint) which are discussed here.

    Need to look at how to reference / link back the JS library used this one which has an MIT licence.

    Hopefully this implements #7 better than my initial attempt

    opened by GenericStudent 4
  • Made widget update every 5 cycles

    Made widget update every 5 cycles

    This makes the widget more repsponsive and displays changes in active peers, transferred bytes, and even state changes of the WireGuard service.

    This is a basic update which just updatesa the entire DOMs HTML as other widgets seem to do.

    Adds to #119

    opened by GenericStudent 3
  • fix for https://redmine.pfsense.org/issues/13153

    fix for https://redmine.pfsense.org/issues/13153

    After downing & upping WG site to site tunnels, or stopping / restarting the service, any static routes are lost and the tunnels break if you're not using FRR/BGP etc.

    This adds a call to system_staticroutes_configure() in wg_service.inc so the routes get re-added. I tested this on 22.05.b.20220512.0600 with 2 S2S tunnels and a RemoteAccess tunnel.

    see https://redmine.pfsense.org/issues/13153

    opened by luckman212 2
  • [FEATURE] New peer validation to prevent duplicate default routes

    [FEATURE] New peer validation to prevent duplicate default routes

    Resolves RM ticket 11465.

    This PR will add validation checks and user feedback if they attempt to add a new peer to a tunnel which already has another peer with either 0.0.0.0/0 or ::/0 (or both) default routes specified in the allowed ips list, which is not valid.

    Current plugin validation does not catch this issue.

    I do have a query regarding a difference between this plugin and the original WG implementation; the ticket lists a bunch of test scenarios:

    PASS    Create a tunnel with one peer that has Allowed IPs empty -- should succeed
    
    PASS    Create a tunnel with the first peer Allowed IPs set to "10.0.0.0/24" or equivalent non-default network
    PASS    Add a peer to this tunnel with Allowed IPs set to "0.0.0.0/0" -- should succeed (first IPv4 default for this tunnel)
    PASS    Add a peer to this tunnel with Allowed IPs set to "::/0" -- should succeed (first IPv6 default for this tunnel)
    FAIL    Add a peer to this tunnel with Allowed IPs empty -- should fail (additional attempt at IPv4 and IPv6 default)
    PASS    Add a peer to this tunnel with Allowed IPs set to "0.0.0.0/0" -- should fail
    PASS    Add a peer to this tunnel with Allowed IPs set to "::/0" -- should fail
    
        Create a tunnel with the first peer Allowed IPs set to "10.0.0.0/24" or equivalent non-default network -- should succeed
        Add a peer to this tunnel with Allowed IPs empty -- should succeed (IPv4 and IPv6 default for this tunnel)
        Add a peer to this tunnel with Allowed IPs empty -- should fail
        Add a peer to this tunnel with Allowed IPs set to "::/0" -- should fail
        Add a peer to this tunnel with Allowed IPs set to "0.0.0.0/0" -- should fail
    
        Create a tunnel with the first peer Allowed IPs empty -- should succeed
        Add a peer to this tunnel with Allowed IPs set to "::/0" -- should fail
        Add a peer to this tunnel with Allowed IPs set to "0.0.0.0/0" -- should fail
        Add a peer to this tunnel with Allowed IPs set to "10.0.1.0/24" -- should succeed
        Add a peer to this tunnel with Allowed IPs set to "fc07:1::0/64" -- should succeed
    
        Create a tunnel with the first peer Allowed IPs set to "10.5.0.0/24" or equivalent non-default network -- should succeed
        Add a peer to this tunnel with Allowed IPs set to "10.5.1.0/24" -- should succeed
        Add a peer to this tunnel with Allowed IPs set to "10.5.2.0/24" -- should succeed
    

    However does this plugin actually take an allowed IPs list of (none) to equate the default route for both IPv4 and IPv6 for this tunnel? I've a hunch it doesn't and because it doesn't the provided validation logic will not catch this scenario.

    It will prevent any attempt to add a new peer to a tunnel which already has a default route (checks 0.0.0.0/0 or v4 and ::/0 for v6); which leads onto my section question, which is more generic.

    Does this wireguard plugin (or anything in pSense more generally) validate IPv6 ::/0 addresses for compression? As currently a user could "bypass" this new IPv6 default route validation by providing any of the following values instead:

    • 0::/0
    • 0:0000:0::/0
    • ::0/0
    • etc

    But would WG / any other pfSense component actually accept these variants of the same address for routing purposes?

    opened by GenericStudent 2
  • [BUGFIX] Allow clipboard APIs on HTTP

    [BUGFIX] Allow clipboard APIs on HTTP

    Resolves redmine ticket: 12258

    Added more JS logic to allow for browsers who wont allow access to navigator.clipboard API to still copy public keys for tunnels, peers list and tunnel edit.

    Works on HTTP admin access as a fallback, still attempts the modern API first

    opened by GenericStudent 1
  • BUGFIX Resolves treegrid flickering

    BUGFIX Resolves treegrid flickering

    Inline with my previous PR of using CSS to display:none the items we didn't want to see on page load (tunnels list always and status page only if use has unchecked hide peers checkbox).

    I still feel leacing it to the JS to hide the rows leads to poor UX with flickering

    opened by GenericStudent 1
  • [FEATURE] Added primative widget for WireGuard

    [FEATURE] Added primative widget for WireGuard

    This commit brings along a very simple widget for the dashboard page which displays all tunnels configured, their description, # of peers, listening port, and traffic stats.

    Will display info boxes if:

    • The service is not running
    • No tunnels are configured

    This widget is a copy-pasta from the wg status code, but slimmed down to not show peers and all the tunnel details.

    Discussions should be had around what fields people care about as it could easily be too "busy" for a widget.

    Also this can be a starting point for adding actions into the widget such as restarting tunnels, toggling peers, etc

    Implements #119

    opened by GenericStudent 1
  • [BUGFIX] Keepalive validation and allowing 0 value

    [BUGFIX] Keepalive validation and allowing 0 value

    This PR resolves redmine issue 12251.

    It does so in two parts:

    • Validate the user provided keepalive to check for 16 bit uint value (0-65535)
    • Allow the WG Config class to write out the default value of "0" to a config

    Now a user will be informed and a bad value rejected if not within 0-65535, and the default value of 0 is now actually written out to the configs.

    opened by GenericStudent 0
  • [BUGFIX] Resolves pages flickering & public key cursor on hover

    [BUGFIX] Resolves pages flickering & public key cursor on hover

    Tunnel list page featuring the tunnel's public key in a table and the Peers list page featuring the peer's public key both have JS events alowing the user to click on them to copy their value, however I only kno about this due to looking at the source code and console errors (previous PR fixed); Having the cursor set to pointer will at least show the user it's clickable, and hopefully they find out it copies the value. Being able to provide a toast or similar may be more useful for UX feedback.

    When loading tunnels page or status page, the DOM will flicker as divs are loaded with a display but JS then hides them when loaded.

    This PR:

    • Resolves flickering on tunnel list page, and settings page
    • Ensures cursor: pointer is set on the Tunnel list page and the peers lis page for the Tunne / Peer public key field which is truncated
    opened by GenericStudent 0
Releases(v0.1.6)
Owner
R. Christian McDonald
R. Christian McDonald
salah eddine bendyab 18 Aug 17, 2021
This component provides functions unavailable in releases prior to PHP 8.0.

This component provides functions unavailable in releases prior to PHP 8.0.

Symfony 1.5k Dec 29, 2022
Skosmos is a web-based tool providing services for accessing controlled vocabularies, which are used by indexers describing documents and searchers looking for suitable keywords.

Skosmos is a web-based tool providing services for accessing controlled vocabularies, which are used by indexers describing documents and searchers looking for suitable keywords.

National Library of Finland 195 Dec 24, 2022
A PocketMine-MP plugin that replaces a block to another block when breaks, then back to the original block after a certain time

BlockReplacer A PocketMine-MP plugin that replaces a block to another block when breaks, then back to the original block after a certain time How to I

AIPTU 11 Sep 2, 2022
BetterMobs - a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste

BetterMobsOverworld BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste. MadoxMC Just Edited This plugin to Make 3 Compatible Plugins to add Mobs on your Overworld Worlds, NetherWorlds & EndWorlds, MadoxMC Idea.

MadoxMC 4 Dec 15, 2022
BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste.

BetterMobs is a plugin Remixed, by MadoxMC, the original plugin is maked by tgwaste. MadoxMC Just Edited This plugin to Make 3 Compatible Plugins to add Mobs on your Overworld Worlds, NetherWorlds & EndWorlds, MadoxMC Idea.

MadoxMC 10 Dec 15, 2022
Production-grade rapid controller development with built in love for API and Search

Installation For CakePHP 4.x compatible version: composer require friendsofcake/crud For CakePHP 3.x compatible version: composer require friendsofca

Friends Of Cake 357 Jan 2, 2023
DiscordLookup | Get more out of Discord with Discord Lookup! Snowflake Decoder, Guild List with Stats, Invite Info and more...

DiscordLookup Get more out of Discord with Discord Lookup! Snowflake Decoder, Guild List with Stats, Invite Info and more... Website Getting Help Tool

Felix 69 Dec 23, 2022
A cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.

Motan Overview Motan is a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services. Related

Weibo R&D Open Source Projects 5.8k Dec 20, 2022
PHP implementation of Rapid Automatic Keyword Exraction algorithm (RAKE) for extracting multi-word phrases from text

PHP implementation of Rapid Automatic Keyword Exraction algorithm (RAKE) for extracting multi-word phrases from text.

Assisted Mindfulness 7 Oct 19, 2022
A PHP library to integrate with eWAY's Rapid Payment API.

A PHP library to integrate with eWAY's Rapid Payment API.

null 0 Jul 15, 2022
Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.

TARS - A Linux Foundation Project TARS Foundation Official Website TARS Project Official Website WeChat Group: TARS01 WeChat Offical Account: TarsClou

THE TARS FOUNDATION PROJECTS 9.6k Jan 1, 2023
Ratio plugin is a luck plugin. The more lucky you are, the more you win!

Ratio Ratio plugin is a luck plugin. The more lucky you are, the more you win Features When you break a block (Cobblestone), it gives/puts you somethi

Ali Tura Çetin 2 Apr 25, 2022
The game is implemented as an example of scalable and high load architecture combined with modern software development practices

Crossword game The game is implemented as an example of scalable and high load architecture combined with modern software development practices Exampl

Roman 56 Oct 27, 2022
Exploiting and fixing security vulnerabilities of an old version of E-Class. Project implemented as part of the class YS13 Cyber-Security.

Open eClass 2.3 Development of XSS, CSRF, SQLi, RFI attacks/defences of an older,vulnerable version of eclass. Project implemented as part of the clas

Aristi_Papastavrou 11 Apr 23, 2022
A redacted PHP port of Underscore.js with additional functions and goodies – Available for Composer and Laravel

Underscore.php The PHP manipulation toolbelt First off : Underscore.php is not a PHP port of Underscore.js (well ok I mean it was at first). It's does

Emma Fabre 1.1k Dec 11, 2022
Examples of some common design patterns implemented in php

What is a Design Pattern? Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can c

Bakhtiyor Bahritidinov 4 Feb 11, 2022
Port of the Java Content Repository (JCR) to PHP.

PHP Content Repository PHPCR This repository contains interfaces for the PHPCR standard. The JSR-283 specification defines an API for a Content Reposi

PHPCR 436 Dec 30, 2022
Easy to use utility functions for everyday PHP projects. This is a port of the Lodash JS library to PHP

Lodash-PHP Lodash-PHP is a port of the Lodash JS library to PHP. It is a set of easy to use utility functions for everyday PHP projects. Lodash-PHP tr

Lodash PHP 474 Dec 31, 2022