Author Topic: Problem sharing printers under Zentyal with CUPS.  (Read 8336 times)

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Problem sharing printers under Zentyal with CUPS.
« on: June 02, 2011, 11:58:21 am »
I'm a bit confused.
The Zentyal documentation seems to be a little bit different, please observe:

Code: [Select]
http://doc.zentyal.org/en/printers.html#printer-server-configuration-with-zentyal
At the end of the page there is a section about PDC/File sharing account when editing a user.
But the part that says "select the printers this user will have access to" is totally non existent on my Zentyal box.
So:
- Either the documentation has not been updated/corrected (now that would be sloppy) 
- I have done something wrong at setup.

The problem is that some users can print and others cannot. The CUPS error log says not authorized while they had previously been added to both cups and the Zentyal interface.
I had to change the cups interface from the Zentyal box itself because it was not possible from other machines, even after selecting "allow remote administration"
I'm sure I shared the printer. Yesterday I took a look and the selection box "share this printer" and "allow remote administration" were empty again.

Tried to edit the cupsd.conf but it gets overwritten so that's no solution.
Can someone with a little more experience shed a light on this?
I have a pretty hard time getting it to work, and the docs being different does not help either.
The cups help pages do not even touch the subject of adding users.

Cheers.
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

robb

  • Guest
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #1 on: June 02, 2011, 12:42:59 pm »
I haven't got a printserver module installed (yet) but the sharing is not part of cupsd but is relying on Samba. Maybe you can find something in the Samba logs?
« Last Edit: June 02, 2011, 12:47:54 pm by robb »

SamK

  • Zen Samurai
  • ****
  • Posts: 283
  • Karma: +3/-0
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #2 on: June 02, 2011, 05:46:50 pm »
Hi Escorpiom,

When you access the CUPS web interface (either via Zentyal or directly) and make a change such as Allow remote administration and press the Change settings button the changes are saved at a CUPS level only.

If you restart the Zentyal printing service from the main dashboard page (or do something like rebooting the machine) then everything is restarted and the configuration is reset to the default values in  /usr/share/ebox/stubs/cupsd/cupsd.conf.mas (if my memory is to be trusted).

Might this account for some of the symptoms you see?

The devs have provided a way of making changes to avoid editing such a template file:
http://blogs.zentyal.org/jacalvo/2011/01/04/how-to-customize-the-configuration-files-generated-by-zentyal/
I'm not sure how well suited it might be to your issues.
   
« Last Edit: June 02, 2011, 06:08:00 pm by SamK »

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #3 on: June 03, 2011, 01:45:25 am »
It makes sense robb, but I checked the samba logs and there is absolutely nothing that looks anywhere printer related.
The logs refer to filesharing, there are entries for the computernames, but for same strange reason the logs have all stopped at the 27 of May.
I remember having made a change to the hostname. Perhaps it borked more than I could guess.

@SamK:
That's indeed what happens, restarting the server or the CUPS service sets everything back to default.
Before editing some .mas file, how can I just share the printer on the network without having to digg deep into the server?
Samba hasn't got any option to setup or share the printer.

This is the cups access log:
Code: [Select]
192.168.1.25 - - [02/Jun/2011:09:19:58 -0500] "POST /printers/KM1820 HTTP/1.1" 200 75 windows-ext client-error-bad-request
192.168.1.25 - - [02/Jun/2011:09:20:42 -0500] "POST /printers/KM1820 HTTP/1.1" 200 88085 Print-Job client-error-not-authorized
192.168.1.25 - - [02/Jun/2011:10:30:49 -0500] "POST /printers/KM1820 HTTP/1.1" 200 75 windows-ext client-error-bad-request

Client error not authorized, but the user has been created on the system and the password is correct. BTW, I do not use Zentyal as a domain controller.
Any tips are welcome.

Wait a minute...I just found out that browsing the server there is a folder called "Printers". That's empty, but the option exists to add a printer. When selecting this option, the preselected port appears as "Samba Printer Port". Should I use that option? At the moment the printer is shared by URL, http://ip.of.zentyal.server/631/printers/KM1820
I could not find this info in the docs.
Update: Did not work. Installing the printer with the samba printer port installs the driver but at the end "access denied" pops up and the printer is not installed.
To be precise, this is one user that can print fine directly to cups.

Code: [Select]
[2011/06/02 20:46:20,  0] rpc_server/srv_spoolss_nt.c:7529(spoolss_addprinterex_level_2)
spoolss_addprinterex_level_2: add printer for printer  called and nosmb.conf parameter "addprinter command" is defined. Thisparameter must exist for this call to succeed

Another question: In the cups admin interface under "share printers connected to this system" only the cups protocol is selected. I remember that Zentyal uses LDAP to authenticate.
Could that be the reason it doesn't work?

Cheers.
« Last Edit: June 03, 2011, 11:28:09 am by Escorpiom »
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #4 on: June 04, 2011, 09:40:59 am »
Please guys, if only someone could explain me what the right method is to share a printer under Zentyal, do you use Samba or is it done through CUPS?

Cheers.
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

SamK

  • Zen Samurai
  • ****
  • Posts: 283
  • Karma: +3/-0
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #5 on: June 04, 2011, 04:09:08 pm »
That's indeed what happens, restarting the server or the CUPS service sets everything back to default.
It seems as though a permanent fix to this may be available soon.
http://trac.zentyal.org/ticket/2424


Please guys, if only someone could explain me what the right method is to share a printer under Zentyal, do you use Samba or is it done through CUPS?
The uncomfortable answer is that it can be both.

The way I picture this is:
  • CUPS sets up a print server
  • The print server is made available via Share printers connected to this system
  • A print queue for the physical printer is set up within CUPS
  • The print queue is published via Share this printer
  • If uncontrolled access to the printer is required, providing the LAN workstation is set-up accordingly both Linux and XP can use the printer at this point
  • If access to a printer is to be controlled, the print queue is not published via Share this printer, it is made available via Samba and set-up accordingly in the LAN workstation

I have used both methods but now rarely use Windows workstations, mainly Linux, so some of this is by recollection and my memory may be fallible.

I have used the document you mention:
http://doc.zentyal.org/en/printers.html#printer-server-configuration-with-zentyal
and find it to work OK.  Might you have made a slip somewhere when following it or might your system have a more fundamental problem?

I summary CUPS is always required, a print server is shared, a print queue might be shared, Samba controls access, workstations set-up accordingly.

Hope that helps.
« Last Edit: June 04, 2011, 05:39:10 pm by SamK »

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #6 on: June 05, 2011, 03:03:02 am »
Thanks Sam, it's a relief to read your message.
I have seen the bugreport and I'm also waiting for the fix. I did however apply the temporary solution in the meantime.

Indeed, access to the printer has to be based on username and password, to avoid abuse.
I found that my Zentyal setup has a slip, I'll add two pictures, one straight from the manual and another from my Zentyal box.
As you can see, in my edit-user menu tab there is no option for the printer, altough it should be there according to the manual.
   
I don't know how this happened, but I would like to have that option.

Cheers.
« Last Edit: June 05, 2011, 03:38:02 am by Escorpiom »
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

SamK

  • Zen Samurai
  • ****
  • Posts: 283
  • Karma: +3/-0
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #7 on: June 05, 2011, 10:11:00 am »
...in my edit-user menu tab there is no option for the printer, altough it should be there according to the manual.
   
I don't know how this happened, but I would like to have that option.
That is probably one for the devs.  I do not have any knowledge of how it is done.

This is really just poking in the mist...
Zentyal must pick up the information about the available printers in order to display it in the currently missing section.  Logically, this cannot be done until the printer queue has been created in CUPS.  A file /etc/cups/printers.conf appears to hold the details of the print queue.  On the tentative assumption this is the file referenced by Zentyal, is you printer listed there?
   

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #8 on: June 05, 2011, 10:46:34 am »
Well, I won't loose hope that someone from the dev team can explain the missing printer part in the web interface.

As for the printers.conf, it's there allright and these are the contents of that file:
Code: [Select]
# Printer configuration file for CUPS v1.4.3
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
<DefaultPrinter KM1820>
Info Kyocera KM-1820 Laser Printer
Location principal
MakeModel Kyocera KM-1820
DeviceURI socket://192.168.10.10
State Idle
StateTime 1307223720
Reason media-empty-warning
Type 8425540
Filter application/vnd.cups-raw 0 -
Filter application/vnd.cups-command 0 commandtops
Filter application/vnd.cups-postscript 0 -
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
AllowUser Jhon
AllowUser Martha
AllowUser Miguel
AllowUser Pedro
AllowUser Juanpa
AllowUser Dick
OpPolicy default
ErrorPolicy retry-job
Attribute marker-colors none,none
Attribute marker-levels 6,0
Attribute marker-names TK-18,Waste Toner Box
Attribute marker-types toner,wasteToner
Attribute marker-change-time 1307223714
</Printer>

But Zentyal seems totally ignorant of it's existence. It's a network printer. From the 6 users, only 2 can print. The printer's ip is on a virtual interface.
Should be no problem because Zentyal routes the traffic, I'm on another interface and thus on another subnet and printing is no problem.
But as said earlier, I've got it setup directly in cups.

Perhaps I should add, the users that cannot print do not authenticate when starting a windows session. I've set the user and password in the printer properties only.
That would be my last resort - Try to set the Windows user and pass exactly as the user created in Zentyal. Perhaps when sending the print job to the server, its mandatory to authenticate with with the windows user and pass and not with the user and pass set in the printer properties.
 
So far thanks for the help Sam, really appreciate the effort, K+.
 
Cheers.
« Last Edit: June 05, 2011, 11:15:41 am by Escorpiom »
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

SamK

  • Zen Samurai
  • ****
  • Posts: 283
  • Karma: +3/-0
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #9 on: June 05, 2011, 11:42:37 am »
As for the printers.conf, it's there allright...

Perhaps I should add, the users that cannot print do not authenticate when starting a windows session. I've set the user and password in the printer properties only.
That would be my last resort - Try to set the Windows user and pass exactly as the user created in Zentyal.
OK the queue exists and works but it is unknown whether Zentyal references that file.

Common user settings will at worst allow for greater consistency when testing.  It may not explain the cause of the missing section.

Previously you mentioned that you are trying to share via Samba in order to control access.  As 2 of the 6 users can print, how did you set-up printing via Samba for those 2 users?  What changed afterwards to prevent doing the same for the remaining 4 users?  Perhaps this might give further pointers.
   
« Last Edit: June 05, 2011, 11:47:52 am by SamK »

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #10 on: June 05, 2011, 11:58:15 am »
I shared the printer by reading the CUPS information I found on the forums. In fact, I did not touch Samba at all, as there is nothing to adjust on the Zentyal side.
It seems that CUPS is rather a separate component, installed on Ubuntu server. I share the printer by specifying the Zentyal IP and the port, like this:

Code: [Select]
http://ip.of.zentyal.server/631/printers/KM1820
I can browse the cups page just fine, view jobs and all that, but at the moment a job is sent, it gets access denied and as such, it does not show in the job list.
But in cups only the username is specified, not the password. So that raises another question: Is the password needed at all, and if yes, how does CUPS authenticate the user? Cups should in some way get that info to authenticate the user, perhaps that's the only interaction with Zentyal or Ubuntu.

I mentioned Samba because I came across the "printers" folder. This folder is always empty, I have never seen a printer there. When trying to add the printer, it asked for the driver, installed but in the end access denied again. After that I tried to install the printer as a local printer and changed the port afterwards to "Samba Printer Port". Sent a testpage but nothing happened, did not even show in the logs.

I'm pretty sure this is a bug, otherwise my Zentyal installation is borked - anyway Printer sharing through Samba is a no-go, cups works but in some cases, not all.

Cheers.
« Last Edit: June 05, 2011, 12:04:49 pm by Escorpiom »
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

SamK

  • Zen Samurai
  • ****
  • Posts: 283
  • Karma: +3/-0
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #11 on: June 05, 2011, 02:16:11 pm »
It seems that CUPS is rather a separate component, installed on Ubuntu server.
OK, just to clarify here...
CUPS and Samba are entirely separate apps.  They are often used together but this is not a requirement. 
  • CUPS is the app that provides a printing capability to both Linux and Windows machines.  User authentication may optionally be conducted.
  • Samba is the app that provides the shares to Windows LAN workstations.  To control access to the shares authentication of users is usually conducted.
  • Both may use entirely independent user databases
When using the Office profile (file and print serving), Zentyal uses both CUPS and Samba to perform the functions described above but uses a single user database (via LDAP) as a common resource.  The apps and the user info exist together in Zentyal in this scenario. It is common business practice to require control of the printing resources.  Maintaining separate user info is not normally wanted, so access control to the printers is done through Samba via the user account or group membership.  Hence, the examples shown in the Zentyal guide illustrate CUPS and Samba being used together.

I share the printer by specifying the Zentyal IP and the port, like this:

Code: [Select]
http://ip.of.zentyal.server/631/printers/KM1820
This is what I was referring to as uncontrolled access in the first 5 bullet points in reply #5.  To illustrate a little further, before posting that reply I set up an XP and a Linux stand-alone workstation.  I logged on locally to each machine, i.e. using user credentials that do not exist in the Zentyal machine.  I was able to set-up each workstation to use a print queue on Zentyal that was shared via CUPS (not shared via Samba) and did not request authentication.  Printing from the XP machine was was set-up in the same way as your KM1820.

In your /etc/cups/printers.conf  there is is a list of allowed users.  I would guess this indicates that you are trying to use CUPS to control user access i.e. not using LDAP+Samba.  I have not tried this route but can envisage that you will need to set-up and maintain independent Linux user accounts, enable PAM on Zentyal and recreate your users in order for their accounts to be correctly set-up.

If you wanted to try unauthenticated access you could try the first 5 bullet points in reply #5 without setting the allowed users in CUPS.

I'm pretty sure this is a bug...
If you believe you have found a bug you could report it here:
http://trac.zentyal.org/newticket

...otherwise my Zentyal installation is borked...
True, the cause of the missing printer section has not yet been established.
   
« Last Edit: June 05, 2011, 07:31:19 pm by SamK »

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #12 on: June 07, 2011, 12:53:42 pm »
I just tried to use the option PDC on the file sharing menu, hoping that it perhaps would include the missing printer section in the edit user menu.
It had no effect, printer part is still missing.
I will fill out a bugreport concerning the missing printer section in the user menu.
In the meantime I'll have a look at the user accounts on the windows machines to set them up to authenticate the Windows session instead of only when printing.

Cheers.

Bugreport filled in, Ticket #2982

http://trac.zentyal.org/ticket/2982
« Last Edit: June 16, 2011, 01:23:02 am by Escorpiom »
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...

Escorpiom

  • Zen Hero
  • *****
  • Posts: 897
  • Karma: +25/-1
    • View Profile
Re: Problem sharing printers under Zentyal with CUPS.
« Reply #13 on: November 17, 2011, 10:27:42 pm »
Follow up on this problem: The missing printer section is back in 2.2 so sharing is now a lot easier.
The bad: IPP protocol is broken now, have to use HP Jetdirect port 9100.
The error with IPP shows
Code: [Select]
"/usr/lib/cups/backend/http failed"
This worked just fine in 2.0.
So far 2.2 is a mix of good and bad, we got some goodies and had to trade some back in.
Cheers.
Marcus' Rule:
Blanks & capitals = avoid it and you'll avoid problems...