AdguardTeam/AdGuardHome

Add option to enable auto-upgrade on Linux/Unix despite CAP_NET_BIND_SERVICE capability

Open

#1.944 aberto em 25 de jul. de 2020

Ver no GitHub
 (5 comments) (2 reactions) (0 assignees)Go (2.333 forks)batch import
feature requesthelp wanted

Métricas do repositório

Stars
 (34.000 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

Problem Description

The if statement linked below rightly describes the issue with setting CAP_NET_BIND_SERVICE on binary files in Linux but doesn't account for setting this option using systemd's AmbientCapabilities directive instead, which doesn't require setting the capability on the binary itself.

https://github.com/AdguardTeam/AdGuardHome/blob/b4aa79151315035f0e839d9a710fe4051595acb5/home/control_update.go#L101-L111

Proposed Solution

Modify the if statement logic to allow users to override the behavior, perhaps with a command line flag like --allow-auto-update? When combined with the AmbientCapabilities systemd directive, this would allow users to auto upgrade the binary even when running AdGuardHome without root permissions.

Systemd Service File Example

AmbientCapabilities=CAP_NET_BIND_SERVICE

Alternatives Considered

Script the upgrade myself or fork the code, but a native solution would be much easier and a benefit for other Linux users. Thanks for the great application!

Additional Information

Guia do colaborador