LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   CUPS to CUPS through SSH port forwarding (https://www.linuxquestions.org/questions/linux-general-1/cups-to-cups-through-ssh-port-forwarding-895330/)

Uqbar 08-03-2011 10:59 AM

CUPS to CUPS through SSH port forwarding
 
I have a remote machine running CUPS and managing a locally (USB) connected printer. Everything works fine as expected.

I have another machine also running CUPS for a number of printers that are either local or on the same LAN of the server. Also this works fine.
I need to be able to print from this server on the first remote machine's printer.
I managed to have a remote forwarding like this on the remote machine:

machine# ssh -C -N -T -R 192.168.0.2:631:127.0.0.1:631 root@server

(192.168.0.2 is a dummy interface on the server)

This means that any connection on TCP port 192.168.0.2:631 in the server will be forwarded straight to TCP port 127.0.0.1:631 on the remote machine with the printer.

On server's CUPS web UI I've tried to add a printer (with the proper driver) like this:

ipp://192.168.0.2:631/printername
http://192.168.0.2:631/printername/
http://192.168.0.2:631/ipp/
http://192.168.0.2:631/ipp/printername
ipp://192.168.0.2/ipp/
ipp://192.168.0.2/ipp/printername

The printer in the remote machine doesn't print anything.
The logs say:
Unable to get the printer status (Bad request)

How can I add the remote machine printer to the server's CUPS configuration?

Thanks in advance.

mpapet 08-04-2011 04:41 AM

Are port 631 TCP and UDP packets being forwarded correctly? Does the printer have TCP/UDP stuff that needs to be forwarded?

Wireshark can help you figure this out.

allend 08-04-2011 10:06 AM

Is the printer on the remote machine configured for shared access? Check that "Shared Yes" appears in section for the printer in the output of 'cat /etc/cups/printers.conf', or use the web interface.

Does the remote machine allow remote access in cupsd.conf?
Code:

# Allow remote access
Listen *:631

On the local server in cupsd.conf you will need lines like
Code:

# Show remote shared printers
BrowseRemoteProtocols CUPS
BrowsePoll 192.168.0.2:631

to show the remote printer.

Uqbar 08-05-2011 05:34 AM

I've tried a number of options in the configuration files as well as tcpdump (the CLI equivalent for wireshark).
I finally found the way to refer to the IPP printer properly (RTFM as usual) and even traced the IPP packets to from source to destination. Everything was fine, but no print was coming out, as stated by the CUPS logs.
Then I've filed a bug to CUPS/Apple: http://www.cups.org/str.php?L3912
The response is quite disappointing: you won't ever do that.
Of course, by sharing the printer with SAMBA and forwarding that protocol (TCP:139) I have been able to do it.

Just for the sake of completeness, the point is simple.
IPP is actually http on port 631, so CUPS is a web server that uses the same TCP port for both print job submissions *and* CUPS configuration. The designers decided to protect just the port 631 and not just the CUPS configuration service (which uses a different URL than submission).


All times are GMT -5. The time now is 01:37 PM.