diff --git a/security/glauth/Makefile b/security/glauth/Makefile new file mode 100644 index 0000000..4987b08 --- /dev/null +++ b/security/glauth/Makefile @@ -0,0 +1,33 @@ +PORTNAME= glauth +DISTVERSION= HEAD +PORTREVISION= 0 +CATEGORIES= security +MASTER_SITES= https://raw.githubusercontent.com/${GH_ACCOUNT}/${GH_PROJECT}/${DISTVERSIONFULL}/v2/:gomod +DISTFILES= go.mod:gomod + +MAINTAINER= amigan@gmail.com +COMMENT= Simple LDAP server for developers +WWW= https://github.com/glauth/glauth + +LICENSE= MIT +LICENSE_FILE= ${WRKSRC}/LICENSE + +USES= go:modules +USE_GITHUB= yes +GH_ACCOUNT= glauth +USE_RC_SUBR= glauth + +GO_MODULE= github.com/${GH_ACCOUNT}/${GH_PROJECT} +GO_TARGET= glauth.go:${PREFIX}/sbin/${PORTNAME} + +post-extract: + mv ${WRKSRC}/v2 ${WRKSRC}old/ + mv ${WRKSRC} ${WRKSRC}garbage + mv ${WRKSRC}old ${WRKSRC} + mv ${WRKSRC}garbage/LICENSE ${WRKSRC} + +post-install: + ${INSTALL_DATA} ${WRKSRC}/sample-simple.cfg ${STAGEDIR}${PREFIX}/etc/glauth-config.cfg.sample + +.include + diff --git a/security/glauth/distinfo b/security/glauth/distinfo new file mode 100644 index 0000000..73e38b8 --- /dev/null +++ b/security/glauth/distinfo @@ -0,0 +1,5 @@ +TIMESTAMP = 1700110994 +SHA256 (go/security_glauth/glauth-glauth-HEAD_GH0/go.mod) = d9cbe3c1fc7caee8a1d8a0bc64f912e19bc3102a9ebbde08e736bf6c5bd9ce11 +SIZE (go/security_glauth/glauth-glauth-HEAD_GH0/go.mod) = 1691 +SHA256 (go/security_glauth/glauth-glauth-HEAD_GH0/glauth-glauth-HEAD_GH0.tar.gz) = 4aab6038f460f20602fc176901381c49f60a71b13541209341880d40b7065bf6 +SIZE (go/security_glauth/glauth-glauth-HEAD_GH0/glauth-glauth-HEAD_GH0.tar.gz) = 292889 diff --git a/security/glauth/files/glauth.in b/security/glauth/files/glauth.in new file mode 100644 index 0000000..5882c2e --- /dev/null +++ b/security/glauth/files/glauth.in @@ -0,0 +1,54 @@ +#!/bin/sh + +# PROVIDE: glauth +# REQUIRE: DAEMON NETWORKING +# KEYWORD: shutdown +# +# Add the following to /etc/rc.conf[.local] to enable this service +# +# glauth_enable (bool): Set to NO by default. +# Set it to YES to enable glauth. +# glauth_config (str): Set to /usr/local/etc/glauth-config.yml by default. +# Set it to a path to use that config file. +# glauth_user (str): Services run as root by default. Set to a user name +# to run glauth as that user. Note: non-root users +# might need permission to bind to ports. +# glauth_group (str): Set to the user's primary group by default. +# Set it to a group name for daemon file ownership. +# glauth_flags (str): Enter extra flags to append to the glauth command. + +. /etc/rc.subr + +name=glauth +rcvar=glauth_enable + +load_rc_config ${name} + +: ${glauth_enable:=NO} +: ${glauth_config:="%%PREFIX%%/etc/glauth-config.yml"} +: ${glauth_group:=} +: ${glauth_flags:=} + +if [ -n "${glauth_user}" ] && [ -z "${glauth_group}" ]; then + # Detect the daemon user's primary group + glauth_group=$(id -gn "${glauth_user}") +fi + +pidfile="/var/run/${name}.pid" +glauth_path="%%PREFIX%%/sbin/glauth" + +command="/usr/sbin/daemon" +procname="/usr/local/sbin/glauth" +command_args="-c -f -p ${pidfile} ${glauth_path} \ + -c ${glauth_config} ${glauth_flags}" + +start_precmd="glauth_precmd" + +# Sets up a pidfile the daemon user can access +glauth_precmd() +{ + install -o "${glauth_user:-root}" -g "${glauth_group:-wheel}" \ + -m 0600 /dev/null "${pidfile}" +} + +run_rc_command "$1" diff --git a/security/glauth/pkg-descr b/security/glauth/pkg-descr new file mode 100644 index 0000000..fae38db --- /dev/null +++ b/security/glauth/pkg-descr @@ -0,0 +1,2 @@ +Fast and lightweight DNS proxy as ad-blocker for local +network with many features. diff --git a/security/glauth/pkg-plist b/security/glauth/pkg-plist new file mode 100644 index 0000000..c5346f6 --- /dev/null +++ b/security/glauth/pkg-plist @@ -0,0 +1,3 @@ +@sample etc/glauth-config.cfg.sample +etc/rc.d/glauth +sbin/glauth