From owner-svn-ports-all@freebsd.org Mon Mar 22 12:07:47 2021 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6265B5AC9D0; Mon, 22 Mar 2021 12:07:47 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3tYH2N6Tz3KRS; Mon, 22 Mar 2021 12:07:47 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 405B256FC; Mon, 22 Mar 2021 12:07:47 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 12MC7lOu096815; Mon, 22 Mar 2021 12:07:47 GMT (envelope-from decke@FreeBSD.org) Received: (from decke@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 12MC7jF2096809; Mon, 22 Mar 2021 12:07:45 GMT (envelope-from decke@FreeBSD.org) Message-Id: <202103221207.12MC7jF2096809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: decke set sender to decke@FreeBSD.org using -f From: Bernhard Froehlich Date: Mon, 22 Mar 2021 12:07:45 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r568953 - in head/net: . wireguard wireguard-tools wireguard-tools/files X-SVN-Group: ports-head X-SVN-Commit-Author: decke X-SVN-Commit-Paths: in head/net: . wireguard wireguard-tools wireguard-tools/files X-SVN-Commit-Revision: 568953 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Mar 2021 12:07:47 -0000 Author: decke Date: Mon Mar 22 12:07:45 2021 New Revision: 568953 URL: https://svnweb.freebsd.org/changeset/ports/568953 Log: net/wireguard-tools: Repocopy from net/wireguard, flavorize and add rc.d script for lite flavor Added: head/net/wireguard-tools/ - copied from r568952, head/net/wireguard/ head/net/wireguard-tools/files/wireguard_lite.in (contents, props changed) head/net/wireguard-tools/files/wireguard_wgquick.in (contents, props changed) Deleted: head/net/wireguard/ head/net/wireguard-tools/files/wireguard.in Modified: head/net/Makefile head/net/wireguard-tools/Makefile head/net/wireguard-tools/distinfo head/net/wireguard-tools/pkg-descr head/net/wireguard-tools/pkg-plist Modified: head/net/Makefile ============================================================================== --- head/net/Makefile Mon Mar 22 12:03:11 2021 (r568952) +++ head/net/Makefile Mon Mar 22 12:07:45 2021 (r568953) @@ -1527,9 +1527,9 @@ SUBDIR += webalizer-geodb SUBDIR += whois SUBDIR += widentd - SUBDIR += wireguard SUBDIR += wireguard-go SUBDIR += wireguard-kmod + SUBDIR += wireguard-tools SUBDIR += wireshark SUBDIR += wireshark-lite SUBDIR += wlan2eth Modified: head/net/wireguard-tools/Makefile ============================================================================== --- head/net/wireguard/Makefile Mon Mar 22 12:03:11 2021 (r568952) +++ head/net/wireguard-tools/Makefile Mon Mar 22 12:07:45 2021 (r568953) @@ -1,10 +1,9 @@ # $FreeBSD$ -PORTNAME= wireguard +PORTNAME= wireguard-tools PORTVERSION= 1.0.20210315 CATEGORIES= net net-vpn MASTER_SITES= https://git.zx2c4.com/wireguard-tools/snapshot/ -DISTNAME= wireguard-tools-${PORTVERSION} MAINTAINER= decke@FreeBSD.org COMMENT= Fast, modern and secure VPN Tunnel @@ -12,8 +11,10 @@ COMMENT= Fast, modern and secure VPN Tunnel LICENSE= GPLv2 LICENSE_FILE= ${WRKDIR}/${DISTNAME}/COPYING +FLAVORS= default lite +lite_PKGNAMESUFFIX= -lite + USES= gmake tar:xz -USE_RC_SUBR= ${PORTNAME} WRKSRC= ${WRKDIR}/${DISTNAME}/src @@ -26,10 +27,21 @@ OPTIONS_DEFAULT=WGQUICK OPTIONS_SUB= yes WGQUICK_DESC= wg-quick(8) userland utility -WGQUICK_RUN_DEPENDS= bash:shells/bash \ - wireguard-go:net/wireguard-go +WGQUICK_RUN_DEPENDS= bash:shells/bash WGQUICK_MAKE_ARGS= WITH_WGQUICK=yes WGQUICK_MAKE_ARGS_OFF= WITH_WGQUICK=no + +.if ${FLAVOR:U} == lite +USE_RC_SUBR= wireguard_lite +OPTIONS_EXCLUDE=WGQUICK +COMMENT+= (lite flavor) +.endif + +.include + +.if ${PORT_OPTIONS:MWGQUICK} +USE_RC_SUBR= wireguard_wgquick +.endif post-patch: @${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \ Modified: head/net/wireguard-tools/distinfo ============================================================================== --- head/net/wireguard/distinfo Mon Mar 22 12:03:11 2021 (r568952) +++ head/net/wireguard-tools/distinfo Mon Mar 22 12:07:45 2021 (r568953) @@ -1,3 +1,3 @@ -TIMESTAMP = 1615823936 +TIMESTAMP = 1615824165 SHA256 (wireguard-tools-1.0.20210315.tar.xz) = af001d5492be6bf58ef0bebe04b446b6f50eb53e1226fab679cc34af40733a22 SIZE (wireguard-tools-1.0.20210315.tar.xz) = 96988 Added: head/net/wireguard-tools/files/wireguard_lite.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/wireguard-tools/files/wireguard_lite.in Mon Mar 22 12:07:45 2021 (r568953) @@ -0,0 +1,98 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: wireguard +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# wireguard_enable (bool): Set to "YES" to enable wireguard. +# (default: "NO") +# +# wireguard_interfaces (str): List of interfaces to bring up/down +# on start/stop. (eg: "wg0 wg1") +# (default: "") +# wireguard__ips (str): List of IP Addresses for iface +# wireguard__routes (str): List of Routes for this iface +# wireguard__mtu (str): MTU for iface (default: "1500") + +. /etc/rc.subr + +load_rc_config $name + +: ${wireguard_enable="NO"} +: ${wireguard_interfaces=""} + +name=wireguard +rcvar=wireguard_enable +extra_commands="reload" + +start_cmd="${name}_start" +stop_cmd="${name}_stop" +reload_cmd="${name}_reload" + +wireguard_start() +{ + for interface in ${wireguard_interfaces}; do + load_rc_config wireguard_${interface} + + eval wireguard_ips="\${wireguard_${interface}_ips}" + eval wireguard_routes="\${wireguard_${interface}_routes}" + eval wireguard_mtu="\${wireguard_${interface}_mtu}" + + ifconfig ${interface} create + %%PREFIX%%/bin/wg setconf ${interface} %%PREFIX%%/etc/wireguard/${interface}.conf + + for ip in ${wireguard_ips}; do + if [ "${ip#*:}" != "${ip}" ]; then + ifconfig ${interface} inet6 ${ip} alias + else + ifconfig ${interface} inet ${ip} alias + fi + done + + if [ ! -z "${wireguard_mtu}" ]; then + ifconfig ${interface} mtu ${wireguard_mtu} + fi + + ifconfig ${interface} up + + for route in ${wireguard_routes}; do + if [ "${route#*:}" != "${route}" ]; then + route -q -n add -inet6 ${route} -interface ${interface} + else + route -q -n add -inet ${route} -interface ${interface} + fi + done + done +} + +wireguard_stop() +{ + for interface in ${wireguard_interfaces}; do + load_rc_config wireguard_${interface} + + eval wireguard_routes="\${wireguard_${interface}_routes}" + + for route in ${wireguard_routes}; do + if [ "${route#*:}" != "${route}" ]; then + route -q -n delete -inet6 ${route} -interface ${interface} + else + route -q -n delete -inet ${route} -interface ${interface} + fi + done + + ifconfig ${interface} down + + ifconfig ${interface} destroy + done +} + +wireguard_reload() +{ + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg syncconf ${interface} %%PREFIX%%/etc/wireguard/${interface}.conf + done +} + +run_rc_command "$1" Added: head/net/wireguard-tools/files/wireguard_wgquick.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/wireguard-tools/files/wireguard_wgquick.in Mon Mar 22 12:07:45 2021 (r568953) @@ -0,0 +1,62 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: wireguard +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# wireguard_enable (bool): Set to "YES" to enable wireguard. +# (default: "NO") +# +# wireguard_interfaces (str): List of interfaces to bring up/down +# on start/stop. (eg: "wg0 wg1") +# (default: "") +# wireguard_env (str): Environment variables for the userspace +# implementation. (eg: "LOG_LEVEL=debug") + +. /etc/rc.subr + +name=wireguard +rcvar=wireguard_enable +extra_commands="reload" + +start_cmd="${name}_start" +stop_cmd="${name}_stop" +reload_cmd="${name}_reload" + +wireguard_start() +{ + ${wireguard_env:+eval export $wireguard_env} + + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg-quick up ${interface} + done +} + +wireguard_stop() +{ + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg-quick down ${interface} + done +} + +wireguard_reload() +{ + ${wireguard_env:+eval export $wireguard_env} + + for interface in ${wireguard_interfaces}; do + tmpfile="`mktemp`" + %%PREFIX%%/bin/wg-quick strip ${interface} > ${tmpfile} + %%PREFIX%%/bin/wg syncconf ${interface} ${tmpfile} + rm -f ${tmpfile} + done +} + +load_rc_config $name + +: ${wireguard_enable="NO"} +: ${wireguard_interfaces=""} +: ${wireguard_env=""} + +run_rc_command "$1" Modified: head/net/wireguard-tools/pkg-descr ============================================================================== --- head/net/wireguard/pkg-descr Mon Mar 22 12:03:11 2021 (r568952) +++ head/net/wireguard-tools/pkg-descr Mon Mar 22 12:07:45 2021 (r568953) @@ -1,8 +1,4 @@ -WireGuard is an extremely simple yet fast and modern VPN that utilizes -state-of-the-art cryptography. It aims to be faster, simpler, leaner, -and more useful than IPSec, while avoiding the massive headache. It -intends to be considerably more performant than OpenVPN. WireGuard is -designed as a general purpose VPN for running on embedded interfaces and -super computers alike, fit for many different circumstances. +This supplies the main userspace tooling for using and configuring +WireGuard tunnels, including the wg(8) and wg-quick(8) utilities. -WWW: https://www.wireguard.com +WWW: https://git.zx2c4.com/wireguard-tools/about/ Modified: head/net/wireguard-tools/pkg-plist ============================================================================== --- head/net/wireguard/pkg-plist Mon Mar 22 12:03:11 2021 (r568952) +++ head/net/wireguard-tools/pkg-plist Mon Mar 22 12:07:45 2021 (r568953) @@ -3,5 +3,5 @@ bin/wg %%WGQUICK%%man/man8/wg-quick.8.gz man/man8/wg.8.gz share/bash-completion/completions/wg -share/bash-completion/completions/wg-quick +%%WGQUICK%%share/bash-completion/completions/wg-quick %%WGQUICK%%@dir etc/wireguard