[CentOS] cups printing to a remote network

Gregory P. Ennis PoMec at PoMec.Net
Fri Aug 10 21:55:56 UTC 2012


On Sat, Aug 04, 2012 at 11:30:48PM -0500, Gregory P. Ennis wrote:
> Everyone,
> 
> I have an need to be able to print to an HP1320 that is usb connected to
> a Fedora 17 desktop on a remote network from a Centos 5.8 cups print
> server on an internal network.  The desktop is in a remote network that
> belongs to to a different client than the one owning the cups print
> server.  
> 
> The F17 usb HP1320 connection works fine, and I can also get the F17
> system to poll the cups print server in order to print to any of the
> printers on the internal network.  So far I have not been able to figure
> out a way to print to the remote HP1320 from inside the internal
> network.  
> 
> I am about ready to ask the remote client to provide a static ip address
> that we can use that to be able to connect separately from them.  It
> just seems there ought to be a way to do this.  I am unable to poll the
> desktop unit on the remote network from the internal network because of
> firewall restrictions on the remote network.  
> 
> Any ideas ????
> 
> Greg Ennis

(1) VPN, or somewhat simpler, some sort of tunnelled SSH connection.

(2) Maybe get the remote people to establish an email account for
the printer. Securing this against malmail might be tricky.  I
recently got a Konica Bizhub 20p printer, when nosing around the
telnet interface to it, I noticed it had a built-in ability to suck
print jobs from a POP server.  Absent such an ability on the printer
itself, a dummy user could get your mailed print jobs, perform some
kind of authentication (perhaps with procmail), and then spool the
job.  It could email you back when the job was spooled.

Dave

I had not thought of using POP service.  I could poll that fairly
easily; I would expect it to be a little slower, but I can see how it
would work.  

I have not played with tunneled ssh connections, but that would probably
work the best.  I could dump the print job in a directory on the
internal server, and poll that directory from the remote machine.

Thanks much for your ideas!!!!

Greg
---------------------------------------------------------------------

Dave and others,

I wanted to post my solution so that others may have the benefit of my
trial and error.  

I was never able to get cups to successfully address a remote Desktop
unit that was internal to a foreign network.  I could get cups to allow
the remote Desktop unit in a foreign network to print to any of the
printers in our network.

My solution was to establish a reverse ssh tunnel from the remote
Desktop with :

ssh -R 19926:127.0.0.1:22 user at home_network.com

This allowed the establishment of a connection from the internal network
to the remote Desktop.

Additional I wrote a perl script that is activated by the above command
via :

ssh -R 19926:127.0.0.1:22 user at home_network.com 's.lp.pr'

I redirected the software to print to a file that would not be handed
off to cups, and had s.lp.pr sense those files and copy them to the
remote Desktop, and then after the scp copy this script would execute a
command on the remote Desktop to send the file to the cups daemon on the
remote Desktop.

ie 

Copy the file to the Remote Desktop
   $arg = 
   "scp -P 19926 $PRINT_FILE rem_user\@localhost:/tmp/";
   system ($arg);

Use cups on the remote Desktop to print the file
   $arg_ssh = 
   "ssh rem_user\@localhost -p 19926 'lp -d lpt /tmp/$PRINT_FILE'
   system($arg_ssh);

Also, obviously the $PRINT_FILE needs to be deleted on the Remote
Desktop and the Internal server as well.

There may be better ways to do this, but this worked very well.

Greg Ennis




More information about the CentOS mailing list