Skip to content

Installation

vajonam edited this page Jun 9, 2021 · 25 revisions

AT YOUR OWN RISK!

Firstly this is "at your own risk", this patches the pfSense UI, to allow it to show non-official packages. It also downloads the certificate from the package repo, as well as the necessary configuration that tells the package manager to include this repository.

Before starting make sure you uninstall any existing packages that might be older coming from the the netgate repo

pkf remove pfSense-pkg-WireGuard

pfSense 2.6.0 (devel)

Ths repo is for the 2.6.x (or devel) branch of pfSense. it follows that repository except provides more up to date builds, depending on how long it takes Netgate to accept new features and changes into their repository.

curl -s https://packages.mced.tech/install/install_repo_devel.sh | sh

pfsense 2.5.1

Use this repo for 2.5.1 ports repo of pfSense. it follows that repository except provides more up to date pfSense WireGuard package builds. We will provide builds until netgate start supporting the 2.5.x branch

curl -s https://packages.mced.tech/install/install_repo_251.sh | sh

pfsense 2.5.2

Use this repo for 2.5.1 ports repo of pfSense. it follows that repository except provides more up to date pfSense WireGuard package builds. We will provide builds until netgate start supporting the 2.5.x branch

curl -s https://packages.mced.tech/install/install_repo_252.sh | sh

Remove Repo

curl -s https://packages.mced.tech/install/remove_repo.sh | sh

Installation - Package Manager

The easy method is to goto

  • Diagnostics->Command Prompt->Execute Shell Command paste in the command above and click on execute. Both to install and remove a repo.
  • Once the repo is installed, goto System->Package Manager->Available Packages and WireGuard should be installable.

Installation - Command line

You can use a ssh/console command line or the Diagnostics->Command Prompt->Execute Shell Command

This is the fool proof method of installing the right package. It selects the mced repo which is our repo instead of the NetGate repo. This might be needed in 2.5.2 or 21.05 where the package exists in the main netgate repo and the latest package isn't installed.

pkg install -r mced pfSense-pkg-WireGuard

After installing the package you may have to start the service manually the very first time.


Script Details

#!/bin/sh
CURL=/usr/local/bin/curl
ARCH=`uname -m`
KEY=https://packages.mced.tech/install/poudriere.cert
REPO=https://packages.mced.tech/packages/freebsd_12-2_${ARCH}-ng_ports_251
KEY_LOC=/usr/local/etc/ssl/wireguard.crt
PATCH_LOC=https://packages.mced.tech/install/25_unofficial_packages_list.patch
$CURL -s $KEY -o $KEY_LOC
$CURL -s $PATCH_LOC -o /tmp/pkg.patch
patch -p0 --ignore-whitespace < /tmp/pkg.patch
REPO_OUTPUT="FreeBSD: { enabled: no } 
Unofficial: { url: \"$REPO\", 
mirror_type: \"http\" ,
signature_type: \"pubkey\",
pubkey: \"$KEY_LOC\",
enabled: yes}"
echo $REPO_OUTPUT > /usr/local/etc/pkg/repos/WireGuard.conf
pkg update

Patch Details - This allows the UI to show non-official packages to the use so it allows GUI based installation

--- /etc/inc/pkg-utils.inc.orig	2021-05-29 05:04:18.000000000 +0000
+++ /etc/inc/pkg-utils.inc	2021-06-08 11:05:29.153780000 +0000
@@ -403,7 +403,7 @@
 	if ($base_packages) {
 		$repo_param = "";
 	} else {
-		$repo_param = "-r {$g['product_name']}";
+               $repo_param = "";
 	}
 
 	/*
@@ -475,10 +475,15 @@
 	}
 
 	$result = array();
+	$ar_seen = array();
 	foreach ($search_items as $pkg_info) {
 		if (empty($pkg_info['name'])) {
 			continue;
-		}
+		}	
+		// remove duplicates specifically for WG package
+		if ( $ar_seen[$pkg_info['name']] == 1) 
+			continue;
+		$ar_seen[$pkg_info['name']] = 1;
 
 		if (isset($pkg_filter) && !in_array($pkg_info['name'],
 		    $pkg_filter)) {
@@ -500,7 +505,7 @@
 			    $err);
 			if (!$base_packages &&
 			    rtrim($out) != $g['product_name']) {
-				continue;
+                               //continue;
 			}
 
 			$pkg_info['installed'] = true;