Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

CUPS Web interface problem

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
RichardR
Posts: 6
Joined: 2022-06-25 12:15

CUPS Web interface problem

#1 Post by RichardR »

Hello,
I'm running a small server with Debian 9.13 stretch, which includes a CUPS print service.
The attached printer works OK, but the interface page at [server IP]:631 is semi-broken: the HTML elements and links are there, but only in their elementary form:
cups_interface.png
cups_interface.png (32.13 KiB) Viewed 2491 times
Here's the page's source code:

Code: Select all

<!DOCTYPE HTML>
<html>
  <head>
    <link rel="stylesheet" href="/cups.css" type="text/css">
    <link rel="shortcut icon" href="/apple-touch-icon.png" type="image/png">
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <meta http-equiv="X-UA-Compatible" content="IE=9">
    <meta name="viewport" content="width=device-width">
    <style>html{display:none;}</style>
    <script type="text/javascript"><!--
      /* Only display document if we are not in a frame... */
      if (self == top) {
        document.documentElement.style.display = 'block';
      } else {
        top.location = self.location;
      }

      /* Show an error if cookies are disabled */
      function check_cookies() {
	if (!navigator.cookieEnabled) {
	      document.getElementById('body').innerHTML = 'This page uses cookies to prevent common cross-site attacks. Please enable cookies in your browser.';
	}
      }
    --></SCRIPT>
    <title>Jobs - CUPS 2.2.1</title>
  </head>
  <body onload="check_cookies();">
    <div class="header">
      <ul>
	<li><a href="http://www.cups.org/" target="_blank">CUPS.org</a></li>
	<li><a href="/">Home</a></li>
	<li><a href="/admin">Administration</a></li>
	<li><a href="/classes/">Classes</a></li>
	<li><a href="/help/">Help</a></li>
	<li><a class="active" href="/jobs/">Jobs</a></li>
	<li><a href="/printers/">Printers</a></li>
      </ul>
    </div>
    <div class="body">
      <div class="row">
	<h1>Jobs</h1>
<FORM ACTION="/jobs/" METHOD="GET">

<P ALIGN="CENTER"><B>Search in
Jobs:</B>
<INPUT TYPE="SEARCH" NAME="QUERY" VALUE="" SIZE="40"  PLACEHOLDER="" AUTOSAVE="org.cups.jobs" RESULTS="20"> <INPUT
TYPE="SUBMIT" VALUE="Search"> <INPUT TYPE="SUBMIT" NAME="CLEAR" VALUE="Clear"></P>

</FORM>

<FORM ACTION="/jobs" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="completed"><INPUT TYPE="SUBMIT" VALUE="Show Completed Jobs"></FORM>
<FORM ACTION="/jobs" METHOD="GET"><INPUT TYPE="HIDDEN" NAME="which_jobs" VALUE="all"><INPUT TYPE="SUBMIT" VALUE="Show All Jobs"></FORM>

<P ALIGN="CENTER">No jobs.</P>

      </div>
    </div>
    <div class="footer">CUPS and the CUPS logo are trademarks of <a href="http://www.apple.com">Apple Inc.</a> Copyright © 2007-2015 Apple Inc. All rights reserved.</div>
  </body>
</html>
This source is found in /usr/share/cups/doc-root/index.html, and the referenced stylesheet cups.css is also present here, as are the other resources for this page.
Yet somehow this seemingly correct setup does not result in the correct CUPS web interface showing. I've been searching the Debian installation for the exact mechanism that serves up this interface page, but I can't locate it. As already said, CUPS and the attached printer are functioning fine, but I find this a bit annoying - also because I must be missing something here.
Does anyone have an idea what is going on here?

TIA,

Richard

arzgi
Posts: 1183
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: CUPS Web interface problem

#2 Post by arzgi »

What browser did you use? Can you try some other browser?

RichardR
Posts: 6
Joined: 2022-06-25 12:15

Re: CUPS Web interface problem

#3 Post by RichardR »

I tried Mozilla Firefox and Google Chrome, both fully updated, and from two different machines. They all show the same broken style.

I think it's safe to say that the problem is the CUPS server, not the client browser. I'm just not sure whether the cause lies with Debian or with CUPS itself.

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2062
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 221 times

Re: CUPS Web interface problem

#4 Post by FreewheelinFrank »

What are the contents of

Code: Select all

/etc/cups/cupsd.conf
?

I'm guessing that you don't want to listen for connections just from the local machine, and that Webinterface should be 'Yes'.
# Only listen for connections from the local machine.
Listen localhost:631
Listen /run/cups/cups.sock

# Web interface setting...
WebInterface Yes
Try

Code: Select all

Listen 0.0.0.0:631
as here

https://access.redhat.com/discussions/4620831

but bear in mind that if that works, you might need to restrict access if you don't want every machine on the network to be able to change admin settings.

RichardR
Posts: 6
Joined: 2022-06-25 12:15

Re: CUPS Web interface problem

#5 Post by RichardR »

/etc/cups/cupsd.conf:

Code: Select all

# cat cupsd.conf
LogLevel info
Port 631
Listen /var/run/cups/cups.sock
Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL
BrowseAddress @LOCAL
DefaultAuthType Basic
DefaultEncryption Never
<Location />
  Order allow,deny
  Allow @LOCAL
</Location>
<Location /admin>
  Order allow,deny
  Allow @LOCAL
</Location>
<Location /admin/conf>
  AuthType Basic
  Order allow,deny
  Allow @LOCAL
</Location>
<Policy default>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
    AuthType Basic
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job>
    Order deny,allow
    Require user @OWNER @SYSTEM
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
Webinterface yes
So that seems OK. Adding a line

Code: Select all

Listen 0.0.0.0:631
also does not change anything.
I also checked permissions of the different web interface files (cups.css and others), but there seems to be nothing wrong there: all 644. EDIT: I notice that carrying out admin tasks requires lpadmin permissions. Maybe this gives a clue?

I don't think that there is a problem with host access to these CUPS pages, but rather that for some reason, back-end configuration such as cups.css is ignored. Another thing I note in index.html (see first post) is that it refers to subdirectories "/classes/", "/admin/" etcetera which do not exist as such, but seem to be created dynamically. The directory /usr/share/cups/doc-root/ does not contain these subdirectories, and e.g. the "/classes/" link is probably created through /usr/lib/cups/cgi-bin/classes.cgi . Then again, I'm not an expert on this (otherwise I wouldn't be here :-) so please correct me if I'm wrong.

Anyway, my guess is that this dynamic interface page creation mechanism somehow causes the problem. The question is how, and how this can be corrected. (I've also been looking for a forum especially dedicated to CUPS, but this does not seem to exist.)

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 85 times

Re: CUPS Web interface problem

#6 Post by 4D696B65 »

Stretch long term support ends on June 30, 2022. It may be wise to upgrade to current stable and see if the cups issue changes.

RichardR
Posts: 6
Joined: 2022-06-25 12:15

Re: CUPS Web interface problem

#7 Post by RichardR »

Good idea, and I was planning this upgrade anyway.
So I just finished the upgrade to Debian 10 (buster), and I made sure not to keep any of the old CUPS configuration files, but install new ones.

Restarting cups ... reloading Web interface ... alas, no change.

Unless anyone has any more bright ideas, I think I'll just give up on fixing this. After all, it's merely a cosmetic issue, and the actual interface page works, as does the connected printer. It's just rather ugly, that's all (and annoying).

arzgi
Posts: 1183
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 31 times

Re: CUPS Web interface problem

#8 Post by arzgi »

Do other web pages look better?

Were you logged as root when accessing cups page?

RichardR
Posts: 6
Joined: 2022-06-25 12:15

Re: CUPS Web interface problem

#9 Post by RichardR »

Other Web pages are no problem, and local CUPS pages of other machines in my network (http://localhost:631/) look just fine as well. It's just my Debian server's CUPS interface page that looks awful.

And no, I am not logged in as root when accessing this CUPS interface.

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 85 times

Re: CUPS Web interface problem

#10 Post by 4D696B65 »

I'm wondering if cups.css file is ok

/user/share/cups/doc-root/cups.css

RichardR
Posts: 6
Joined: 2022-06-25 12:15

Re: CUPS Web interface problem

#11 Post by RichardR »

I replaced the whole doc-root directory on my Debian server with the CUPS doc-root directory from my work PC (after backing up the original, of course) and restarted cupsd, but that still does not work. This means that the problem is most probably not located in doc-root, and thus not in cups.css. Both cups.css files also seem identical.

Some more replace & test suggests that the problem is not even located in /usr/share/cups/, so that leaves /etc/cups, and probably cupsd.conf. However, I can't see anything in there that could explain the web interface behavior:

Code: Select all

LogLevel info
Port 631
Listen /var/run/cups/cups.sock
Browsing On
BrowseOrder allow,deny
BrowseAllow @LOCAL
BrowseAddress @LOCAL
DefaultAuthType Basic
DefaultEncryption Never
<Location />
  Order allow,deny
  Allow @LOCAL
</Location>
<Location /admin>
  Order allow,deny
  Allow @LOCAL
</Location>
<Location /admin/conf>
  AuthType Basic
  Order allow,deny
  Allow @LOCAL
</Location>
<Policy default>
  <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Pause-Printer Resume-Printer Set-Printer-Attributes Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Add-Printer CUPS-Delete-Printer CUPS-Add-Class CUPS-Delete-Class CUPS-Accept-Jobs CUPS-Reject-Jobs CUPS-Set-Default>
    AuthType Basic
    Require user @SYSTEM
    Order deny,allow
  </Limit>
  <Limit CUPS-Authenticate-Job>
    Require user @OWNER @SYSTEM
    Order deny,allow
  </Limit>
  <Limit Cancel-Job>
    Order deny,allow
    Require user @OWNER @SYSTEM
  </Limit>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
Webinterface yes

Post Reply