Message-ID: <1b584ae7-3772-d9d1-7aa5-53ed87b92b8e@...2669...> Date: Tue, 29 Mar 2022 21:36:02 +0200 MIME-Version: 1.0 Content-Language: en-US References: From: Timo Rothenpieler In-Reply-To: Subject: Re: [Openvpn-devel] [ovpn-dco] can not delete tun interface automatically if option "user nobody" is used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit To: openvpn-devel , Antonio Quartulli , Gert Doering On 29.03.2022 12:48, Gert Doering wrote: > Hi, > > On Tue, Mar 29, 2022 at 06:21:37PM +0800, Tony He wrote: >> 1. Add option "user nobody" to test ovpn-dco. >> 2. Start openvpn, below is the log. Then we will see tun0 is still >> there after openvpn exit. We must use the command "ip link del tunX" >> to delete. This is not friendly to end user. > > Yes. This is currently unsolved - if you tell openvpn to give up its > privileges, it will give up its privileges, and then it lacks privileges > to tear down the interface again. > > This should be doable with linux net capabilities, but right now, we > have not investigated this option further. So, for now, do not > use "user" together with DCO. I just sent a patch ("Retain CAP_NET_ADMIN when dropping privileges") that solves this for me. It retains the CAP_NET_ADMIN capability while switching user. Patch sits on top of the dco branch, since it uses functions from it. I'm not seeing the patch yet, but my mail server claims it got delivered. The patch is also on Github, on top of the dco branch in my fork: https://github.com/BtbN/openvpn/tree/dco