From nobody Mon Jul 18 14:45:51 2022 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LmlBl3564z4TM5j; Mon, 18 Jul 2022 14:45:51 +0000 (UTC) (envelope-from git@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 4LmlBl2bT2z49CV; Mon, 18 Jul 2022 14:45:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658155551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4NPBaYwBCTzZ2w5XmfFsJnulU9kEewePwr84ds8JAVE=; b=yGQxP+W18W7qI3TgsEhehY+6Xilmecpq/TFVQ6JIjFZuH0d0qfQ5SDn3gwkhR0Hlb+plxj Bw/lhYAykvBAgOrJRKRp22btA/iK+5S095uhLm7S4VXv09irBYTiaLf4G1YYQTubRfNfdW FiRY5R8ysH9vrXWzRa8Fu1cAtpx/i9x1hUiHq2/4gftlj/k4MfOqv/TUmJ1iAOJkS3Roud P4vF15LAX+0O+8DTW+uot/DH8w8wLyqv6RJCogsxZg/gL2m7R+lm7tZPvt9hblSs4UCWAs luerrmwdrLAryU3ZgCU1rAX6W7NLiZ8Rzf6r4JNVo+kmBZE7Oc9A5YjgomGcmw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LmlBl1Rhwzjsr; Mon, 18 Jul 2022 14:45:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26IEjpU7045363; Mon, 18 Jul 2022 14:45:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26IEjp9n045361; Mon, 18 Jul 2022 14:45:51 GMT (envelope-from git) Date: Mon, 18 Jul 2022 14:45:51 GMT Message-Id: <202207181445.26IEjp9n045361@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Ben Woods Subject: git: 46a10c978683 - main - security/headscale: add rc script and minimal working config List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: woodsb02 X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46a10c9786832983ef9b6afeebc030f8f4879bf2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658155551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4NPBaYwBCTzZ2w5XmfFsJnulU9kEewePwr84ds8JAVE=; b=nlTLh+z4zTT+2C8FLiJgQTjvWjotrvvIgdTeUTlNV8rKBwLNAvmbwv2y5eNftP5UqIwg9Q /V+1FoZ40tVhVEkoPPHQ167Eum2CC3tDFm24dX585RSz62iSyAPYerY3AC5RkDd7/IT68C H8yBh4XAZjm8joyUIAr3pnXrEElAaiyDj/RDrrvYtiIJ1R7WWJG2A3TuHdeba1lwSXgONV fHvs5yFcqW48BaixE7Y9fu5Bm80+fmVfYOn/su7f2QR7GFzcONpTQXwnRsX+nAhISQnpiL HuVCWd+gvmZpMtVLqDtT7OYZ7pulKOeLPmAjs6DZ1tKvQBWJQZw2gbLzRmnXGw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658155551; a=rsa-sha256; cv=none; b=CcY9ENACdtbODfOVZ2096aPIzx5jnsifKSm4RErFRDurnQ0X8SQGAX2vgmFHeEZRqa74hR PSMqhwnH+5amghizrTmhkFoWO3u/tbZg3x5j8uAELSPvjExCjqLyAKT5hh1PtvG+qcNxpB ZTAd90JjMu5Lh7RRu2wFWNzOmHjQc97ZSOVLMbnm5gCQCFYoSO++48P4MiS1HHazpxqYMC 9590pXlBuWdPORbikWIL+N5PAKGRw/MglVwMFP/vB/Q3/GxojB6ofbfjD/A8TuNj2OjYYk hHsh/2syJCv2HpKxiT0fuCGVisA0lu6H8ZsBNsQQZbUKwdSHzANTtVjWpP6z9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by woodsb02: URL: https://cgit.FreeBSD.org/ports/commit/?id=46a10c9786832983ef9b6afeebc030f8f4879bf2 commit 46a10c9786832983ef9b6afeebc030f8f4879bf2 Author: Christian McDonald AuthorDate: 2022-06-17 20:41:33 +0000 Commit: Ben Woods CommitDate: 2022-07-18 14:43:39 +0000 security/headscale: add rc script and minimal working config - Include rc script to enable/disable headscale service - Follow heir(7) with regards to headscale db, cache, config locations - Include a minimal configuration out of the box PR: 264744 Approved by: Michael Muenz --- security/headscale/Makefile | 24 ++++++++++++++++++-- security/headscale/files/headscale.in | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/security/headscale/Makefile b/security/headscale/Makefile index db5148827dcd..a479bc62e156 100644 --- a/security/headscale/Makefile +++ b/security/headscale/Makefile @@ -1,7 +1,7 @@ PORTNAME= headscale PORTVERSION= 0.15.0 DISTVERSIONPREFIX= v -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= security MAINTAINER= m.muenz@gmail.com @@ -17,11 +17,31 @@ BROKEN_armv7= fails to compile: modernc.org/libc RUN_DEPENDS= ca_root_nss>0:security/ca_root_nss USES= go:modules +USE_RC_SUBR= headscale GO_MODULE= github.com/juanfont/headscale GO_TARGET= ./cmd/headscale -PLIST_FILES= bin/headscale +PLIST_FILES= ${ETCDIR}/config.yaml \ + "@dir /var/cache/${PORTNAME}" \ + "@dir /var/db/${PORTNAME}" \ + bin/${PORTNAME} + +post-patch: + @${REINPLACE_CMD} -e 's|/etc/headscale|${PREFIX}/etc/${PORTNAME}|g' \ + ${WRKSRC}/cmd/headscale/cli/utils.go + @${REINPLACE_CMD} -e 's|/var/lib/headscale/db.sqlite|/var/db/${PORTNAME}/db.sqlite|g' \ + ${WRKSRC}/config-example.yaml + @${REINPLACE_CMD} -e 's|/var/lib/headscale/cache|/var/cache/${PORTNAME}|g' \ + ${WRKSRC}/config-example.yaml + @${REINPLACE_CMD} -e 's|/var/lib/headscale/private.key|${PREFIX}/etc/${PORTNAME}/private.key|g' \ + ${WRKSRC}/config-example.yaml + +post-install: + ${MKDIR} ${STAGEDIR}${PREFIX}/etc/${PORTNAME} + ${INSTALL_DATA} ${WRKSRC}/config-example.yaml ${STAGEDIR}${PREFIX}/etc/${PORTNAME}/config.yaml + ${MKDIR} ${STAGEDIR}/var/db/${PORTNAME} + ${MKDIR} ${STAGEDIR}/var/cache/${PORTNAME} .include diff --git a/security/headscale/files/headscale.in b/security/headscale/files/headscale.in new file mode 100644 index 000000000000..a3f4ada0b6f4 --- /dev/null +++ b/security/headscale/files/headscale.in @@ -0,0 +1,41 @@ +#!/bin/sh + +# PROVIDE: headscale +# REQUIRE: NETWORKING +# KEYWORD: shutdown +# + +. /etc/rc.subr + +name=headscale +rcvar=headscale_enable + +load_rc_config $name + +: ${headscale_enable:="NO"} +: ${headscale_syslog_output_enable:="NO"} +: ${headscale_syslog_output_priority:="info"} +: ${headscale_syslog_output_facility:="daemon"} + +if checkyesno headscale_syslog_output_enable; then + headscale_syslog_output_flags="-t ${name} -T ${name}" + + if [ -n "${headscale_syslog_output_priority}" ]; then + headscale_syslog_output_flags="${headscale_syslog_output_flags} -s ${headscale_syslog_output_priority}" + fi + + if [ -n "${headscale_syslog_output_facility}" ]; then + headscale_syslog_output_flags="${headscale_syslog_output_flags} -l ${headscale_syslog_output_facility}" + fi +fi + +pidfile=/var/run/${name}.pid +procname="%%PREFIX%%/bin/${name}" + +start_cmd="${name}_start" + +headscale_start() { + /usr/sbin/daemon -f ${headscale_syslog_output_flags} -p ${pidfile} ${procname} serve +} + +run_rc_command "$1"