Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web interface: "Test Printer" points to "ServerName", not to "localhost" #34

Closed
michaelrsweet opened this issue Apr 20, 2003 · 8 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.1.19rc2
CUPS.org User: till.kamppeter

I am running Mandrake 9.1 with CUPS 1.1.19rc2 (freshly RPMized, RPM on current Cooker). My /etc/cups/cupsd.conf contains a "ServerName ..." directive. When I browse (Browser: Konqueror from KDE 3.1.0) all printers with

http://localhost:631/printers

or one locally defined printer with

http://localhost:631/printers/

and click on "Test Printer", I get to the URL

http://:631/printers/?op=print-test-page

where is the name which I have specified in the "ServerName ..." directive. What I expect is "localhost" as I get with all the other buttons ("Configure Printer", "Modify Printer", ...). I get "localhost" when I comment out or remove the "ServerName ..." directive in /etc/cups/cupsd.conf.

This leads to the following problem: If you need a "ServerName ..." directive (for example if you have two network interfaces and on the two networks your machine has different names) and you restrict the web interface to only be accessible by "localhost" you will not be able to print a test page from the web interface.

For admin access the web interface is restricted to "localhost" on most machines, and if you ar adjusting the printer defaults with "Configure Printer", then use "Test Printer" to check whether your settings are OK, and afterwards click the link on the "Test page sent; job ID is -." page to get back to the printer page, you will arrive on

http://:631/printers/

and not on

http://localhost:631/printers/

and so another click on "Configure Printer" goes to

http://:631/admin/?op=config-printer&printer_name=

which gives you a "Permission denied".

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

I'm guessing that ServerName is set to something other than the hostname or the IP address of the system? If so, the default authentication WILL NOT WORK for any printing, since the URI that is advertised is not accessible and this is a configuration problem, not a CUPS bug.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: till.kamppeter

is the IP of my box, and I can print the test page, the problem is, that I get to a URL and when I continue from there I cannot do any admin access any more.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Is the IP address the same as the one logged in the access_log file?

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: till.kamppeter

Below is the stuff written into access_log when going at first to

http://localhost:631/printers/lpdtest

and then clicking "Print Test Page" which lead to

http://192.168.100.184:631/printers/lpdtest?op=print-test-page

On the printer page all accesses go to localhost, on the driver page all except the "POST" go to 192.168.100.184.


localhost - root [23/Apr/2003:23:42:20 +0200] "GET /printers/ HTTP/1.1" 200 0
localhost - - [23/Apr/2003:23:42:20 +0200] "POST / HTTP/1.1" 200 77
localhost - root [23/Apr/2003:23:42:20 +0200] "GET /cups.css HTTP/1.1" 200 87
localhost - - [23/Apr/2003:23:42:20 +0200] "POST / HTTP/1.1" 200 105
localhost - root [23/Apr/2003:23:42:20 +0200] "GET /images/printer-idle.gif HTTP/1.1" 200 706
localhost - root [23/Apr/2003:23:42:20 +0200] "GET /images/print-test-page.gif HTTP/1.1" 200 288
localhost - root [23/Apr/2003:23:42:20 +0200] "GET /images/stop-printer.gif HTTP/1.1" 200 252
localhost - root [23/Apr/2003:23:42:20 +0200] "GET /printers/ HTTP/1.1" 200 26024
localhost - root [23/Apr/2003:23:42:21 +0200] "GET /images/reject-jobs.gif HTTP/1.1" 200 252
localhost - root [23/Apr/2003:23:42:21 +0200] "GET /images/modify-printer.gif HTTP/1.1" 200 277
localhost - root [23/Apr/2003:23:42:21 +0200] "GET /images/config-printer.gif HTTP/1.1" 200 296
localhost - root [23/Apr/2003:23:42:21 +0200] "GET /images/delete-printer.gif HTTP/1.1" 200 267
localhost - root [23/Apr/2003:23:43:01 +0200] "GET /printers/lpdtest HTTP/1.1" 200 0
localhost - - [23/Apr/2003:23:43:02 +0200] "POST / HTTP/1.1" 200 77
localhost - - [23/Apr/2003:23:43:02 +0200] "POST / HTTP/1.1" 200 153
localhost - - [23/Apr/2003:23:43:02 +0200] "POST / HTTP/1.1" 200 125
localhost - root [23/Apr/2003:23:43:02 +0200] "GET /cups.css HTTP/1.1" 200 87
localhost - root [23/Apr/2003:23:43:01 +0200] "GET /printers/lpdtest HTTP/1.1" 200 3321
localhost - root [23/Apr/2003:23:43:02 +0200] "GET /images/show-completed.gif HTTP/1.1" 200 337
192.168.100.184 - - [23/Apr/2003:23:43:29 +0200] "GET /printers/lpdtest?op=print-test-page HTTP/1.1" 200 0
192.168.100.184 - - [23/Apr/2003:23:43:29 +0200] "GET /cups.css HTTP/1.1" 200 87
192.168.100.184 - - [23/Apr/2003:23:43:29 +0200] "GET /images/navbar.gif HTTP/1.1" 200 2869
localhost - - [23/Apr/2003:23:43:29 +0200] "POST /printers/lpdtest HTTP/1.1" 200 953226

192.168.100.184 - - [23/Apr/2003:23:43:29 +0200] "GET /printers/lpdtest?op=print-test-page HTTP/1.1" 200 1560

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: till.kamppeter

The same problem also occurs on

http://localhost:631/printers/

When I click on a local printer (queue name or printer icon on the left) to get to the printer´s page I get also

http://[Server]:631/printers/[queue]

instead of the expected

http://localhost:631/printers/[queue]

when I have "ServerName [Server]" in my /etc/cups/cupsd.conf. So if I want to go to a printer´s page for administration, I cannot access the admin stuff any more as I am not on localhost any more.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Does the problem occur if you set HostNameLookups to "on"?

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: till.kamppeter

Yes, when I set "HostNameLookups On", it works as expected. Local printers in the printer list have "http://localhost:631/..." links and also the "Print Test Page" links are pointing to "http://localhost:631/...". Now I am wondering why without "HostNameLookups On" I get the network interface IP and not "127.0.0.1".

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Because the local IP != localhost (it isn't the loopback interface)

If you want to use a servername that isn't the value of gethostname, then you need to enable hostname lookups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant