From d4cb88a62f8e4a0997ee17be4773a15af870ff8a Mon Sep 17 00:00:00 2001 From: jca Date: Fri, 9 Mar 2018 12:37:12 +0000 Subject: [PATCH] Add an openvpn rc script This script doesn't set any default flag, usage is documented in README as suggested by sthen@ and ajacoutot@. ok remi@ danj@ sthen@ ajacoutot@ --- net/openvpn/Makefile | 4 ++-- net/openvpn/pkg/PLIST | 3 ++- net/openvpn/pkg/README | 10 +++++++++- net/openvpn/pkg/openvpn.rc | 9 +++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 net/openvpn/pkg/openvpn.rc diff --git a/net/openvpn/Makefile b/net/openvpn/Makefile index 306bd483c8d..22599b61ae1 100644 --- a/net/openvpn/Makefile +++ b/net/openvpn/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.88 2018/03/06 12:44:29 jca Exp $ +# $OpenBSD: Makefile,v 1.89 2018/03/09 12:37:12 jca Exp $ COMMENT= easy-to-use, robust, and highly configurable VPN DISTNAME= openvpn-2.4.5 -REVISION= 0 +REVISION= 1 CATEGORIES= net security HOMEPAGE= https://openvpn.net/index.php/open-source/ diff --git a/net/openvpn/pkg/PLIST b/net/openvpn/pkg/PLIST index 4947d06c140..01272a3c0b6 100644 --- a/net/openvpn/pkg/PLIST +++ b/net/openvpn/pkg/PLIST @@ -1,4 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.22 2017/09/29 16:36:23 jca Exp $ +@comment $OpenBSD: PLIST,v 1.23 2018/03/09 12:37:12 jca Exp $ @newgroup _openvpn:577 @newuser _openvpn:577:_openvpn:daemon:OpenVPN Daemon:/nonexistent:/sbin/nologin include/openvpn/ @@ -63,3 +63,4 @@ share/examples/openvpn/sample-scripts/bridge-start share/examples/openvpn/sample-scripts/bridge-stop share/examples/openvpn/sample-scripts/ucn.pl share/examples/openvpn/sample-scripts/verify-cn +@rcscript ${RCDIR}/openvpn diff --git a/net/openvpn/pkg/README b/net/openvpn/pkg/README index 622a37060a7..6cb5bf923b5 100644 --- a/net/openvpn/pkg/README +++ b/net/openvpn/pkg/README @@ -1,4 +1,4 @@ -$OpenBSD: README,v 1.4 2018/03/06 12:44:29 jca Exp $ +$OpenBSD: README,v 1.5 2018/03/09 12:37:12 jca Exp $ +----------------------------------------------------------------------- | Running ${FULLPKGNAME} on OpenBSD @@ -13,6 +13,14 @@ layer-2 (bridged) connections should now use the tap(4) interface instead as on other OS. Consult the upgrade guide for 5.9 for more information. +Using the openvpn rc script +--------------------------- + +# rcctl enable openvpn +# rcctl set openvpn flags '--config /etc/openvpn/server.conf' + +To handle multiple openvpn instances see EXAMPLES in rcctl(8). + Using an /etc/hostname.* file without persist-tun ------------------------------------------------- OpenVPN normally re-creates the tun/tap interface at startup. diff --git a/net/openvpn/pkg/openvpn.rc b/net/openvpn/pkg/openvpn.rc new file mode 100644 index 00000000000..319dfa0c313 --- /dev/null +++ b/net/openvpn/pkg/openvpn.rc @@ -0,0 +1,9 @@ +#!/bin/ksh +# +# $OpenBSD: openvpn.rc,v 1.1 2018/03/09 12:37:12 jca Exp $ + +daemon="${TRUEPREFIX}/sbin/openvpn --daemon" + +. /etc/rc.d/rc.subr + +rc_cmd $1