Solved Print from jail using CUPS on host

Dear community,

I run the release version of FreeBSD-14.0 on a host. On the host CUPS is up and running. Using libreoffice on the host I can print documents on a separate network printer. Now two questions come up.

1. CUPS listens on localhost:631 by default. From my understanding this is just for the purpose of configuration and management. The content to be printed takes a different route to CUPS. Is this correct?

2. Is it possible to print from a software running in a jail using the CUPS server on the host? How to do that?

In case there is something to consider with respect to networking: To communicate with the jails I usually use the cloned interface lo1 and proxies, no NAT. But if necessary I can change to VNET jails and I can use NAT as well.
Basically I have not yet understood how "stuff" from a program as libreoffice is transferred to CUPS. I have just accepted that it works. If someone knows a resource where I can get an idea how it works under the hood it would be nice to know.

Thank you for any help in advance,
Christoph
 
Dear tingo,
thank you very much for the descriptions. This gives me a better idea. But I am not sure if I got it completely.

Regarding the communication I thought that because there are open sockets beside the 631 ones:
Code:
# sockstat | grep cups
root     cupsd       1325 4   stream -> /var/run/dbus/system_bus_socket
root     cupsd       1325 6   tcp6   ::1:631               *:*
root     cupsd       1325 7   tcp4   127.0.0.1:631         *:*
root     cupsd       1325 8   stream /var/run/cups/cups.sock
There is at least an option to communicate by two other streams.

But then it should be possible to print from applications in the jail if I can configure CUPS to listen on the cloned interface lo1, too. On the other hand the applications in the jail might require a listener on localhost on port 631. Then it would be necessary to establish a connection between localhost:631 and the cloned interface:631 on the jail. Or am I totally wrong?

EDIT: One answer is in https://en.wikipedia.org/wiki/Internet_Printing_Protocol from which I quote:
Code:
Among other things, IPP allows a client to:
[LIST]
[*]query a printer's capabilities (such as supported character sets, media types and document formats)
[*]submit print jobs to a printer     <-------
[*]query the status of a printer
[*]query the status of one or more print jobs
[*]cancel previously submitted jobs
[/LIST]
IPP uses TCP with port 631 as its well-known port.
 
You are not entirely correct. Basically (warning: I'm not using jails, but this is a generic setup), in your jail you need /etc/cups/client.conf
which contains
Code:
ServerName server
where server is the name (or ip address) of your host. You can also add the port, if needed.
Then you do
lpadmin -p printer -E -v ipp://server/printers/printer -m everywhere in your jail to setup the printer.
The your jail applications should be able to print to printer.

Warning: if there are extra steps to get networking ... working between host and jail, you need to figure out those yourself - I'm not using jails.
 
Back
Top