Gentoo Archives: gentoo-user

From: Mike Gilbert <floppym@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Openconnect overwriting /etc/resolv.conf
Date: Tue, 13 Dec 2016 23:20:16
Message-Id: CAJ0EP42OYXsJU_GGawUxBF8usWUAZMByxz_mgGZxpLe=e78Upw@mail.gmail.com
In Reply to: [gentoo-user] Openconnect overwriting /etc/resolv.conf by Alexander Kapshuk
1 On Tue, Dec 13, 2016 at 6:05 AM, Alexander Kapshuk
2 <alexander.kapshuk@×××××.com> wrote:
3 > Been using openconnect for a few years now.
4 > I currently have net-misc/openconnect-7.06-r1 installed.
5 > This morning, when logged in at a remote site, I noticed that when
6 > clicking, or typing, nothing would happen. Which somehow seemed to
7 > result in a similar behavior back on the local system, i.e. attempting
8 > to type commands in terminal had stopped working.
9 >
10 > Having rebooted my system and poked around system log and config
11 > files, I noticed that my /etc/resolv.conf got overwritten by
12 > openconnect. Further investigation indicated that it is done by design
13 > via this script: /etc/openconnect/openconnect.sh.
14 > I do not know if this is a recent change in openconnect's behaviour, I
15 > had no trouble of this sort doing remote work on the same system
16 > yesterday.
17 >
18 > An ad-hoc solution I have found online and applied to my environment is this:
19 > http://serverfault.com/questions/331299/how-can-i-stop-openconnect-from-changing-etc-resolv-conf
20 > chattr +i /etc/resolv.conf
21 >
22 > This seems to have helped. I can click and type both on remote systems
23 > and the local one with no trouble at all.
24 >
25 > Anyone else experienced this?
26 > What are your thoughts and suggestions on the matter?
27
28 You could install net-dns/openresolv, and set resolvconf=NO in
29 /etc/resolvconf.conf. openconnect.sh will automatically utilize
30 openresolv if it is installed, and that config setting prevents
31 openresolve from making any updates.
32
33 An uglier solution is to edit /etc/openconnect/openconnect.sh, and
34 comment out the following lines:
35
36 In do_connect():
37
38 if [ -n "$INTERNAL_IP4_DNS" ]; then
39 $MODIFYRESOLVCONF
40 fi
41
42 In do_disconnect():
43
44 if [ -n "$INTERNAL_IP4_DNS" ]; then
45 $RESTORERESOLVCONF
46 fi

Replies

Subject Author
Re: [gentoo-user] Openconnect overwriting /etc/resolv.conf Alexander Kapshuk <alexander.kapshuk@×××××.com>