git: 1b5aeff9c4d5 - main - www/adguardhome: update 0.107.73 → 0.107.74

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Fri, 17 Apr 2026 06:50:41 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1b5aeff9c4d506825b5023099f6ad4bbc256f391

commit 1b5aeff9c4d506825b5023099f6ad4bbc256f391
Author:     Jordan Ostreff <jordan@ostreff.info>
AuthorDate: 2026-04-17 05:13:24 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-04-17 06:50:34 +0000

    www/adguardhome: update 0.107.73 → 0.107.74
    
    PR:     294574
---
 www/adguardhome/Makefile             |   8 +--
 www/adguardhome/distinfo             |  14 ++---
 www/adguardhome/files/adguardhome.in | 100 +++++++++++++++++++++++------------
 www/adguardhome/files/patch-go.mod   |   6 +--
 www/adguardhome/pkg-message          |  40 +++++++++++++-
 5 files changed, 119 insertions(+), 49 deletions(-)

diff --git a/www/adguardhome/Makefile b/www/adguardhome/Makefile
index d839092ff957..95c35cce6919 100644
--- a/www/adguardhome/Makefile
+++ b/www/adguardhome/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	adguardhome
 DISTVERSIONPREFIX=	v
-DISTVERSION=	0.107.73
+DISTVERSION=	0.107.74
 CATEGORIES=	www
 MASTER_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/${DISTVERSIONFULL}/
 DISTFILES=	${GH_PROJECT}_frontend${EXTRACT_SUFX}
@@ -15,7 +15,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
 RUN_DEPENDS=	ca_root_nss>=0:security/ca_root_nss
 
-USES=		cpe go:1.25+,modules
+USES=		cpe go:1.26+,modules
 
 GH_ACCOUNT=	AdguardTeam
 GH_PROJECT=	AdGuardHome
@@ -23,8 +23,8 @@ GH_PROJECT=	AdGuardHome
 GO_MODULE=	github.com/AdguardTeam/AdGuardHome
 GO_BUILDFLAGS=	-ldflags="-s -w -X github.com/${GH_ACCOUNT}/${GH_PROJECT}/internal/version.version=${DISTVERSION}" # workaround for https://github.com/AdguardTeam/AdGuardHome/issues/4774
 
-USER=		root # it has to run as root because it listens on the privileged DNS port
-GROUP=		wheel
+USER=		unbound # it has to run as root because it listens on the privileged DNS port
+GROUP=		unbound
 SUB_LIST=	USER=${USER} GROUP=${GROUP}
 USE_RC_SUBR=	${PORTNAME}
 PLIST_SUB=	PORTNAME=${PORTNAME}
diff --git a/www/adguardhome/distinfo b/www/adguardhome/distinfo
index ad337dcefe45..33941ec01ac9 100644
--- a/www/adguardhome/distinfo
+++ b/www/adguardhome/distinfo
@@ -1,7 +1,7 @@
-TIMESTAMP = 1775934382
-SHA256 (go/www_adguardhome/adguardhome-v0.107.73/AdGuardHome_frontend.tar.gz) = a69c540fe6959575330bdea150e31eee0c0c204985bf50e3522ce6d292e3c64e
-SIZE (go/www_adguardhome/adguardhome-v0.107.73/AdGuardHome_frontend.tar.gz) = 2590478
-SHA256 (go/www_adguardhome/adguardhome-v0.107.73/v0.107.73.mod) = a93650adeb515d06285b298beaddedd9b59c1ad8815f2ef038f53e4994f12997
-SIZE (go/www_adguardhome/adguardhome-v0.107.73/v0.107.73.mod) = 5806
-SHA256 (go/www_adguardhome/adguardhome-v0.107.73/v0.107.73.zip) = 72fe820f3c955385521af43a75043435afab6cca28148d21535f558a8bfda00b
-SIZE (go/www_adguardhome/adguardhome-v0.107.73/v0.107.73.zip) = 2880595
+TIMESTAMP = 1776361032
+SHA256 (go/www_adguardhome/adguardhome-v0.107.74/AdGuardHome_frontend.tar.gz) = bca5a8a4d777f984d9a6992214dc158cb35c12e6fd6fd61a30f677896aaa1758
+SIZE (go/www_adguardhome/adguardhome-v0.107.74/AdGuardHome_frontend.tar.gz) = 2606434
+SHA256 (go/www_adguardhome/adguardhome-v0.107.74/v0.107.74.mod) = cafef9ebec35b770d063250a011f1d2ae1640fe1baa4c7858b2be8d86fb902f0
+SIZE (go/www_adguardhome/adguardhome-v0.107.74/v0.107.74.mod) = 5765
+SHA256 (go/www_adguardhome/adguardhome-v0.107.74/v0.107.74.zip) = 814526e7bd93e92f51f6d5c307a25756110098cd9c1fbddfe8f975c30fe05760
+SIZE (go/www_adguardhome/adguardhome-v0.107.74/v0.107.74.zip) = 2871276
diff --git a/www/adguardhome/files/adguardhome.in b/www/adguardhome/files/adguardhome.in
index 16035b8c1ff4..eeddbee95693 100644
--- a/www/adguardhome/files/adguardhome.in
+++ b/www/adguardhome/files/adguardhome.in
@@ -1,12 +1,10 @@
+# cat /usr/local/etc/rc.d/adguardhome
 #!/bin/sh
 
 # PROVIDE: adguardhome
 # REQUIRE: DAEMON NETWORKING
 # KEYWORD: shutdown
 
-# Add the following lines to /etc/rc.conf to enable adguardhome:
-# adguardhome_enable : set to "YES" to enable the daemon, default is "NO"
-
 . /etc/rc.subr
 
 name="adguardhome"
@@ -14,59 +12,95 @@ rcvar="${name}_enable"
 
 load_rc_config "$name"
 
+# ----  Default values  ----------------------------------------
 : "${adguardhome_enable:=NO}"
-: "${adguardhome_config:=%%PREFIX%%/etc/AdGuardHome.yaml}"
-: "${adguardhome_user:=%%USER%%}"
-: "${adguardhome_group:=%%GROUP%%}"
+: "${adguardhome_config:=/usr/local/etc/adguardhome/AdGuardHome.yaml}"
+: "${adguardhome_user:=unbound}"      # NOT root! User must exist
+: "${adguardhome_group:=unbound}"
 : "${adguardhome_work_dir:=/var/db/adguardhome}"
 : "${adguardhome_svcj_options:=net_basic}"
-: "${adguardhome_extra:=}"
+: "${adguardhome_extra:=}"                # extra options can be added here
 
-# old values
-: "${adguardhome_config_old:=%%PREFIX%%/bin/AdGuardHome.yaml}"
-: "${adguardhome_work_dir_old:=%%PREFIX%%/bin}"
+# ----  Old location (migration)  ------------------------------
+: "${adguardhome_config_old:=/usr/local/bin/AdGuardHome.yaml}"
+: "${adguardhome_work_dir_old:=/usr/local/bin}"
 
+# ----  Paths for logs and pid files  --------------------------
 logfile="/var/log/${name}.log"
 pidfile="/var/run/${name}.pid"
 
+# ----  The command (without -u – rc.subr will add it)  --------
 command="/usr/sbin/daemon"
-command_args="-H -o $logfile -t $name -P $pidfile %%PREFIX%%/bin/adguardhome -c $adguardhome_config -w $adguardhome_work_dir $adguardhome_extra"
+command_args="-o ${logfile} -t ${name} -P ${pidfile} \
+    /usr/local/bin/adguardhome -c ${adguardhome_config} -w ${adguardhome_work_dir} ${adguardhome_extra}"
+
+# If we want to set HOME for the process (useful for some versions)
+# Since the user's home directory is /var/db/adguardhome,
+# we set it explicitly – this way `daemon` can create the
+# environment even if the rc-scripts clear the environment.
+adguardhome_env="HOME=${adguardhome_work_dir} IS_DAEMON=1"
 
+# --------------------------------------------------------------
+#  PRE-START – creates necessary directories and sets permissions
+# --------------------------------------------------------------
 start_precmd="${name}_prestart"
 extra_commands="reload"
 
 adguardhome_prestart()
 {
-    # check if the old config exists
-    if [ -f "$adguardhome_config_old" ] || [ -d "${adguardhome_work_dir_old}/data" ]; then
-        if ! [ -f "$adguardhome_config" ] && ! [ -d "${adguardhome_work_dir}/data" ]; then
-            # old config exists, new config doesn't exist
-            # move old config to new locations
-            if [ -f "$adguardhome_config_old" ]; then
-                echo "moving old config $adguardhome_config_old to the new location $adguardhome_config"
-                mv "$adguardhome_config_old" "$adguardhome_config"
+    local _config_dir _file _dir
+    _config_dir=$(dirname "${adguardhome_config}")
+
+    # 1) Config directory (create if missing)
+    if [ ! -d "${_config_dir}" ]; then
+        echo "Creating configuration directory: ${_config_dir}"
+        install -d -m 0750 -o "${adguardhome_user}" -g "${adguardhome_group}" "${_config_dir}"
+    fi
+
+    # 2) If config file already exists – fix ownership
+    if [ -f "${adguardhome_config}" ]; then
+        chown "${adguardhome_user}:${adguardhome_group}" "${adguardhome_config}"
+    fi
+
+    # 3) If old configuration exists – migrate it
+    if [ -f "${adguardhome_config_old}" ] || [ -d "${adguardhome_work_dir_old}/data" ]; then
+        if [ ! -f "${adguardhome_config}" ] && [ ! -d "${adguardhome_work_dir}/data" ]; then
+            # 3.1) Move the old yaml
+            if [ -f "${adguardhome_config_old}" ]; then
+                echo "Moving old config ${adguardhome_config_old} → ${adguardhome_config}"
+                mv "${adguardhome_config_old}" "${adguardhome_config}"
             fi
+            # 3.2) Move the data
             if [ -d "${adguardhome_work_dir_old}/data" ]; then
-                install -d -m 0750 -o "$adguardhome_user" \
-                        -g "$adguardhome_group" "$adguardhome_work_dir"
-                echo "moving old config ${adguardhome_work_dir_old}/data to the new location ${adguardhome_work_dir}/data"
+                [ ! -d "${adguardhome_work_dir}" ] && install -d -m 0750 -o "${adguardhome_user}" -g "${adguardhome_group}" "${adguardhome_work_dir}"
+                echo "Moving old data ${adguardhome_work_dir_old}/data → ${adguardhome_work_dir}/data"
                 mv "${adguardhome_work_dir_old}/data" "${adguardhome_work_dir}/data"
             fi
-        else # both old and new config exist
-            echo "(!!!) WARNING =================================================================="
-            echo "(!!!) WARNING Both old and new configs exist"
-            echo "(!!!) WARNING Please choose which configs do you need and remove the old configs"
-            echo "(!!!) WARNING OLD config locations: $adguardhome_config_old ${adguardhome_work_dir_old}/data"
-            echo "(!!!) WARNING NEW config locations: $adguardhome_config ${adguardhome_work_dir}/data"
-            echo "(!!!) WARNING =================================================================="
+        else
+            # Both exist – issue a warning
+            echo "(!!!) WARNING – both old and new configs exist!"
+            echo "(!!!)   OLD : ${adguardhome_config_old} ${adguardhome_work_dir_old}/data"
+            echo "(!!!)   NEW : ${adguardhome_config} ${adguardhome_work_dir}/data"
         fi
     fi
 
-    # install dir
-    if [ ! -d "$adguardhome_work_dir" ]; then
-        install -d -m 0750 -o "$adguardhome_user" -g "$adguardhome_group" \
-                "$adguardhome_work_dir"
+    # 4) Create/verify working directory
+    if [ ! -d "${adguardhome_work_dir}" ]; then
+        install -d -m 0750 -o "${adguardhome_user}" -g "${adguardhome_group}" "${adguardhome_work_dir}"
     fi
+
+    # 5) Prepare log/pid files
+    for _file in "${logfile}" "${pidfile}"; do
+        [ -z "${_file}" ] && continue
+        _dir=$(dirname "${_file}")
+        # Създаваме директорията само ако не е стандартна системна такава
+        if [ ! -d "${_dir}" ]; then
+            install -d -m 0755 -o root -g wheel "${_dir}"
+        fi
+        touch "${_file}"
+        chown "${adguardhome_user}:${adguardhome_group}" "${_file}"
+    done
 }
 
+# --------------------------------------------------------------
 run_rc_command "$1"
diff --git a/www/adguardhome/files/patch-go.mod b/www/adguardhome/files/patch-go.mod
index 958271cbfe5f..2b9ae82586c8 100644
--- a/www/adguardhome/files/patch-go.mod
+++ b/www/adguardhome/files/patch-go.mod
@@ -3,8 +3,8 @@
 @@ -1,6 +1,6 @@ module github.com/AdguardTeam/AdGuardHome
  module github.com/AdguardTeam/AdGuardHome
  
--go 1.25.7
-+go 1.25
+-go 1.26.2
++go 1.26
  
  require (
- 	github.com/AdguardTeam/dnsproxy v0.78.2
+ 	github.com/AdguardTeam/dnsproxy v0.81.
diff --git a/www/adguardhome/pkg-message b/www/adguardhome/pkg-message
index a84109fb2755..829a89c81edf 100644
--- a/www/adguardhome/pkg-message
+++ b/www/adguardhome/pkg-message
@@ -3,9 +3,45 @@
   message: <<EOM
 You installed AdGuardHome: Network-wide ads & trackers blocking DNS server.
 
-In order to use it please start the service 'adguardhome' and
-then access the URL http://0.0.0.0:3000/ in your favorite browser.
+AdGuardHome is configured to run as the 'unbound' user. By default, 
+non-root users cannot bind to privileged ports like 53 (DNS). 
+To allow AdGuardHome to function, choose one of the following options:
 
+OPTION A: Using the 'portacl' service (Recommended for simplicity)
+1. Install the portacl package:
+   # pkg install portacl
+
+2. Add these lines to /etc/rc.conf:
+   portacl_enable="YES"
+   portacl_users="unbound"
+   portacl_user_unbound_tcp="domain 853"
+   portacl_user_unbound_udp="domain"
+
+3. Start the service to apply rules immediately:
+   # service portacl start
+
+---
+
+OPTION B: Manual Configuration (Base system only)
+1. Load the required kernel module:
+   # kldload mac_portacl
+
+2. Apply the following sysctl rules (replace 59 with 'id -u unbound' if different):
+   # sysctl net.inet.ip.portrange.reservedhigh=0
+   # sysctl security.mac.portacl.port_high=1024
+   # sysctl security.mac.portacl.rules=uid:59:tcp:53,uid:59:udp:53,uid:59:tcp:853
+
+3. To make this persistent, add mac_portacl_load="YES" to /boot/loader.conf 
+   and the sysctl rules to /etc/sysctl.conf.
+
+---
+
+FINAL STEPS:
+Enable and start AdGuardHome:
+   # sysrc adguardhome_enable="YES"
+   # service adguardhome start
+
+Then complete the setup via the web interface at http://localhost:3000/
 EOM
 }
 ]