AppArmor profile prevents DNS Servers from being added to resolv.conf

Bug #1970455 reported by Sebastian Wild
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
strongswan (Debian)
New
Unknown
strongswan (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

Currently the AppArmor profile for strongswan prevents vpn connections that use ipsec mode config from adding dns settings the client gets from the vpn gateway to the /etc/resolv.conf.
This is because it has the settings for resolving but this is only readonly. It is missing the write permission to /etc/resolv.conf.
This is an old bug that was reported on debian in 2018 already: https://<email address hidden>/msg1645350.html

One can fix it by adding the required line to the apparmor profile and restart apparmor afterwards.

I know there is other solutions like modifying network-manager config to not overwrite resolv.conf or using the resolvonf package and I did try various but none of them worked like it was supposed to. It didn't add DNS server at all or caused major delays in dns resolving.

With modified apparmor profile it works like a charm here now.

Changed in strongswan (Debian):
status: Unknown → New
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for taking the time to report this bug, Sebastian.

I'm adding it to the Ubuntu Server queue; as you mentioned, this is a relatively old issue and IIUC there's been some pushback to implement this. As Christian mentioned in the Debian bug, enabling write access via the apparmor profile by default could be interpreted as a security risk, so we have to take a deeper look into this problem before we proceed.

FWIW, I haven't tried to reproduce this bug locally, but I am setting its status as Triaged because it's pretty clear that the apparmor profile still doesn't allow strongswan to write to /etc/resolv.conf.

Changed in strongswan (Ubuntu):
status: New → Triaged
tags: added: server-todo
Changed in strongswan (Ubuntu):
assignee: nobody → Sergio Durigan Junior (sergiodj)
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Unfortunately, I don't have enough time to work on this right now.

Changed in strongswan (Ubuntu):
assignee: Sergio Durigan Junior (sergiodj) → nobody
tags: removed: server-todo
Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

@server-triage-discuss - looks like there may have been some discussion on this when I wasn't around. Did this mean to get dropped? If so, let's set as Won't Fix.

tags: added: server-triage-discuss
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Here is my take on this:

- we have a DEP8 test that creates a strongswan vpn, and I haven't seen this error there
- that tells me that it's only certain configurations that trigger this (confirming what it's said in the bug description)
- should we allow writing to resolv.conf in all cases? That's what we are a bit uncomfortable with. For such specific local configurations, the /etc/apparmor.d/local/ mechanism is a good fit and something the administrator can add
- of course, it might not be easy to reach that conclusion: troubleshooting ipsec vpns is not easy
- if the need to update resolv.conf is something we can easily detect at service startup time, and if it comes from a sane/secure source (like a config file that only root can write to), then one possible change we could make to the package, and which would be a compromise, is to dynamically adapt the profile if that scenario is detected.

Revision history for this message
Tobias Brunner (tobias-strongswan) wrote :

The resolve plugin only writes directly to resolv.conf if resolvconf is not available (see https://docs.strongswan.org/docs/5.9/plugins/resolve.html for details).

Bryce Harrington (bryce)
tags: removed: server-triage-discuss
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.