root / pykota / trunk / README @ 2921

Revision 2909, 27.8 kB (checked in by jerome, 18 years ago)

Updated URLs.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1# $Id$
2
3PyKota - Print Quotas for CUPS and LPRng
4
5(c) 2003, 2004, 2005, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20====================================================================
21
22READ SPECIAL LICENSING AND REDISTRIBUTION TERMS IN THE FILE 'LICENSE'
23
24====================================================================
25
26PyKota features :
27-----------------
28
29    Free Software :
30   
31        - Licensed under the terms of the GNU General Public License.
32       
33    Commercially Supported :   
34   
35        - Support Contracts are available from http://www.pykota.com/technical-support/
36       
37    Operating systems :
38   
39        - Any Unix-like system as print server.
40           
41        - Any operating system as client.
42           
43    Printing systems :
44   
45        - Supports both CUPS and LPRng as the printing system.
46          NB : LPRng is only supported with versions
47          of PyKota <= v1.22HotFix1, but support for LPRng
48          may be reintroduced at a later date.
49          This version DOES NOT support LPRng !
50       
51    Databases :
52   
53        - Supports PostgreSQL as the database backend.
54          An SQL script to create the database is included.
55       
56        - Supports any LDAP server as the database backend.
57          Complete LDAP schema and sample empty tree are included.
58          Plugging PyKota into your existing LDAP infrastructure
59          is really easy thanks to PyKota's great configurability.
60         
61        - Supports SQLite as the database backend.
62          An SQL script to create the database is included.
63         
64        - Supports MySQL as the database backend.
65          An SQL script to create the database is included.
66
67        - The print jobs history can be stored in any database 
68          of your choice (or in plain text files) if needed.
69         
70        - Master and slave databases are supported : master 
71          in read+write mode, slave in readonly mode.
72          Master and slave databases can be of different types !
73           
74    Printers :       
75   
76        - Hardware or Software accounting methods are completely
77          configurable.
78         
79        - Supports any printer which can report its internal
80          page counter. Can ask printers for their internal
81          page counter via SNMP, Netatalk, PJL, PS, or any
82          other way.
83          This is completely configurable.
84         
85        - Supports DSC compliant and binary PostScript, PDF, PCL5 (up to),
86          PCLXL (aka PCL6), ESC/P2, DVI, TIFF, OpenDocument (OpenOffice.org)
87          and Zenographics ZjStream natively (through the direct use of
88          pkpgcounter's code) for software accounting methods. More formats
89          to come.
90         
91        - Supports any other Page Description Language for which you 
92          have a parser which can be scripted.
93           
94    Quota systems :       
95   
96        - Supports printers and printers groups quotas.
97       
98        - Supports users and users groups quotas.
99       
100        - Supports page quotas.
101          Page quotas can be set differently on a per printer
102          and per user/group basis.
103       
104        - Supports account balance quotas in any currency.
105          Account balance quotas can be set on a per user
106          basis. The account balance is shared amongst
107          all printers. The history of payments (positive
108          or negative credits to an user account) is kept.
109         
110        - Supports high granularity periodic print quotas : down
111          to one minute intervals if needed.
112       
113        - Page quotas and account balance can be set/reset
114          independantly.
115         
116        - Page quotas can be set on a per user or per group basis
117          for a particular printer.
118         
119        - Price per page and per job can be set differently 
120          on any printer.
121       
122        - Low level of page quota or account balance are
123          configurable.
124         
125        - Both soft and hard limit with configurable grace delay 
126          can be set for page quota.
127         
128        - Both soft and hard limits can be increased or decreased at will. 
129       
130        - Possibility to disable quota enforcement for any user
131          or group, while still keeping page accounting.
132         
133        - Each user can have an overcharging (or undercharging) factor, 
134          which is applied whenever PyKota computes the cost of a
135          print job.
136         
137        - Specific pages and credits counters can be defined per billing code,
138          and can be reset independantly of the printing history.
139         
140        - Supports a passthrough mode for printers, which doesn't modify 
141          users quota when they print.
142         
143        - Supports a maximum number of pages per job, configurable for each 
144          printer.
145         
146        - Each user can be completely forbidden to print, independantly from
147          other users.
148         
149        - A transparent printing mode is supported for users, in which
150          their quota is not modified when they print.
151         
152    Administration :       
153   
154        - Almost turn-key solution, with the help of the pkturnkey command
155          line tool for database initialization and initial configuration.
156         
157        - Powerful delegation of administrative priviledges.
158       
159        - Powerful administration tools can be used to
160          automate setting or resetting of quotas or
161          account balances at specific intervals.
162         
163        - Administration tools can modify several users, 
164          groups, or printers at once with the use of
165          powerful wildcard characters.
166         
167        - Account balances can be set, incremented, or 
168          decremented. History of payments is kept.
169         
170        - Number of pages used can be set, incremented, or 
171          decremented.
172         
173        - Both printers and users can be automatically added on
174          first print in a completely configurable way.
175         
176        - Quota report generator available either from the 
177          command line or in any web browser.
178          The web-based quota report generator can be
179          user/password protected.
180         
181        - Print quote generator can tell users how much 
182          a print job will cost them in advance.
183         
184        - PDF invoice generator to charge back users.
185         
186        - Policy with regard to unregistered users can   
187          be configured for each printer to either deny
188          printing, allow printing, or delegate the
189          decision to any external tool.
190         
191        - Warning and error messages can be automatically 
192          sent via email or via any other mean to the administrator,
193          the user, both, or none.
194         
195        - Warning and error messages' content is completely
196          configurable.
197         
198        - Configuration can be changed without needing to 
199          restart the printing system.
200       
201        - Complete print job history is kept. This can be
202          disabled if needed.         
203         
204        - Automated low quota or balance remainder can be
205          scheduled regularly or launched manually.
206         
207        - Starting and Ending personalized dynamic banners can be
208          generated on the fly, and accounted for or not, depending
209          on some configuration settings.
210          Banners can still be enabled even if the print job is denied.
211          NB : Banners are a CUPS only feature for now.
212         
213        - Duplicate print jobs can be forbidden automatically. The decision
214          can be left to any script to decide this on a per job basis.
215         
216        - Username and billing code can be overwritten at printing time,
217          to allow people to login as guest users and print as authenticated
218          users, for example.
219         
220        - The pknotify command can now interact with remote users who run 
221          the PyKotIcon application which is distributed separately.
222         
223        - Powerful data dumper to export datas to other
224          software (spreadsheets for example). Actually
225          supported formats are :
226         
227            - Comma separated values ;
228           
229            - Semicolon separated values ;
230           
231            - Tab separated values ;
232           
233            - XML.
234           
235            - CUPS' page_log format, to easily interface in
236              real time with third party apps like phpPrintAnalyzer
237              and similar tools.
238         
239    User Interface :         
240   
241        - All the command line tools accept the -h | --help
242          command line option which prints all the available
243          options and show usage examples.
244         
245        - Completely internationalized. Actually supports at least partially
246          English, French, Polish, Spanish, Portuguese, Brazilian, Swedish,
247          Thai, Greek, German, Italian, Norwegian (Bokm�, Turkish
248          and traditional Chinese languages.
249          More to come.
250         
251        - Web enabled print quota monitor, data dumper, and quote
252          generator.
253       
254        - An On Screen Display X-Window print quota monitor is included.
255       
256        - An email gateway to allow users to retrieve their print quota
257          information by sending an email message to a dedicated address
258          is included.
259       
260        - Third party web based management tools are available.
261
262====================================================================
263       
264Planned features are described in the TODO file.
265
266Actually two (or an infinity of) page accounting methods are
267implemented :
268
269  - The 'hardware' method consists in querying the printer (via SNMP
270    or Netatalk or any other method of your choice) for its total pages
271    counter.
272    This is done both at the beginning and at the end of a
273    print job. The counters difference is then immediately used to
274    decrease the user's account balance or increase his quota usage.
275   
276  - The 'software' method consists in delegating the computation of the
277    job's size in number of pages to any external command of your choice.
278    The command can read the job's data from its standard input and MUST
279    output the job's size on its standard output. Changes to the user
280    account are reported immediately.
281   
282    PyKota featured an internal software accounting method which handles
283    several Page Description Languages : DSC compliant and binary PostScript,
284    PDF, PCLXL (aka PCL6), PCL3/4/5, ESC/P2, DVI, TIFF, OpenOffice.org Writer
285    and OpenOffice.org Impress. This software is now distributed separately
286    as 'pkpgcounter', and not included anymore in PyKota, so you must now
287    download and install it before running PyKota.
288   
289PyKota is known to work fine with most laser printers, either with
290software accounting, or with hardware accounting if the printer
291supports this.
292
293============================================================
294
295SUPPORT CONTRACTS:
296==================
297
298  You can now purchase 8x5x365@NextBusinessDay Technical
299  Support Contracts from us. The yearly fee is computed with 
300  the following formula :
301
302  (100.0 * NbPrintServers) + (2.5 * NbPrinters) + (0.04 * NbUsers) EUROS.
303 
304  This fee includes the VAT, and a free subscription to Official
305  PyKota packages.
306
307  Please send an email to alet@librelogiciel.com if you're
308  interested in purchasing such a contract.   
309
310  Remember that purchasing a support contract for Free Software like PyKota
311  is a great way to show your appreciation for the work already being done
312  on this project, and will help to improve this software in the future.
313
314============================================================
315
316INSTALLATION:
317=============
318
319NB :
320====
321
322  PyKota's documentation is available as DocBook SGML sources
323  files in the pykota/docs directory. If you obtained an
324  Official package, in the same directory you'll also find
325  the documentation in HTML and PDF formats.
326 
327  PyKota's collaborative documentation is available from :
328 
329    http://www.pykota.com/wiki/
330   
331  You may learn more about PyKota, if it fits your own organization,
332  its internal working, and some potential performance drawbacks and
333  how to avoid them, in a document created by Ryan Suarez at :
334 
335    http://archive.macosxlabs.org/forum/webcrossing_archive/documentation/Pykota_and_CUPS/Pykota_and_CUPS.html
336
337  You may also find the following document interesting :
338 
339    http://es.tldp.org/Tutoriales/doc-openldap-samba-cups-python/
340   
341  This document, written in Spanish by Sergio Gonzalez Gonzalez, 
342  describes the integration of PyKota into an OpenLDAP + Samba
343  + CUPS installation. Even for people who can't read spanish
344  this document is really interesting, and contains lots of
345  screenshots.
346 
347  Finally, SuSe users may find the following document to best describe
348  how to install PyKota on their favorite distribution. It's a Spanish
349  document written by Dennis Romero, and is mostly outdated now :
350 
351    http://www.cvr.espol.edu.ec/people/dennis/Pykota1.19-SuSE9.1.pdf
352 
353 
354Prerequisite :
355--------------
356   
357  See :
358 
359    http://www.pykota.com/wiki/Dependencies
360   
361  for an up-to-date list, or see below (maybe not up-to-date) :
362 
363  You need to have the following tools installed on the CUPS Server :
364 
365    - CUPS (http://www.cups.org)
366    - Python v2.2 or higher (http://www.python.org)
367    - eGenix' mxDateTime Python extension (http://www.egenix.com)
368    - The pkpgcounter command line tool, version 1.56 or higher. This
369      tool is now mandatory for PyKota to work.
370      (http://www.pykota.com/software/pkpgcounter)
371    - The pkipplib Python library (http://www.pykota.com/software/pkipplib) 
372    - The JAXML Python module to be able to dump datas in the XML format.
373      (http://www.librelogiciel.com/software/)
374    - The Python-PAM module if you need the pknotify command to be able 
375      to check usernames and passwords.
376    - The Python-SNMP module to query printers for their page counter.
377      (http://pysnmp.sourceforge.net).
378      IMPORTANT : version 3.4.2 or higher is REQUIRED.
379      Versions 2.x won't work. Versions 4.x now work (tested with v4.1.5a).
380    - The Python-OSD module to use the graphical print quota reminder.
381      (http://repose.cx/pyosd/)
382    - SNMP tools (specifically the snmpget command) if you prefer to
383      use your own script to request query printers.
384      (http://www.net-snmp.org)
385    - Netatalk (specifically the pap command) if you plan to
386      request your printer's lifetime page counter via AppleTalk.
387      (http://netatalk.sourceforge.net)
388    - The ReportLab Python module (http://www.reportlab.org) if you want 
389      to have PyKota generate nice banners for you.
390    - The Python Imaging Library (aka PIL) module
391      (http://www.pythonware.com/downloads) if you want to have PyKota
392      generate nice banners for you.
393    - PostgreSQL's PygreSQL Python extension and the PostgreSQL client
394      libraries if you plan to use PostgreSQL as the database backend.
395      (http://www.postgresql.org and http://www.pygreql.org)
396 or     
397    - python-ldap Python module and the OpenLDAP client libraries 
398      if you plan to use an LDAP server as the database backend.
399      (http://www.openldap.org and http://python-ldap.sourceforge.net)
400 or
401    - SQLite v3.2.7 and the SQLite libraries if you plan to use SQLite
402      as the database backend (http://www.sqlite.org). You also need the
403      PySQLite module v2.0.5 or higher (http://www.pysqlite.org)
404 or
405    - The MySQL-python bindings.
406      IMPORTANT: If you are using MySQL 4.1, then MySQL-python must be
407      version 1.2 or greater. Version 1.0 does not work correctly with 4.1.
408     
409   
410  On Intel i386 architecture, and for performance reasons, it is
411  strongly suggested that you install the Python accelerator Psyco,
412  available at :
413 
414      http://psyco.sourceforge.net
415     
416  Under Debian :   
417 
418      $ apt-get install python-psyco
419     
420  Other architectures may be supported as well in the future, check   
421  this on Psyco's website.
422 
423  Installing Psyco is not mandatory, but it will speedup PCL5 parsing
424  by almost 3 times. PostScript and PDF parsing can also benefit,
425  but in an almost unnoticeable manner since this part of the code
426  is already optimal. For PCL5 this is a completely different matter,
427  and if you install Psyco you will never regret it !
428  Same remark applies for PCL6 (aka PCLXL) : the parser is completely
429  different, but the performance gain with Psyco is impressive.
430 
431  You may also benefit from having the following tools installed to
432  deal with some printers :
433 
434    - npadmin
435    - netcat
436    - ghostscript
437   
438  You need to have the following tools installed on the database
439  server :
440 
441    - PostgreSQL (http://www.postgresql.org)
442   
443  or 
444 
445    - OpenLDAP, or any other LDAP server (http://www.openldap.org)
446   
447  or   
448 
449    - SQLite, v3.2.7 or higher (http://www.sqlite.org).
450      Beware : with SQLite the database server and the print
451      servers MUST be the very same machine.
452     
453  or     
454 
455    - MySQL 4.1 or higher.
456   
457  This list of prerequisite software may change in the future, when
458  PyKota will support more functionnalities you will be given
459  alternatives.
460 
461  Of course the Print Server and the database server can be the
462  very same machine if you've got a tiny network, or you can have
463  multiple Print Servers all storing their quotas on the same database
464  server if you've got a bigger network. (NB : with SQLite, the database
465  can't be shared between several print servers)
466 
467Hint : 
468------
469
470  - The Debian GNU/Linux distribution is to our knowledge the
471    easiest distribution to install PyKota on, because all
472    of PyKota dependencies are already included, excepted
473    for the PySNMP (http://pysnmp.sourceforge.net) module
474    and the pkpgcounter utility which for now have to be downloaded
475    and installed separately.
476
477Then :   
478------
479 
480Download the latest PyKota version from the Subversion tree :
481
482    $ svn co svn://svn.librelogiciel.com/pykota/trunk pykota
483
484You can now check if the dependencies are correct by typing :
485
486    $ python checkdeps.py
487   
488    An availability report for all the software needed by PyKota
489    will be displayed : you'll have to install the missing
490    software if you want PyKota to work correctly.
491   
492To install the software, just type :
493
494    $ python setup.py install
495
496You may need to be logged in with sufficient privileges (e.g. root)
497
498Create a system user for PyKota :
499
500    $ adduser --system --group --home /etc/pykota --gecos PyKota pykota
501   
502Put the user your printing system is run as in the pykota system group :
503
504    $ adduser lp pykota
505   
506    NB : on our system, the CUPS printing system runs as system user 'lp'.
507    Please adapt this to your own system.
508
509Go to the initscripts subdirectory of PyKota's sources, and choose
510the appropriate storage backend for your configuration. Read carefully
511the associated README file and execute the initialization script
512to create an empty PyKota database. Upgrade scripts may be
513provided as well. NB : if you use PostgreSQL, a good way to
514make PyKota work first time is to modify PostgreSQL's pg_hba.conf
515to allow the 'trust' database connection mode. However once PyKota
516works it is HIGHLY RECOMMENDED TO CHANGE THIS TO A MORE SECURE
517VALUE.
518
519Copy the conf/pykota.conf.sample and  conf/pykotadmin.conf.sample
520sample configuration files to /etc/pykota/pykota.conf and
521/etc/pykota/pykotadmin.conf 
522The installation script usually copies these files into /usr/share/pykota
523
524NB : You can move PyKota's configuration files elsewhere, they will
525be searched first in user pykota's home directory.
526
527You need to adapt these files to your own needs. Especially you may
528have to create sections named after your own printers, and change
529the administrator's email address which by default is
530root@localhost. Read and try to understand these two very well
531commented files, so that you'll encounter less problems later.
532
533Also be sure to double check that commands that query printers
534for their internal page counter work from the command line
535before using them in PyKota's configuration.
536
537The rest of the installation depends on your printing system :
538
539  - CUPS Printing System :
540 
541    Once and for all :
542   
543        Create a symbolic link to the cupspykota backend
544        in CUPS's backend directory :
545       
546          $ cd /usr/lib/cups/backend
547          $ ln -s /usr/share/pykota/cupspykota cupspykota
548         
549        Restart CUPS so that the new backend can be detected.
550       
551          $ /etc/init.d/cupsys restart
552         
553        or :   
554     
555          $ /etc/rc.d/init.d/cupsys restart
556         
557        or any similar command depending on your operating system. 
558         
559    For new printers :
560   
561        Go to CUPS management interface (http://localhost:631)
562        and choose the appropriate PyKota managed device depending
563        on the type of printer you use. For example, if your
564        printer is waiting on :
565       
566            socket://myprinter.example.com:9100
567           
568        Then choose :   
569       
570            cupspykota:socket://myprinter.example.com:9100
571           
572        Configure your printer as usual.   
573       
574        Now double check /etc/pykota/pykota.conf
575       
576        You should manually create a section named after the
577        printer you've just added, unless you have set
578        all options globally.
579       
580        The new pkturnkey command can help you with correct settings
581        for your printers, but don't rely on it because it is still
582        experimental work. To have pkturnkey give you some hints
583        about what to put into pykota.conf, just use its --doconf
584        command line switch :
585       
586          $ pkturnkey --doconf
587       
588        pkturnkey will try to tell you what is the best accounting
589        method for each printer and will print some lines you'll
590        just have to copy&paste in the appropriate sections in
591        /etc/pykota/pykota.conf
592       
593        For more informations about what pkturnkey can do for you,
594        see pkturnkey's manual page or use the --help command
595        line switch :
596       
597          $ pkturnkey --help | less
598       
599        That's all.
600   
601    For existing printers :
602   
603        The easiest is to directly modify the DeviceURI lines
604        in /etc/cups/printers.conf, you just have to put
605        'cupspykota:' in front of what is already on these lines.
606        For example, replace :
607   
608            DeviceURI socket://myprinter.example.com:9100
609       
610        with :   
611   
612            DeviceURI cupspykota:socket://myprinter.example.com:9100
613           
614        or :   
615       
616            DeviceURI cupspykota://socket://myprinter.example.com:9100
617       
618        Save the file and restart CUPS.
619       
620        Here too, you may find it interesting to use the pkturnkey command as
621        described above to help with manual configuration of the file
622        /etc/pykota/pykota.conf
623
624  - LPRng Printing System :
625 
626    IMPORTANT : This release of PyKota DOES NOT support LPRng.
627   
628    If you want to use PyKota with LPRng, you have to download
629    an earlier release of PyKota, for example v1.22HotFix1.
630       
631Now you can begin to populate the PyKota's database with printers,
632users and groups :
633 
634Add printers and users to the quota system and set their quota values :
635
636You can either use pkturnkey, or do the same things manually by
637using the pkprinters, pkusers and edpykota command line tools :
638
639Create printers :
640
641    $ pkprinters --help
642   
643    will tell you how to create, manage or delete printers and
644    printers groups.
645   
646    $ pkprinters --add --charge 0.05 hp2100
647   
648    would add the printer named hp2100 with a price per page
649    of 0.05 unit.
650
651Create users :
652
653    $ pkusers --add --limitby balance --balane 10.0 jerome
654   
655    would create user jerome and give him ten credits to spend
656    on any printer.
657   
658Finally create print quota entries :
659
660    $ edpykota --add -P hp2100 jerome
661       
662    This will create a print quota entry for user jerome on   
663    printer hp2100. The print quota entry holds the number of
664    pages printed on a particular printer for a particular
665    user, as well as optional page limits to be used instead
666    of balance limits. See pkusers and edpykota's manual
667    pages for details.
668   
669Restart CUPS, for example under Debian GNU/Linux systems :         
670
671    $ /etc/init.d/cupsys restart
672   
673Your users now should be able to print but not exceed their
674printing quota.
675
676To see printer quota usage on printer hp2100, you can use :
677
678    $ repykota --printer hp2100
679   
680or :
681
682    $ repykota
683   
684    which will print quota usage for all users on all printers,
685    along with totals, if you are a PyKota Administator. If you are
686    a regular user, only your own quota report will be produced.
687   
688Quota reports are also available remotely by using the CGI script
689printquota.cgi provided in the cgi-bin/ subdirectory. You can
690also use the CSS stylesheet present in the stylesheets/ subdirectory
691and put it at your web server's DocumentRoot, to benefit from a nicer
692look, especially quota violations will appear in different colors.
693
694For additionnal security concerns, please give a look at the SECURITY
695file which is part of this software.
696
697To diagnose a problem when something doesn't work as expected,
698please read the very first entry in the FAQ document.
699           
700============================================================
701
702Additionnal tools :
703-------------------
704
705Some people have developped tools around PyKota, and make
706them available under the GNU General Public License :
707
708  - Kanakorn Horsiritham developped phpPykotaAdmin which is
709    a web based database independant administrative GUI,
710    written in PHP.
711 
712      http://opensource.psu.ac.th/~kanakorn/mambo/
713     
714    He was also kind enough to write an installation guide 
715    in english for CUPS and PyKota with phpPykotaAdmin on Fedora
716    Core 3. You'll find this document on the same website.
717   
718    This great software currently at version 0.3 is a wonderful
719    basis for an administrative GUI since it only depends on
720    PyKota commands to be present to successfully manage
721    PyKota's database.
722 
723Additionnal software will be listed here when they will be 
724ready.
725
726============================================================
727
728Mailing list :
729--------------
730
731  A mailing list is dedicated to Pykota, you can subscribe to it
732  or consult its archives at :
733 
734    http://cgi.librelogiciel.com/mailman/listinfo/pykota
735   
736  The mailing list is the preferred way to obtain support, because 
737  all members can help and can also benefit from the solutions
738  proposed by other members.
739 
740  Posts by non-members are usually rejected.
741 
742  The mailing list language is english and only english.
743   
744IRC :   
745-----
746
747  You can also chat with us :
748 
749        /server irc.freenode.net
750        /join #pykota
751       
752  Preferred language on this channel is english, but french     
753  is also accepted. Try to avoid exposing complex problems
754  in french because english speaking people on the channel
755  wouldn't benefit from the solutions.
756 
757  PyKota's main author is known as 'tamere' on IRC.
758   
759============================================================
760   
761Please e-mail bugs to the mailing list at : pykota@librelogiciel.com
762or to the main author at : alet@librelogiciel.com (Jerome Alet)
Note: See TracBrowser for help on using the browser.