From 3a5eb1f43ab40b693d8b67682733f4a39475566a Mon Sep 17 00:00:00 2001 From: Yuri Victorovich Date: Sat, 3 Aug 2019 23:38:03 +0000 Subject: [PATCH] New port: net/yggdrasil: Experimental end-to-end encrypted self-arranging IPv6 network PR: 236607 Submitted by: Neil Alexander --- net/Makefile | 1 + net/yggdrasil/Makefile | 50 ++++++++++++++++++++ net/yggdrasil/distinfo | 27 +++++++++++ net/yggdrasil/files/yggdrasil.in | 78 ++++++++++++++++++++++++++++++++ net/yggdrasil/pkg-descr | 7 +++ 5 files changed, 163 insertions(+) create mode 100644 net/yggdrasil/Makefile create mode 100644 net/yggdrasil/distinfo create mode 100644 net/yggdrasil/files/yggdrasil.in create mode 100644 net/yggdrasil/pkg-descr diff --git a/net/Makefile b/net/Makefile index b3dcdccd0ff8..331e70ad5531 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1535,6 +1535,7 @@ SUBDIR += yaz++ SUBDIR += yazproxy SUBDIR += yconalyzer + SUBDIR += yggdrasil SUBDIR += yptransitd SUBDIR += zebra SUBDIR += zebra-server diff --git a/net/yggdrasil/Makefile b/net/yggdrasil/Makefile new file mode 100644 index 000000000000..8bee64c005ed --- /dev/null +++ b/net/yggdrasil/Makefile @@ -0,0 +1,50 @@ +# $FreeBSD$ + +PORTNAME= yggdrasil +DISTVERSIONPREFIX= v +DISTVERSION= 0.3.6 +CATEGORIES= net ipv6 + +MAINTAINER= freebsd@neilalexander.dev +COMMENT= Experimental end-to-end encrypted self-arranging IPv6 network + +LICENSE= LGPL3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go +USE_GITHUB= yes +GH_ACCOUNT= yggdrasil-network +GH_PROJECT= yggdrasil-go +GH_TUPLE= \ + docker:libcontainer:v2.2.1:docker_libcontainer/vendor/github.com/docker/libcontainer \ + golang:crypto:4def268fd1a4:golang_crypto/vendor/golang.org/x/crypto \ + golang:net:ca1201d0de80:golang_net/vendor/golang.org/x/net \ + golang:sys:cbf593c0f2f3:golang_sys/vendor/golang.org/x/sys \ + golang:text:v0.3.2:golang_text/vendor/golang.org/x/text \ + gologme:log:4e5d8ccb38e8:gologme_log/vendor/github.com/gologme/log \ + hashicorp:go-syslog:v1.0.0:hashicorp_go_syslog/vendor/github.com/hashicorp/go-syslog \ + hjson:hjson-go:a25ecf6bd222:hjson_hjson_go/vendor/github.com/hjson/hjson-go \ + kardianos:minwinsvc:cad6b2b879b0:kardianos_minwinsvc/vendor/github.com/kardianos/minwinsvc \ + mitchellh:mapstructure:v1.1.2:mitchellh_mapstructure/vendor/github.com/mitchellh/mapstructure \ + songgao:packets:549a10cd4091:songgao_packets/vendor/github.com/songgao/packets \ + yggdrasil-network:water:a16161896c34:yggdrasil_network_water/vendor/github.com/yggdrasil-network/water +GH_SUBDIR= src/github.com/${GH_ACCOUNT}/${GH_PROJECT} + +MAKE_ENV+= GOFLAGS=-mod=vendor + +PLIST_FILES= bin/yggdrasil \ + bin/yggdrasilctl + +USE_RC_SUBR= yggdrasil + +pre-build: + @${REINPLACE_CMD} -e 's/set -ef/set -f/' ${WRKSRC}/build + +do-build: + cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} PKGNAME=${PORTNAME} PKGVER=${PORTVERSION} ./build + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/yggdrasil ${STAGEDIR}${PREFIX}/bin/yggdrasil + ${INSTALL_PROGRAM} ${WRKSRC}/yggdrasilctl ${STAGEDIR}${PREFIX}/bin/yggdrasilctl + +.include diff --git a/net/yggdrasil/distinfo b/net/yggdrasil/distinfo new file mode 100644 index 000000000000..183c9cc106d6 --- /dev/null +++ b/net/yggdrasil/distinfo @@ -0,0 +1,27 @@ +TIMESTAMP = 1564875025 +SHA256 (yggdrasil-network-yggdrasil-go-v0.3.6_GH0.tar.gz) = dc1699064319f19a64ac57bac366a15d718008fdb75ef03bf4252d3552dff4eb +SIZE (yggdrasil-network-yggdrasil-go-v0.3.6_GH0.tar.gz) = 152007 +SHA256 (docker-libcontainer-v2.2.1_GH0.tar.gz) = 3dc621731db53591d643611e2d7bb2efc942a6208e5178c335caecf9dc5f8826 +SIZE (docker-libcontainer-v2.2.1_GH0.tar.gz) = 348704 +SHA256 (golang-crypto-4def268fd1a4_GH0.tar.gz) = eaf2ba9df95911f41a340478d1fbb540d7bc21939e4688273995dabf58e8c7b0 +SIZE (golang-crypto-4def268fd1a4_GH0.tar.gz) = 1693117 +SHA256 (golang-net-ca1201d0de80_GH0.tar.gz) = 1d0b1f44b64c6248ce65f4d78add4228f15ffbdbe4a559a6d1effa410ce01071 +SIZE (golang-net-ca1201d0de80_GH0.tar.gz) = 1099216 +SHA256 (golang-sys-cbf593c0f2f3_GH0.tar.gz) = 3590c55ef807ee27909fecdd771996ab55ad5306f5174b877810a9a9915f0a18 +SIZE (golang-sys-cbf593c0f2f3_GH0.tar.gz) = 1454976 +SHA256 (golang-text-v0.3.2_GH0.tar.gz) = 0b9309698f5708531c5377ab1e29b423a6d9e20c55a8d386c3b8283428212f22 +SIZE (golang-text-v0.3.2_GH0.tar.gz) = 7168069 +SHA256 (gologme-log-4e5d8ccb38e8_GH0.tar.gz) = d5873e95bd5459d9a4813e7020236f15db01277ffba0abfc9f80c5bac7477157 +SIZE (gologme-log-4e5d8ccb38e8_GH0.tar.gz) = 5613 +SHA256 (hashicorp-go-syslog-v1.0.0_GH0.tar.gz) = be4bda814c068311ea8e185e2d108077f167897cfa868ada7f56d97a10f3d602 +SIZE (hashicorp-go-syslog-v1.0.0_GH0.tar.gz) = 4517 +SHA256 (hjson-hjson-go-a25ecf6bd222_GH0.tar.gz) = b41a4011abae684a1a1d3f8650a7db4948cc55373145b62845c7957add9c483f +SIZE (hjson-hjson-go-a25ecf6bd222_GH0.tar.gz) = 25569 +SHA256 (kardianos-minwinsvc-cad6b2b879b0_GH0.tar.gz) = 820c068dfee3306853cb6cc63becb96b9f972a14a97ad71df3332f98bc4866cb +SIZE (kardianos-minwinsvc-cad6b2b879b0_GH0.tar.gz) = 1804 +SHA256 (mitchellh-mapstructure-v1.1.2_GH0.tar.gz) = 53fbc06b125ff1c9c73a4eb1764346932671a29c67a45a92e2ebc6855635069b +SIZE (mitchellh-mapstructure-v1.1.2_GH0.tar.gz) = 20980 +SHA256 (songgao-packets-549a10cd4091_GH0.tar.gz) = 15993683d3ab9d61baf14efe270c0ba06fe62a0b48621420e1d1da6bb24c85ac +SIZE (songgao-packets-549a10cd4091_GH0.tar.gz) = 3517 +SHA256 (yggdrasil-network-water-a16161896c34_GH0.tar.gz) = dd00d472628013d35d9997e6bf9ea63ef9e6bd2e5dd2313404dee0c27f66edf7 +SIZE (yggdrasil-network-water-a16161896c34_GH0.tar.gz) = 17475 diff --git a/net/yggdrasil/files/yggdrasil.in b/net/yggdrasil/files/yggdrasil.in new file mode 100644 index 000000000000..d8d22d25bcbb --- /dev/null +++ b/net/yggdrasil/files/yggdrasil.in @@ -0,0 +1,78 @@ +#!/bin/sh +# +# PROVIDE: yggdrasil +# REQUIRE: networking +# KEYWORD: shutdown + +. /etc/rc.subr + +name="yggdrasil" +rcvar="yggdrasil_enable" + +start_cmd="${name}_start" +start_precmd="${name}_prestart" +stop_cmd="${name}_stop" +stop_postcmd="${name}_poststop" + +pidfile="/var/run/yggdrasil/${name}.pid" +command="/usr/sbin/daemon" +command_args="-P ${pidfile} -r -f ${yggdrasil_command}" + +yggdrasil_prestart() +{ + test ! -x %%PREFIX%%/bin/yggdrasil && ( + logger -s -t yggdrasil "Warning: %%PREFIX%%/bin/yggdrasil is missing or not executable" + logger -s -t yggdrasil "Copy the yggdrasil binary into %%PREFIX%%/bin and then chmod +x %%PREFIX%%/bin/yggdrasil" + return 1 + ) + + test ! -f %%PREFIX%%/etc/yggdrasil.conf && ( + logger -s -t yggdrasil "Generating new configuration file into %%PREFIX%%/etc/yggdrasil.conf" + %%PREFIX%%/bin/yggdrasil -genconf > %%PREFIX%%/etc/yggdrasil.conf + ) + + tap_path="$(cat %%PREFIX%%/etc/yggdrasil.conf | egrep -o '/dev/tap[0-9]{1,2}$')" + tap_name="$(echo -n ${tap_path} | tr -d '/dev/')" + + /sbin/ifconfig ${tap_name} >/dev/null 2>&1 || ( + logger -s -t yggdrasil "Creating ${tap_name} adapter" + /sbin/ifconfig ${tap_name} create || logger -s -t yggdrasil "Failed to create ${tap_name} adapter" + ) + + mkdir -p /var/run/yggdrasil +} + +yggdrasil_start() +{ + /sbin/ifconfig ${tap_name} >/dev/null 2>&1 || ( + logger -s -t yggdrasil "Creating ${tap_name} adapter" + /sbin/ifconfig ${tap_name} create || logger -s -t yggdrasil "Failed to create ${tap_name} adapter" + ) + + logger -s -t yggdrasil "Starting yggdrasil" + ${command} ${command_args} %%PREFIX%%/bin/yggdrasil -useconffile %%PREFIX%%/etc/yggdrasil.conf \ + 1>/var/log/yggdrasil.stdout.log \ + 2>/var/log/yggdrasil.stderr.log & +} + +yggdrasil_stop() +{ + logger -s -t yggdrasil "Stopping yggdrasil" + test -f /var/run/yggdrasil/${name}.pid && kill -TERM $(cat /var/run/yggdrasil/${name}.pid) +} + +yggdrasil_poststop() +{ + tap_path="$(cat %%PREFIX%%/etc/yggdrasil.conf | grep /dev/tap | egrep -o '/dev/.*$')" + tap_name="$(echo -n ${tap_path} | tr -d '/dev/')" + + /sbin/ifconfig ${tap_name} >/dev/null 2>&1 && ( + logger -s -t yggdrasil "Destroying ${tap_name} adapter" + /sbin/ifconfig ${tap_name} destroy || logger -s -t yggdrasil "Failed to destroy ${tap_name} adapter" + ) +} + +load_rc_config $name +: ${yggdrasil_enable:=no} + +run_rc_command "$1" diff --git a/net/yggdrasil/pkg-descr b/net/yggdrasil/pkg-descr new file mode 100644 index 000000000000..238fb60a3574 --- /dev/null +++ b/net/yggdrasil/pkg-descr @@ -0,0 +1,7 @@ +Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6 +network. It is lightweight, self-arranging, supported on multiple platforms and +allows pretty much any IPv6-capable application to communicate securely with +other Yggdrasil nodes. Yggdrasil does not require you to have IPv6 Internet +connectivity - it also works over IPv4. + +WWW: https://yggdrasil-network.github.io/