Pull request: 2231 autoupdate

Merge in DNS/adguard-home from 2231-autoupdate to master

Updates .

Squashed commit of the following:

commit 4ee9148ee7a38f2759898302a2109aa982fb4ee9
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 30 19:08:14 2020 +0300

    sysutil: provide os-independent interface

commit 778097c5fdeb1dec94f4cfc6443d08f92d9db0ba
Author: Eugene Burkov <e.burkov@adguard.com>
Date:   Mon Nov 30 16:40:33 2020 +0300

    all: add sysutil package
This commit is contained in:
Eugene Burkov 2020-11-30 19:23:14 +03:00
parent 6e615c6eaa
commit 641db73a86
13 changed files with 158 additions and 88 deletions
internal/home

View file

@ -10,8 +10,8 @@ import (
"strings"
"syscall"
"github.com/AdguardTeam/AdGuardHome/internal/sysutil"
"github.com/AdguardTeam/AdGuardHome/internal/update"
"github.com/AdguardTeam/AdGuardHome/internal/util"
"github.com/AdguardTeam/golibs/log"
)
@ -104,12 +104,7 @@ func getVersionResp(info update.VersionInfo) []byte {
tlsConf.PortDNSOverQUIC < 1024)) ||
config.BindPort < 1024 ||
config.DNS.Port < 1024) {
// On UNIX, if we're running under a regular user,
// but with CAP_NET_BIND_SERVICE set on a binary file,
// and we're listening on ports <1024,
// we won't be able to restart after we replace the binary file,
// because we'll lose CAP_NET_BIND_SERVICE capability.
canUpdate, _ = util.HaveAdminRights()
canUpdate, _ = sysutil.CanBindPrivilegedPorts()
}
ret["can_autoupdate"] = canUpdate
}