google / cloud-print-connector

Google Cloud Print Connector
BSD 3-Clause "New" or "Revised" License
764 stars 184 forks source link

Cant connect to printer #337

Open arpanet999 opened 7 years ago

arpanet999 commented 7 years ago

Hello. So i will start with explaining everything. I have an HP printer who is shared trough a windowsprint server. I have installed Ubuntu 16.04 and activated cups. I can surf in to Localhost:631 where i add the printer. I have installed cups connector by entering: sudo apt-get install cups libcups2 libavahi-client3 avahi-daemon libsnmp30 google-cloud-print-connector

I start the cups connector in terminal and my chromebook will now se the printer but is unable to connect to it. WHY? When i press Register it says: Do u want to register this printer. I press YES and it says: Unable to register printer.

EDIT: Getting this message: u must confirm the registration on the printer to finish the process.

jtcours commented 7 years ago

We're running into a similar problem.

We're trying to get a Chromebook to print through the connector to a local printer that is not Cloudprint ready. The print jobs might carry sensitive information, so we don't want the content going across the Internet. We're willing to accept that the user could only print on the local subnet.

We have a basic config file:

{
  "local_printing_enable": true,
  "cloud_printing_enable": false,
  "log_level": "INFO",
  "log_file_name": "/tmp/cloud-print-connector"
}

The printer's available through CUPS. Macs and Windows machines can print without trouble using local print connections.

The printer doesn't automatically appear to the Chromebook in Chrome's print settings. If we try to add it through Advanced Settings -> Manage Cloud Print, we get "You must confirm registration on the printer" with no way to actually confirm it on the printer.

Opening ports 26000-26999/tcp on the print server (as in bug #229) advances things slightly: clicking "register" gives the immediate message "could not complete registration".

Bug #156 suggests that we ought to be able to print without registering, but I haven't found a way to do that from the Chromebook. The Chrome bug it refers to, https://crbug.com/540847, appears to be closed, yet we're still seeing this behavior.

Is there a way to bypass the registration process or to make the printer automatically appear in the local printers? Alternatively, are there additional ports we should enable in iptables on the print server to allow discovery?

agoode commented 7 years ago

You should not need to do any kind of registration. That message shouldn't be showing up.

If printing is set up properly, then you'll just see the printer under "Local Destinations". Unfortunately, there are a few things that can cause problems.

On macOS, can you run this from the terminal: dns-sd -B _privet._tcp

That should show you all the printers on the network that are available for local printing. If you can't see privet entries from macOS (on the same network as your chromebook), then your network may be losing mDNS traffic.

Another test is to see if Chrome on macOS can see or print to the printer via local cloud print (privet). Just make sure that macOS does not have the printer configured and then try to print from Chrome.

Regardless, Chrome should not be asking you to register an unregisterable printer. I don't know if that's a bug in cloud-print-connector or Chrome.

jtcours commented 7 years ago

Oh, interesting. It's in the list of local printers this morning, but it wasn't last night. Maybe the discovery protocols need some time to settle in.

agoode commented 7 years ago

It shouldn't take long for discovery (tens of seconds usually). I have had problems with wifi routers dropping multicast packets, breaking discovery. It is a particularly brittle mechanism. Many other things can break multicast.

The bug with the register popup is still a thing though.

jtcours commented 7 years ago

Agreed. I don't know enough about the protocol to know what might be misfiring there.

For other folks who might be having troubles with the network layer, our iptables setup for the print server will probably end up permitting traffic along these lines:

  # It sure does take a lot of ports to get printing to work!
  #
  # Inbound to the CUPS page on the server.
  $iptables -A INPUT  -p tcp -s $all_hq --dport 631 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
  $iptables -A OUTPUT -p tcp -d $all_hq --sport 631 -m state --state ESTABLISHED,RELATED -j ACCEPT
  $iptables -A INPUT  -p tcp -s $all_hq --dport 631 --tcp-flags RST RST -j ACCEPT
  $iptables -A OUTPUT -p tcp -d $all_hq --sport 631 --tcp-flags RST RST -j ACCEPT

  # Internet printing protocol from clients.
  $iptables -A INPUT  -p udp -s $all_hq --dport 631 -j ACCEPT
  $iptables -A OUTPUT -p udp -d $all_hq --sport 631 -j ACCEPT

  # Bonjour/Netatalk to/from clients.
  $iptables -A INPUT  -p udp --dport mdns -d "224.0.0.251,$hq_multicast" -j ACCEPT
  $iptables -A OUTPUT -p udp --dport mdns -d "224.0.0.251,$hq_multicast" -j ACCEPT
  $iptables -A INPUT  -p igmp -d 224.0.0.251 -s $all_hq -j ACCEPT
  $iptables -A OUTPUT -p igmp -d 224.0.0.251 -j ACCEPT

  # AFP to/from clients.
  $iptables -A INPUT  -p tcp -s $all_hq --dport afpovertcp -j ACCEPT

  # SLP to/from clients.
  $iptables -A INPUT  -p tcp -s $all_hq --dport slp -j ACCEPT
  $iptables -A OUTPUT -p tcp -d $all_hq --dport slp -j ACCEPT
  $iptables -A INPUT  -p udp -s $all_hq --dport slp -j ACCEPT
  $iptables -A OUTPUT -p udp -d $all_hq --dport slp -j ACCEPT

  # AppleTalk to/from clients.
  $iptables -A INPUT  -p tcp -m multiport -s $all_hq --dport at-rtmp,at-nbp,at-echo,at-zis -j ACCEPT
  $iptables -A OUTPUT -p tcp -m multiport -d $all_hq --dport at-rtmp,at-nbp,at-echo,at-zis -j ACCEPT

  # Traffic to and from line printers. Jet Direct (port 9100) also needs SNMP
  # (161/udp).
  $iptables -A INPUT  -p tcp -m multiport -s $all_printers --sports 137,138,139,515,631,9100 -j ACCEPT
  $iptables -A OUTPUT -p tcp -m multiport -d $all_printers --dports 137,138,139,515,631,9100 -j ACCEPT
  $iptables -A INPUT  -p udp -m multiport -s $all_printers --sports 137,138,139,161,515,631,9100 -j ACCEPT
  $iptables -A OUTPUT -p udp -m multiport -d $all_printers --dports 137,138,139,161,515,631,9100 -j ACCEPT

  # Office machines trying to talk to CUPS using LPD.
  $iptables -A INPUT  -p tcp -s "$all_hq" --dport 515 -j ACCEPT
  $iptables -A OUTPUT -p tcp -d "$all_hq" --sport 515 -j ACCEPT

  # Office machines trying to talk to CUPS using SNMP (presumably to get
  # the printer's properties).
  $iptables -A INPUT  -p udp -s "$all_hq" --dport 161 -j ACCEPT
  $iptables -A OUTPUT -p udp -d "$all_hq" --sport 161 -j ACCEPT
  $iptables -A OUTPUT -p icmp -d "$all_hq" -j ACCEPT

  # Google Cloud Print. 
  # See https://github.com/google/cloud-print-connector/issues/229
  $iptables -A INPUT  -p tcp -m multiport -s "$all_hq" --dports 26000:26999 -j ACCEPT
  $iptables -A OUTPUT -p tcp -m multiport -d "$all_hq" --sport 26000:26999 -j ACCEPT
nyetwurk commented 4 years ago

Still getting "could not complete registration".

I figured after 4 years somebody would have figured it out. Guess not.