root / pykota / trunk / README @ 1960

Revision 1960, 21.6 kB (checked in by jalet, 19 years ago)

Now PyKota searches its configuration files first in system user pykota's
home directory

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# $Id$
2
3PyKota - Print Quota for CUPS and LPRng
4
5(c) 2003-2004 Jerome Alet <alet@librelogiciel.com>
6This program is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2 of the License, or
9(at your option) any later version.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with this program; if not, write to the Free Software
18Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19
20====================================================================
21
22READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
23
24====================================================================
25
26PyKota features :
27-----------------
28
29    Operating systems :
30   
31        - Any Unix-like system as print server.
32           
33        - Any operating system as client.
34           
35    Printing systems :
36   
37        - Supports both CUPS and LPRng as the printing system.
38       
39    Databases :
40   
41        - Supports PostgreSQL as the Quota Storage backend.
42          Complete database creation script in SQL is included.
43       
44        - Supports any LDAP server as the Quota Storage backend.
45          Complete LDAP schema and sample empty tree are included.
46          Plugging PyKota into your existing LDAP infrastructure
47          is really easy thanks to PyKota's great configurability.
48           
49    Printers :       
50   
51        - Hardware or Software accounting methods are completely
52          configurable.
53         
54        - Supports any printer which can report its internal
55          page counter. Can ask printers for their internal
56          page counter via SNMP, Netatalk, PJL, PS, or any
57          other way.
58          This is completely configurable.
59         
60        - Supports DSC compliant and binary PostScript, PDF, PCL5 (up to),
61          PCLXL (aka PCL6) and ESC/P2 printers natively for software
62          accounting methods. More formats to come.
63           
64    Quota systems :       
65   
66        - Supports printers and printers groups quotas.
67       
68        - Supports users and users groups quotas.
69       
70        - Supports page quotas.
71          Page quotas can be set differently on a per printer
72          and per user/group basis.
73       
74        - Supports account balance quotas in any currency.
75          Account balance quotas can be set on a per user
76          basis. The account balance is shared amongst
77          all printers. The history of payments (positive
78          or negative credits to an user account) is kept.
79         
80        - Page quotas and account balance can be set/reset
81          independantly.
82         
83        - Page quotas and account balances can be set on
84          a per user or per group basis.
85         
86        - Price per page and per job can be set differently 
87          on any printer.
88       
89        - Low level of page quota or account balance are
90          configurable.
91         
92        - Both soft and hard limit with configurable grace delay 
93          can be set for page quota.
94         
95        - Possibility to disable quota enforcement for any user
96          or group, while still keeping page accounting.
97         
98        - Starting and Ending personalized dynamic banners can be
99          generated on the fly, and accounted for or not, depending
100          on some configuration settings.
101          NB : Banners are a CUPS only feature for now.
102             
103    Administration :       
104   
105        - Powerful administration tools can be used to
106          automate setting or resetting of quotas or
107          account balances at specific intervals.
108         
109        - Administration tools can modify several users, 
110          groups, or printers at once.
111         
112        - Account balances can be set, incremented, or 
113          decremented. History of payments is kept.
114         
115        - Both printers and users can be automatically added on
116          first print in a completely configurable way.
117         
118        - Quota report generator available either from the 
119          command line or in any web browser.
120          The web-based quota report generator can be
121          user/password protected.
122         
123        - Print quote generator can tell users how much 
124          a print job will cost them in advance.
125         
126        - Policy with regard to unregistered users can   
127          be configured for each printer to either deny
128          printing, allow printing, or delegate the
129          decision to any external tool.
130         
131        - Warning and error messages can be automatically 
132          sent via email to the administrator, the user,
133          both, or none.
134         
135        - Warning and error messages' content is completely
136          configurable.
137         
138        - Configuration can be changed without needing to 
139          restart the printing system.
140       
141        - Complete print job history is kept. This can be
142          disabled if needed.
143         
144        - Automated low quota or balance remainder can be
145          scheduled regularly or launched manually.
146         
147        - Powerful data dumper to export datas to other
148          software (spreadsheets for example). Actually
149          supported formats are :
150         
151            - Comma separated values ;
152           
153            - Semicolon separated values ;
154           
155            - Tab separated values ;
156           
157            - XML.
158         
159    User Interface :         
160   
161        - All the command line tools accept the -h | --help
162          command line option which prints all the available
163          options and show usage examples.
164         
165        - Completely internationalized. Actually supports the 
166          English, French, Spanish, Portuguese, Brasilian, Swedish,
167          Thai, Greek, German, Italian, Norwegian (Bokm� and
168          Turkish languages.
169          More to come.
170
171====================================================================
172       
173Planned features are described in the TODO file.
174
175Actually two (or an infinity of) page accounting methods are
176implemented :
177
178  - The 'hardware' method consists in querying the printer (via SNMP
179    or Netatalk or any other method of your choice) for its total pages
180    counter.
181   
182    This is done both at the beginning and at the end of a
183    print job. The counters difference is then immediately used to
184    decrease the user's account balance or increase his quota usage.
185   
186  - The 'software' method consists in delegating the computation of the
187    job's size in number of pages to any external command of your choice.
188    The command can read the job's data from its standard input and MUST
189    output the job's size on its standard output. Changes to the user
190    account are reported immediately.
191   
192PyKota is known to work fine with most laser printers, either with
193software accounting, or with hardware accounting if the printer
194supports this.
195
196============================================================
197
198INSTALLATION:
199=============
200
201NB :
202====
203
204  You may learn more about PyKota, if it fits your own organization,
205  its internal working, and some potential performance drawbacks and
206  how to avoid them, in a WiKi administered by Ryan Suarez at :
207 
208    http://webcrossing.macosxlabs.org/webx?14@30.QAu3a5k0c4z.7@.26bf4661
209
210  You may also find the following document interesting :
211 
212    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
213   
214  This document, written in Spanish by Sergio Gonzalez Gonzalez, 
215  describes the integration of PyKota into an OpenLDAP + Samba
216  + CUPS installation. Even for people who can't read spanish
217  this document is really interesting, and contains lots of
218  screenshots.
219 
220  Finally, SuSe users may find the following document to best describe
221  how to install PyKota on their favorite distribution. It's a Spanish
222  document written by Dennis Romero :
223 
224    http://www.cvr.espol.edu.ec/people/dennis/Pykota1.19-SuSE9.1.pdf
225 
226 
227Prerequisite :
228--------------
229   
230  You need to have the following tools installed on the CUPS Server :
231 
232    - CUPS (http://www.cups.org) or LPRng (http://www.lprng.com)
233    - Python v2.1 or above (http://www.python.org)
234    - eGenix' mxDateTime Python extension (http://www.egenix.com)
235    - The JAXML Python module to be able to dump datas in the XML format.
236      (http://www.librelogiciel.com/software/)
237    - The Python-SNMP module to query printers for their page counter.
238      (http://pysnmp.sourceforge.net)
239    - The Python-OSD module to use the graphical print quota reminder.
240    - SNMP tools (specifically the snmpget command) if you prefer to
241      use your own script to request query printers.
242    - Netatalk (specifically the pap command) if you plan to
243      request your printer's lifetime page counter via AppleTalk.
244      (http://netatalk.sourceforge.net)
245    - The ReportLab Python module (http://www.reportlab.org) if you want 
246      to have PyKota generate nice banners for you.
247    - The Python Imaging Library (aka PIL) module
248      (http://www.pythonware.com/downloads) if you want to have PyKota
249      generate nice banners for you.
250    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
251      libraries if you plan to use PostgreSQL as the Quota Storage
252      backend.
253      (http://www.postgresql.org and http://www.pygreql.org)
254 or     
255    - python-ldap Python module and the OpenLDAP client libraries 
256      if you plan to use an LDAP server as the Quota Storage backend.
257      (http://www.openldap.org and http://python-ldap.sourceforge.net)
258   
259  On Intel i386 architecture, and for performance reasons, it is
260  strongly suggested that you install the Python accelerator Psyco,
261  available at :
262 
263      http://psyco.sourceforge.net
264     
265  Under Debian :   
266 
267      $ apt-get install python-psyco
268     
269  Other architectures may be supported as well in the future, check   
270  this on Psyco's website.
271 
272  Installing Psyco is not mandatory, but it will speedup PCL5 parsing
273  by almost 3 times. PostScript and PDF parsing can also benefit,
274  but in an almost unnoticeable manner since this part of the code
275  is already optimal. For PCL5 this is a completely different matter,
276  and if you install Psyco you will never regret it !
277  Same remark applies for PCL6 (aka PCLXL) : the parser is completely
278  different, but the performance gain with Psyco is impressive.
279 
280  You may also benefit from having the following tools installed to
281  deal with some printers :
282 
283    - npadmin
284    - netcat
285    - ghostscript
286   
287  You need to have the following tools installed on the Quota Storage 
288  Server :
289 
290    - PostgreSQL (http://www.postgresql.org)
291   
292  or 
293 
294    - OpenLDAP, or any other LDAP server (http://www.openldap.org)
295   
296NB :   
297
298  PygreSQL must be linked with the PostgreSQL client libraries on
299  the Print Server. The PostgreSQL client libraries' version must
300  match the PostgreSQL version used on the Quota Storage Server.
301 
302or 
303
304  python-ldap must be linked with the OpenLDAP client libraries on the
305  Print Server. The OpenLDAP client libraries' version should match the
306  OpenLDAP version used on the Quota Storage Server, if applicable.
307 
308  This list of prerequisite software may change in the future, when
309  PyKota will support more functionnalities you will be given
310  alternatives.
311 
312  Of course the Print Server and the Quota Storage Server can be the
313  very same machine if you've got a tiny network, or you can have
314  multiple Print Servers all storing their quotas on the same Quota
315  Storage Server if you've got a bigger network.
316 
317Hint : 
318------
319
320  - The Debian GNU/Linux distribution is to our knowledge the
321    easiest distribution to install PyKota on, because all
322    of PyKota dependencies are already included, excepted
323    for the PySNMP (http://pysnmp.sourceforge.net) module
324    which for now has to be downloaded separately.
325
326Then :   
327------
328 
329Download the latest PyKota version from the CVS tree on :
330
331    http://savannah.nongnu.org/projects/pykota
332
333You can now check if the dependencies are correct by typing :
334
335    python checkdeps.py
336   
337To install the software, just type :
338
339    python setup.py install
340
341You may need to be logged in with sufficient privileges (e.g. root)
342
343Create a system user for PyKota :
344
345    adduser --system --group --gecos PyKota pykota
346   
347Put the user your printing system is run as in the pykota system group :
348
349    adduser lp pykota
350   
351    NB : on our system, the CUPS printing system runs as system user 'lp'.
352    Please adapt this to your own system.
353
354Go to the initscripts subdirectory of PyKota's sources, and choose
355the appropriate storage backend for your configuration. Read carefully
356the associated README file and execute the initialization script
357to create an empty PyKota Storage. Upgrade scripts may be
358provided as well.
359
360Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
361sample configuration files to /etc/pykota/pykota.conf and
362/etc/pykota/pykotadmin.conf 
363The installation script usually copies these files into /usr/share/pykota
364
365You need to adapt these files to your own needs. Especially you may
366have to create sections named after your own printers, and change
367the administrator's email address which by default is
368root@localhost. Read and try to understand these two very well
369commented files, so that you'll encounter less problems later.
370
371Also be sure to double check that commands that query printers
372for their internal page counter work from the command line
373before using them in PyKota's configuration.
374
375The rest of the installation depends on your printing system :
376
377  - CUPS Printing System :
378 
379    Once and for all :
380   
381        Create a symbolic link to the cupspykota backend
382        in CUPS's backend directory :
383       
384          $ cd /usr/lib/cups/backend
385          $ ln -s /usr/share/pykota/cupspykota cupspykota
386         
387        Restart CUPS so that the new backend can be detected.
388       
389          $ /etc/init.d/cupsys restart
390         
391        or :   
392     
393          $ /etc/rc.d/init.d/cupsysrestart
394         
395        or any similar command depending on your operating system. 
396         
397    For new printers :
398   
399        Go to CUPS management interface (http://localhost:631)
400        and choose the appropriate PyKota managed device depending
401        on the type of printer you use. For example, if your
402        printer is waiting on :
403       
404            socket://myprinter.example.com:9100
405           
406        Then choose :   
407       
408            cupspykota:socket://myprinter.example.com:9100
409           
410        Configure your printer as usual.   
411       
412        Now double check /etc/pykota/pykota.conf
413       
414        You should manually create a section named after the
415        printer you've just added, unless you have set
416        all options globally.
417       
418        The new pkhint command can help you with correct settings
419        for your printers, but don't rely on it because it is still
420        experimental work. To use pkhint, you have to feed it with
421        CUPS' printers.conf file this way :
422       
423          $ pkhint </etc/cups/printers.conf
424       
425        pkhint will try to tell you what is the best accounting
426        method for each printer and will print some lines you'll
427        just have to copy&paste in the appropriate sections in
428        /etc/pykota/pykota.conf
429       
430        That's all.
431   
432    For existing printers :
433   
434        If you had already installed a version of PyKota earlier
435        than 1.16alpha7, then remove the *cupsFilter lines in your
436        PPD files for each printer already managed printers. Each
437        line to remove is of the form :
438       
439          *cupsFilter: "application/vnd.cups-postscript 0 /usr/share/pykota/pykota"
440       
441        This means that each time the pstops filter will be executed, it will
442        pass the job's data through the pykota filter which is present in
443        /usr/share/pykota
444       
445        Don't touch anything else, especially any other *cupsFilter line.
446        Then save each of these files.
447       
448        Then, the easiest is to directly modify the DeviceURI lines
449        in /etc/cups/printers.conf, you just have to put
450        'cupspykota:' in front of what is already on these lines.
451        For example, replace :
452   
453            DeviceURI socket://myprinter.example.com:9100
454       
455        with :   
456   
457            DeviceURI cupspykota:socket://myprinter.example.com:9100
458           
459        or :   
460       
461            DeviceURI cupspykota://socket://myprinter.example.com:9100
462       
463        Save the file and restart CUPS.
464       
465        Here too, you may find it interesting to use the pkhint command as
466        described above to help with manual configuration of the file
467        /etc/pykota/pykota.conf
468
469  - LPRng Printing System :
470 
471    For each printer on which you want to use PyKota :
472   
473        Modify the printer's entry in /etc/printcap : you have to add
474        the three following lines :
475       
476          :achk=true:\
477          :as=/usr/share/pykota/lprngpykota:\
478          :ae=/usr/share/pykota/lprngpykota:\
479         
480        This will tell LPRng to activate accounting, and use the lprngpykota
481        accounting filter both at the start and at the end of printing.
482       
483    When all modifications are done, just save the /etc/printcap file and   
484    restart LPRng :
485   
486          $ /etc/init.d/lprng restart
487         
488        or :   
489     
490          $ /etc/rc.d/init.d/lprng restart
491         
492        or any similar command depending on your operating system. 
493       
494    NB : the pkhint command can't be used with LPRng for now, so you   
495         have to modify /etc/pykota/pykota.conf carefully. The comments
496         in this file will help you.
497     
498Now you can begin to populate the PyKota's database with printers,
499users and groups :
500 
501Add printers and users to the quota system and set their quota values :
502
503Starting from version 1.18alpha2, the preferred command to manage
504printers is named pkprinters
505
506    $ pkprinters --help
507   
508    will tell you how to create, manage or delete printers and
509    printers groups.
510   
511    $ pkprinters --add --charge 0.05 hp2100
512   
513    would add the printer named hp2100 with a price per page
514    of 0.05 unit.
515
516Now set quotas for users on this printer :     
517
518    $ edpykota --add -P hp2100 -S 40 -H 50 user1 ... userN
519       
520    launching edpykota without any argument or with the --help
521    command line option will show you all the possibilities.
522   
523    by default, each user is limited by "quota", this means that on
524    each printer he can have a different soft and hard limit.
525    You may want to limit the user by his account balance value,
526    in which case, the print quota is shared between all printers
527    instead of being different. To do this, use the following :
528   
529    $ edpykota --add -P hp2100 --limitby balance --balance 10 user1 ... userN
530   
531    This will put 10 $ (or Euros, PyKota doesn't care) on each user's account
532    balance, and tell PyKota to limit them by their account balance value.
533    Whenever they print on any printer, their account balance value is
534    decreased by an amount which depends on the particular price per page
535    and per job that you may have defined on the printer with edpykota's
536    --charge command line option.
537    Soft and Hard limits are not used if "--limitby balance" is used,
538    but you can define a "poorman"'s threshold in /etc/pykota/pykota.conf
539    to obtain a similar result (warning message when quota is low).
540
541Restart CUPS or LPRng, for example under Debian GNU/Linux systems :         
542
543    $ /etc/init.d/cupsys restart
544   
545  or :
546 
547    $ /etc/init.d/lprng restart
548       
549Your users now should be able to print but not exceed their
550printing quota.
551
552To see printer quota usage, you can use :
553
554    $ repykota --printer lp
555   
556or :
557
558    $ repykota
559   
560    which will print quota usage for all users on all printers,
561    along with totals, if you are the root user. If you are
562    a regular user, only your own quota report will be produced.
563   
564Quota reports are also available remotely by using the CGI script
565printquota.cgi provided in the cgi-bin/ subdirectory. You can
566also use the CSS stylesheet present in the stylesheets/ subdirectory
567and put it at your web server's DocumentRoot, to benefit from a nicer
568look, especially quota violations will appear in different colors.
569
570For different security concerns, please give a look at the SECURITY
571file which is part of this software.
572           
573============================================================
574
575Mailing list :
576--------------
577
578  A mailing list is dedicated to Pykota, you can subscribe to it
579  or consult its archives at :
580 
581    http://cgi.librelogiciel.com/mailman/listinfo/pykota
582   
583  The mailing list is the preferred way to obtain support, because 
584  all members can help and can also benefit from the solutions
585  proposed by other members.
586 
587  Posts by non-members are usually rejected.
588 
589  The mailing list language is english and only english.
590   
591IRC :   
592-----
593
594  You can also chat with us :
595 
596        /server irc.freenode.net
597        /join #pykota
598       
599  Preferred language on this channel is english, but french     
600  is also accepted. Try to avoid exposing complex problems
601  in french because english speaking people on the channel
602  wouldn't benefit from the solutions.
603 
604  PyKota's main author is known as 'tamere' on IRC.
605   
606============================================================
607   
608Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
609or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.