Bug 88303

Summary: cupsd.conf missing Listen networks for shared printing
Product: [Retired] Red Hat Linux Reporter: Christopher Wong <chris>
Component: redhat-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9CC: rpj, ted
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-07-07 16:36:36 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch
none
Uniques the Listen and BrowseAddress lists none

Description Christopher Wong 2003-04-08 18:38:39 UTC
The redhat-config-printer utility misgenerates /etc/cups/cupsd.conf for the case of a 
printer shared over the network. CUPS needs to be told to listen to the network where 
service requests will come from. But after specifying a network and sharing, the 
resulting cupsd.conf only has "Listen 127.0.0.1:631". Needless to say, listening only on 
the local loopback will not make network printing work very well. 
 
The problem is that backend.py is looking in /etc/sysconfig/networking/devices for ifcfg-* 
files. That directory is empty. Anaconda installs the ifcfg-* files in 
/etc/sysconfig/network-scripts. Changing the relevant glob.glob() call to look in the latter 
directory will cause "printconf-backend --force-rebuild" to insert the appropriate "Listen" 
lines. 
 
Note: I could not get this far until I used the fix in #88291.

Comment 1 Tim Waugh 2003-04-08 20:20:26 UTC
cc'd redhat-config-network maintainer

Harald: is this the right fix?

I'm a bit puzzled, since I have network-shared printers working absolutely fine
on a fresh kickstart Red Hat Linux 9 install.

So when is the first path used for ifcfg-* files, and when is the other one
used?  And which one should printconf look at?

Comment 2 Tim Waugh 2003-04-09 11:41:39 UTC
Okay, reproduced.  There is also a further problem with DHCP-configured
interfaces; investigating.

Comment 3 Tim Waugh 2003-04-09 11:54:52 UTC
Created attachment 91040 [details]
Proposed patch

Here's the patch I plan on using.

Comment 4 Harald Hoyer 2003-04-09 12:17:35 UTC
do not use /etc/sysconfig/networking ...

Comment 5 Tim Waugh 2003-05-06 09:08:51 UTC
The current rawhide package (0.6.53-1) has this fixed.  Needs an RHBA.

Comment 6 Ross Johnson 2003-06-05 09:30:21 UTC
backend.py is generating unecessary Listen statements which are killing cupsd.

I'm using Red Hat 9 with redhat-config-printer-0.6.47-1.

Senario: I have a central server which will share queues to many clients.
I restrict access to one (of many) of my queues to a specific IP address,
say, 137.92.140.81. The other queues are shared to a network range
137.92.140.0/255.255.255.0. This then triggers the following code at
the very bottom of backend.py.

# Interfaces to listen on
if len (ipaddr) != 1 or ipaddr[0] != "*":
    cupsd_conf_lines.append ("Listen 127.0.0.1:631\n")

for each in ipaddr:
    cupsd_conf_lines.append ("Listen %s:631\n" % each)


Which produces in my cupsd.conf:

Listen 127.0.0.1:631
Listen 137.92.140.81:631

Subsequently, I get a cupsd error 'cannot bind to address' on the
second Listen line. If I delete the second line, cupsd runs but
remote clients don't send jobs to it because it's only listening
to localhost. If replace all Listen lines with just

Port 631

cupsd accepts jobs from remote clients and will honour the restrictions
on the restricted queue via the correctly generated Allow/Deny attributes.

I don't believe you can have two sockets listening on the same port.
I suspect the Listen statement is intended to allow cupsd to
Listen on different ports and the IP address spec simply sets up
filters within cupsd for a bit of extra security.

I suspect that the code above should only emit

Listen 631

or a single computed all-encompassing range of the individually
Allowed From IP addresses. In my case that might be

Listen 137.92.140.0/255.255.255.0:631

But I don't know that that's even necessary. Leave that to iptables.


Comment 7 Tim Waugh 2003-06-05 09:50:01 UTC
No, the code is as intended: you can listen on several different addresses to
the same port.

This works for me, and netstat -tlp shows:

tcp        0      0 192.168.1.7:631    0.0.0.0:*               LISTEN 4716/cupsd
tcp        0      0 127.0.0.1:631      0.0.0.0:*               LISTEN 4716/cupsd

Also, with LogLevel debug, error_log shows:

D [05/Jun/2003:10:45:19 +0100] StartListening: address=7f000001 port=631
D [05/Jun/2003:10:45:19 +0100] StartListening: address=c0a80107 port=631

So I don't think your problem is due to there being several different Listen
lines.  If there are any duplicated identical Listen lines that would cause
problems though.

I've put an unofficial package which fixes several problems at:
ftp://people.redhat.com/twaugh/tmp/redhat-config-printer-0.6.47.6-1.src.rpm

Use 'rpmbuild --rebuild redhat-config-printer-0.6.47.6-1.src.rpm' to generate
the binary RPMs.

Comment 8 Ross Johnson 2003-06-05 15:29:20 UTC
Created attachment 92166 [details]
Uniques the Listen and BrowseAddress lists

Thanks! I see what you've done and that works.

I also get duplicate browserequest broadcast addresses, which suggests that
both
the ipaddr and broadcast lists should be uniqued. I've included a patch against

your unofficial source RPM that I think does this. Changes are all in
grok_sysconfig_files.

Comment 9 Tim Waugh 2003-06-09 10:10:36 UTC
Thanks, I've added this fix too.

Comment 10 Tim Waugh 2003-07-07 16:36:36 UTC
An errata has been issued which should help the problem described in this bug report. 
This report is therefore being closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, please follow the link below. You may reopen 
this bug report if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2003-125.html