Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 358841

Summary: Gentoo Printing Guide- net-print/cups does not require users in lp group to be able to print
Product: Gentoo Linux Reporter: Fab <netbox253>
Component: Current packagesAssignee: Printing Team <printing>
Status: CONFIRMED ---    
Severity: normal CC: billie, pacho
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=470178
Whiteboard:
Package list:
Runtime testing required: ---

Description Fab 2011-03-14 11:45:26 UTC
Hi,

The Gentoo Printing Guide is saying :

> Important: Any users that need to print should be added to the lp group.
> Add them by running (as root) gpasswd -a username lp.

Ok. But, then, I do not understand why any user can execute /usr/bin/lp* utilities, and then print files without any control :

> $ ls -l /usr/bin/lp*
> -rwxr-xr-x 1 root root 13668  6 déc.  14:22 /usr/bin/lp
> lrwxrwxrwx 1 root root    21 19 juil.  2010 /usr/bin/lpdomatic -> /usr/bin/foomatic-rip
> -rwxr-xr-x 1 root root  9512  6 déc.  14:22 /usr/bin/lpoptions
> -rws--x--x 1 root root  9540  6 déc.  14:22 /usr/bin/lppasswd
> -rwxr-xr-x 1 root root 13688  6 déc.  14:22 /usr/bin/lpq
> -rwxr-xr-x 1 root root 13632  6 déc.  14:22 /usr/bin/lpr
> -rwxr-xr-x 1 root root  9524  6 déc.  14:22 /usr/bin/lprm
> -rwxr-xr-x 1 root root  4661 20 oct.  09:09 /usr/bin/lprsetup.sh
> -rwxr-xr-x 1 root root 26084  6 déc.  14:22 /usr/bin/lpstat


Reproducible: Always




$ emerge --info cups
Portage 2.1.9.25 (default/linux/x86/10.0/desktop/gnome, gcc-4.4.5, glibc-2.11.3-r0, 2.6.37-gentoo-r1 i686)
=================================================================
                        System Settings
=================================================================
System uname: Linux-2.6.37-gentoo-r1-i686-Intel-R-_Core-TM-2_CPU_E7400_@_2.80GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 14 Mar 2011 08:15:01 +0000
app-shells/bash:     4.1_p9
dev-java/java-config: 2.1.11-r3
dev-lang/python:     2.6.6-r2, 3.1.3-r1
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.7.0
sys-apps/sandbox:    2.4
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.5
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.36.1 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe -mmmx -msse"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=i686 -pipe -mmmx -msse"
DISTDIR="/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
FEATURES="assume-digests binpkg-logs buildpkg distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
GENTOO_MIRRORS="ftp://mirror.ovh.net/gentoo-distfiles/ ftp://ftp.free.fr/mirrors/ftp.gentoo.org/ "
LANG="fr_FR.utf8"
LDFLAGS="-Wl,-O1,--hash-style=gnu,--sort-common -Wl,--as-needed"
LINGUAS="fr"
MAKEOPTS="-j5"
PKGDIR="/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/portage/trees/gentoo"
PORTDIR_OVERLAY="/portage/trees/layman/gamerlay /portage/trees/perso /portage/trees/tempo"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib cups cxx dbus dri dts dvd dvdr emboss encode evo exif fam ffmpeg firefox flac fortran gconf gdbm gdu gif gnome gnome-keyring gnutls gstreamer gtk iconv java jpeg lcms libnotify logrotate mad mikmod mmx mng modules mp3 mp4 mpeg mudflap nautilus ncurses network-cron nls nptl nptlonly ogg openal opengl openmp oss pam pango pcre pdf perl png policykit ppds pppd python qt3support qt4 readline sdl session spell sse ssl startup-notification svg sysfs tcpd tiff truetype udev unicode usb v4l2 vorbis x264 x86 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fr" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

net-print/cups-1.3.11-r4 was built with the following:
USE="X acl dbus gnutls java jpeg pam perl png ppds python ssl tiff -avahi -kerberos -ldap -php -samba -slp -static -xinetd -zeroconf" LINGUAS="fr -de -en -es -et -he -id -it -ja -pl -sv -zh_TW"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2011-03-14 19:47:06 UTC
So all users can print, even when they're not in the lp group, but still, not all are lpadmin? Could be a security bug, assigning to printing@ for now...
Comment 2 Andreas K. Hüttel archtester gentoo-dev 2012-01-22 21:36:18 UTC
Right now I dont see anything in the cups makefiles that would change ownership or permission of these binaries. So, it seems to be desired behaviour.

(Which makes senes since IPP does not require setuid anymore.)

However, will try to get confirmation from upstream.
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2012-04-18 22:43:28 UTC
The permissions are the same on Debian, OpenSuSE, and SLES. So this is the desired behaviour. The docs need fixing.
Comment 4 Daniel Pielmeier gentoo-dev 2012-05-02 18:20:02 UTC
The lp* utilities are indeed executable by any user. However the cups configuration files from /etc/cups can only be changed by users who are member of the lp group. So it seems that everybody is allowed to print but only root and members of the lp group can make configuration changes. If this is true the docs need to be reworded in that regard.
Comment 5 Fab 2012-05-02 18:41:47 UTC
(In reply to comment #4)
> However the cups configuration files from /etc/cups can only be
> changed by users who are member of the lp group.

Not on my system.

> $ ls -l /etc/cups/
> total 64
> -rw------- 1 root lp    128  8 sept.  2011 classes.conf
> -rw------- 1 root lp    128 16 juil.  2011 classes.conf.O
> -rw-r--r-- 1 root root   35  9 févr. 09:29 client.conf
> -rw-r----- 1 root lp   2938  8 sept.  2011 cupsd.conf
> -rw-r----- 1 root lp   4144  2 juil.  2011 cupsd.conf.O
> -rw-r----- 1 root lp   4144  9 févr. 09:29 cupsd.conf.default
> drwxr-xr-x 2 root root 4096  9 févr. 09:30 interfaces
> drwxr-xr-x 2 root lp   4096  9 févr. 09:30 ppd
> -rw------- 1 root lp    619 27 avril 09:52 printers.conf
> -rw------- 1 root lp    656 18 avril 08:46 printers.conf.O
> -rw-r----- 1 root lp    186  9 févr. 09:29 snmp.conf
> drwx------ 2 root lp   4096  9 févr. 09:30 ssl
> -rw-r----- 1 root lp    110 17 sept.  2011 subscriptions.conf
> -rw-r----- 1 root lp    333 17 sept.  2011 subscriptions.conf.O
Comment 6 Daniel Pielmeier gentoo-dev 2012-05-02 18:55:39 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > However the cups configuration files from /etc/cups can only be
> > changed by users who are member of the lp group.
> 
> Not on my system.
> 
> > $ ls -l /etc/cups/
> > total 64
> > -rw------- 1 root lp    128  8 sept.  2011 classes.conf
> > -rw------- 1 root lp    128 16 juil.  2011 classes.conf.O
> > -rw-r--r-- 1 root root   35  9 févr. 09:29 client.conf
> > -rw-r----- 1 root lp   2938  8 sept.  2011 cupsd.conf
> > -rw-r----- 1 root lp   4144  2 juil.  2011 cupsd.conf.O
> > -rw-r----- 1 root lp   4144  9 févr. 09:29 cupsd.conf.default
> > drwxr-xr-x 2 root root 4096  9 févr. 09:30 interfaces
> > drwxr-xr-x 2 root lp   4096  9 févr. 09:30 ppd
> > -rw------- 1 root lp    619 27 avril 09:52 printers.conf
> > -rw------- 1 root lp    656 18 avril 08:46 printers.conf.O
> > -rw-r----- 1 root lp    186  9 févr. 09:29 snmp.conf
> > drwx------ 2 root lp   4096  9 févr. 09:30 ssl
> > -rw-r----- 1 root lp    110 17 sept.  2011 subscriptions.conf
> > -rw-r----- 1 root lp    333 17 sept.  2011 subscriptions.conf.O

Sorry I meant accessed. So it looks like the lp group does not make much sense, but upstream should be contacted, maybe there are reasons for the current permissions.
Comment 7 Daniel Pielmeier gentoo-dev 2013-10-20 13:00:16 UTC
I took a look at this again and made some tests as normal user who is in the "lpadmin" group. Although the the cups configuration files belong to the lp group which has only read access, I was able to add/remove printers and change settings via the cups web interface. I was also able to add/remove printers using the hp-setup tool from hplip.

The cups ebuild adds the lp and the lpadmin group and cupsd.conf is configured by default to use lpadmin as @SYSTEM account. So anyone who needs to manage the printers i.e. add or modify them needs to be in the lpadmin group and and everybody who just needs to print is not required to be a member of any special groups.

You are only required to be root if you directly edit/access the cups configuration files with a text editor.

What role the lp group plays I don't know.

I already added/updated this at the hplip wiki page [1].

[1] https://wiki.gentoo.org/wiki/HPLIP#Installation