Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 37886 - /etc/resolv.conf permissions again
Summary: /etc/resolv.conf permissions again
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Dialup Developers
URL:
Whiteboard:
Keywords:
: 26311 37295 49697 62864 69694 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-01-11 06:25 UTC by Stephan Kapfinger
Modified: 2004-11-10 22:04 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
/etc/ppp/ip-up as installed by ppp-2.4.2-r8 (ip-up.dist,1.07 KB, text/plain)
2004-11-10 15:13 UTC, Oliver Schoett
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Kapfinger 2004-01-11 06:25:08 UTC
see also bug #26311

/etc/ppp/ip-up and ip-down (ppp-2.4.2_beta3-r1) change the permissions of /etc/resolv.conf:

/bin/chmod 640 /etc/resolv.conf
/bin/chown root:users /etc/resolv.conf

I'm using rp-pppoe, which keeps resolv.conf in /etc/ppp/ and makes a symbolic link from /etc/resolv.conf -> /etc/ppp/resolv.conf (which is owned by root:root)

So please change the command in ip-up to:
/bin/chown --dereference root:users /etc/resolv.conf
to take care of a possible symlink
Comment 1 Heinrich Wendel (RETIRED) gentoo-dev 2004-01-12 03:24:14 UTC
*** Bug 37295 has been marked as a duplicate of this bug. ***
Comment 2 Heinrich Wendel (RETIRED) gentoo-dev 2004-01-12 06:48:14 UTC
sounds good, fixed :D
Comment 3 José Romildo Malaquias 2004-01-12 08:33:32 UTC
Does not work for me yet. /etc/ppp/ip-up has the line

        /bin/chown --no-dereference root:users /etc/resolv.conf

Shouln't it be "--dereference" instead of "--no-dereference"?
Comment 4 José Romildo Malaquias 2004-01-12 08:36:11 UTC
Does not work for me yet. /etc/ppp/ip-up has the line

        /bin/chown --no-dereference root:users /etc/resolv.conf

Shouln't it be "--dereference" instead of "--no-dereference"?
Comment 5 Heinrich Wendel (RETIRED) gentoo-dev 2004-01-12 12:04:28 UTC
ok, i don't really understand why we need this at all, ip-up does the following:

move /etc/resolv.conf to /etc/resolv.conf.old
cat /etc/ppp/resolv.conf to /etc/resolv.conf
and change ownership of /etc/resolv.conf to the user

so /etc/resolv.conf is in no case a symlink and you should have the correct rights
Comment 6 José Romildo Malaquias 2004-01-12 12:52:31 UTC
I confirm what s.kapfinger@gmx.de has described: when using rp-pppoe, adsl-start keeps resolv.conf in /etc/ppp/ and makes a symbolic link from /etc/resolv.conf -> /etc/ppp/resolv.conf:

# adsl-start
# ls -l /etc/resolv.conf* /etc/ppp/resolv.conf
-rw-r-----    1 root     users          52 Jan 12 18:24 /etc/ppp/resolv.conf
lrwxrwxrwx    1 root     root           20 Jan 12 18:23 /etc/resolv.conf -> /etc/ppp/resolv.conf
-rw-------    1 root     root           52 Jan 12 18:24 /etc/resolv.conf.old

What is happening is that ip-up is not really moving /etc/resolv.conf to /etc/resolv.conf.old, but making a copy (command used is "cp -f"). So after that, the file /etc/resolv.conf is still there. If it was a link, it still is a link. Then ip-up appends /etc/ppp/resolv.conf to /etc/resolv.conf using a "cat >>" command. Conclusion: a new /etc/resolv.conf is not created.

A "rm /etc/resolv.conf" command after the "cp -f" and before the "cat" command solves the problem.

Comment 7 José Romildo Malaquias 2004-01-13 01:59:58 UTC
I have observed also that the service domainname (script /etc/init.d/domainname) creates a new /etc/resolv.conf, in order to put the domain in the first line, leaving it unreadable by normal users.
Comment 8 Heinrich Wendel (RETIRED) gentoo-dev 2004-01-17 10:41:45 UTC
it should be readable since files are generated 0644 by default, hopefully finally fixed the resolv.conf issues in ppp
Comment 9 SpanKY gentoo-dev 2004-05-05 17:30:35 UTC
*** Bug 49697 has been marked as a duplicate of this bug. ***
Comment 10 M. Edward Borasky 2004-06-04 07:06:47 UTC
Well ... I just upgraded from net-dialup/ppp-2.4.1-r14 to net-dialup/ppp-2.4.2-r2 and I now have a resolv.conf that can only be read by root. I am using "kppp" to dial out.
Comment 11 Ronald Hummelink 2004-08-02 16:01:33 UTC
pppd passes USEPEERDNS=1 as environment variable to ip-up script also when gentoo's net.ppp0 specifies usepeerdns='no' (prolly when the ppp server passes dns servers back)

the ip-up script sees the =1 and rewrites resolv.conf at umask = 0077, resulting in a resolv.conf with permissions 400 and total system name resolution breakage for anything sane enough to not run as root.

Somebody please reopen this bug and fix this.. took ages to track this :(
Comment 12 Heinrich Wendel (RETIRED) gentoo-dev 2004-08-03 00:33:36 UTC
reopening
Comment 13 Alin Năstac (RETIRED) gentoo-dev 2004-09-26 14:29:57 UTC
Ok, I've looked into sources of ppp-2.4.2.
Don't see any problem in there; the env variable USEPEERDNS is set only when "usepeerdns" is present in command line of pppd or in system options (/etc/ppp/options*). Are you sure you don't have this flag set?
Comment 14 Ronald Hummelink 2004-09-26 14:57:30 UTC
You won't find it in the ppp sources, the flaw is the ip-up script (/usr/portage/net-dialup/ppp/files/2.4.2/ip-up)
which will recreate with very strict umask the /etc/resolv.conf script, depending on how a user configs his ppp uplink. Don't think thats acceptable.

No the bug is not obvious, cus its the umask the script is run as that causes the strict permission settings on /etc/resolv.conf

Comment 15 Daniel Black (RETIRED) gentoo-dev 2004-09-27 03:22:40 UTC
*** Bug 62864 has been marked as a duplicate of this bug. ***
Comment 16 Heinrich Wendel (RETIRED) gentoo-dev 2004-09-27 03:32:21 UTC
*** Bug 26311 has been marked as a duplicate of this bug. ***
Comment 17 Heinrich Wendel (RETIRED) gentoo-dev 2004-09-27 03:45:18 UTC
fixed, resolv.conf is now chmod 644 at the end of ip-up.
Comment 18 Oliver Schoett 2004-11-01 00:51:06 UTC
*** Bug 69694 has been marked as a duplicate of this bug. ***
Comment 19 Oliver Schoett 2004-11-01 00:53:32 UTC
Please reopen this bug (I am not allowed to do that)

ppp 2.4.2-r7, which just got pushed out to stable gentoo users, contains "chmod 640 /etc/resolv.conf" in /etc/ppp/ip-up.d, which according to comment #17 should have been fixed already.

This breaks name resolution for all non-root users not in group "users".
Comment 20 Daniel Black (RETIRED) gentoo-dev 2004-11-01 03:55:24 UTC
fixed again - thank you for your astute attention.
Comment 21 Oliver Schoett 2004-11-10 15:06:39 UTC
There seems to be something wrong in the bug fixing process.  I just received ppp-2.4.2-r8 with a ChangeLog entry that this bug has been fixed in files/net.ppp0.  That file indeed seems to put chmod 644 /etc/resolv.conf into the ip-up script.

However, the new file /etc/ppp/ip-up I received *still* has the chmod 640 in it and does not look like it has been generated by files/net.ppp0 at all (Attachment to follow).

So perhaps there is some confusion about how that config file is generated?

Please reopen this bug (I am not allowed to).

Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.8.1 i686)
=================================================================
System uname: 2.6.8.1 i686 Intel(R) Pentium(R) 4 CPU 2.60GHz
Gentoo Base System version 1.4.16
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r5
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium4 -O2 -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/share/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf/xdvi/ /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=pentium4 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache distlocks fixpackages noauto notitles sandbox sfperms userpriv usersandbox"
GENTOO_MIRRORS="http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ http://ftp.uni-erlangen.de/pub/mirrors/gentoo http://gentoo.inode.at/ http://gentoo.mirror.sdv.fr http://www.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage/"
USE="X acpi alsa avi berkdb bitmap-fonts cdr crypt cups dvd emacs encode esd f77 fam flac foomaticdb fortran gdbm gif gnome gphoto2 gpm gstreamer gtk gtk2 guile imagemagick imlib jack java jpeg junit libg++ libwww mad mbox mikmod mmx mmx2 motif mozilla mpeg nas ncurses network nptl oggvorbis opengl pam pdflib perl png python qt quicktime readline rtc samba sdl slang speex spell sse sse2 ssl svga tcpd tetex theora tiff truetype usb x86 xml xml2 xmms xv xvid zlib"

Comment 22 Oliver Schoett 2004-11-10 15:13:29 UTC
Created attachment 43687 [details]
/etc/ppp/ip-up as installed by ppp-2.4.2-r8

Note that this file still has the bad chmod 640 in it, and is different from
what files/net.ppp0 would generate.

Perhaps there are several places that might generate the ip-up file, and the
one you fixed is *not* the one that actually does it.

I suggest to reduce the ip-up generators/sources to one, so that there can be
no confusion which generator/source actually needs to be fixed.
Comment 23 Alin Năstac (RETIRED) gentoo-dev 2004-11-10 22:04:50 UTC
The ChangeLog is correct; it was a change in files/net.ppp0. However, this file is not used by 2.4.2 versions which instead use files from "files/2.4.2".
In this version, /etc/ppp/ip-up isn't it generated by /etc/init.d/net.ppp0 and I strongly feel this is the correct behaviour.

However, it is strange that ip-up script generate a root:users 0640 resolv.conf. Nameservers should not be classified information.

Corrected in 2.4.2-r9