1 | # $Id$ |
---|
2 | |
---|
3 | PyKota - Print Quota for CUPS |
---|
4 | |
---|
5 | (c) 2003 Jerome Alet <alet@librelogiciel.com> |
---|
6 | You're welcome to redistribute this software under the |
---|
7 | terms of the GNU General Public Licence version 2.0 |
---|
8 | or, at your option, any higher version. |
---|
9 | |
---|
10 | You can read the complete GNU GPL in the file COPYING |
---|
11 | which should come along with this software, or visit |
---|
12 | the Free Software Foundation's WEB site http://www.fsf.org |
---|
13 | |
---|
14 | ============================================================ |
---|
15 | |
---|
16 | PyKota is a complete Print Quota system for the Common Unix Printing |
---|
17 | System (aka CUPS), which works by directly querying the printers |
---|
18 | for the number of pages they have printed. |
---|
19 | |
---|
20 | Actual working features : |
---|
21 | |
---|
22 | - Per printer user quotas. |
---|
23 | |
---|
24 | - Automated email warning of users above quota to the |
---|
25 | user himself and to the print quota administrator. |
---|
26 | |
---|
27 | - CUPS filter for quota accounting : pykota |
---|
28 | |
---|
29 | - Command line print quota editor : edpykota |
---|
30 | |
---|
31 | - Command line print quota report generator : repykota |
---|
32 | |
---|
33 | - Command line print quota automated warning sender : warnpykota |
---|
34 | |
---|
35 | - Command line tools mimic the disk quota utilities for |
---|
36 | easier mastering. |
---|
37 | |
---|
38 | - Centralized storage of quotas : you can manage quotas for |
---|
39 | different printers on different print servers and store them all |
---|
40 | on the same quota storage server. |
---|
41 | WARNING : actually all your printers must have an unique name, |
---|
42 | but this may change in a future version. |
---|
43 | |
---|
44 | - SNMP querying of any networked SNMP-enabled printer. More |
---|
45 | querying methods will be implemented soon. |
---|
46 | |
---|
47 | - Special scripts included for a seamless integration of |
---|
48 | PyKota on Debian machines. |
---|
49 | |
---|
50 | All the command line tools accept the -h | --help command line option |
---|
51 | which prints all the available options and show usage examples. |
---|
52 | |
---|
53 | Planned features are described in the TODO file. |
---|
54 | |
---|
55 | Actually only the lazy quota method is implemented. What do I call |
---|
56 | lazy method ? |
---|
57 | |
---|
58 | The lazy method consists in querying the printer (actually via SNMP) |
---|
59 | for its total pages counter, just before the beginning of a job, and |
---|
60 | use this to modify the *preceding* user's quota. So you're |
---|
61 | always late of one print job, but this is generally ok, especially |
---|
62 | because a check is also done to see if the current user is allowed |
---|
63 | or not to print. |
---|
64 | |
---|
65 | Problem may arise however in batches on successive print jobs |
---|
66 | by different users when there's no sleep time between two jobs : |
---|
67 | the used pages may be attributed to incorrect user. This |
---|
68 | depends on the printer speed and time between jobs. |
---|
69 | |
---|
70 | Other querying methods which won't suffer from this problem, |
---|
71 | but probably from other ones ;-) will be implemented in the |
---|
72 | future. |
---|
73 | |
---|
74 | PyKota is known to work fine with HP Laserjet 2100 and 2200 |
---|
75 | networked printers, and should work with any SNMP-enabled |
---|
76 | network printer capable of outputing its lifetime printed pages |
---|
77 | number. |
---|
78 | |
---|
79 | ============================================================ |
---|
80 | |
---|
81 | INSTALLATION: |
---|
82 | ============= |
---|
83 | |
---|
84 | Prerequisite : |
---|
85 | -------------- |
---|
86 | |
---|
87 | You need to have the following tools installed on the CUPS Server : |
---|
88 | |
---|
89 | - CUPS |
---|
90 | - Python |
---|
91 | - eGenix' mxDateTime Python extension |
---|
92 | - PostgreSQL's PygreSQL Python extension and the PostgreSQL client |
---|
93 | libraries. |
---|
94 | - SNMP tools (specifically the snmpget command) |
---|
95 | |
---|
96 | You need to have the following tools installed on the Quota Storage |
---|
97 | Server : |
---|
98 | |
---|
99 | - PostgreSQL |
---|
100 | |
---|
101 | PygreSQL and the PostgreSQL client libraries's versions on the CUPS |
---|
102 | Server must match the PostgreSQL version used on the Quota Storage |
---|
103 | Server. |
---|
104 | |
---|
105 | Of course the CUPS Server and the Quota Storage Server can be the |
---|
106 | very same machine. |
---|
107 | |
---|
108 | This list of prerequisite software may change in the future, when |
---|
109 | PyKota will support more functionnalities you will be given |
---|
110 | alternatives. |
---|
111 | |
---|
112 | Then : |
---|
113 | ------ |
---|
114 | |
---|
115 | Download the latest PyKota version from the CVS tree on : |
---|
116 | |
---|
117 | http://savannah.nongnu.org/projects/pykota |
---|
118 | |
---|
119 | Just type : |
---|
120 | |
---|
121 | python setup.py install |
---|
122 | |
---|
123 | You may need to be logged in with sufficient privileges (e.g. root) |
---|
124 | |
---|
125 | Go to the initscripts subdirectory of PyKota's sources, and choose |
---|
126 | the appropriate storage backend for your configuration. Read |
---|
127 | the associated README file and execute the initialization script |
---|
128 | to create an empty PyKota Storage. |
---|
129 | |
---|
130 | Copy the conf/pykota.conf.sample sample configuration file to |
---|
131 | CUPS' configuration directory, usually /etc/cups, under the |
---|
132 | name pykota.conf, and adapt this file to your own needs and |
---|
133 | configuration. |
---|
134 | |
---|
135 | Modify the PPD files for each printer on which you want to manage |
---|
136 | print quotas, for example /etc/cups/ppd/lp.ppd : |
---|
137 | |
---|
138 | --- Add the line below exactly as-is somewhere near the top --- |
---|
139 | *cupsFilter: "application/vnd.cups-postscript 0 /usr/bin/pykota" |
---|
140 | --- Add the line above exactly as-is somewhere near the top --- |
---|
141 | |
---|
142 | Modify the path to the pykota executable if needed, unfortunately |
---|
143 | you have to supply the correct absolute path here due to CUPS |
---|
144 | internals, or put the pykota executable into /usr/lib/cups/filter |
---|
145 | instead of into /usr/bin. |
---|
146 | |
---|
147 | Do this for each ppd file present in this directory if you want |
---|
148 | to enable quota on every printer. |
---|
149 | |
---|
150 | Add printers and users to the quota system and set their quota values : |
---|
151 | |
---|
152 | $ edpykota --add -P printer -S softlimit -H hardlimit user1 ... userN |
---|
153 | |
---|
154 | launching edpykota without any argument or with the --help |
---|
155 | command line option will show you all the possibilities. |
---|
156 | |
---|
157 | Restart CUPS, for example under Debian GNU/Linux systems : |
---|
158 | |
---|
159 | $ /etc/init.d/cupsys restart |
---|
160 | |
---|
161 | Your users now should be able to print but not exceed their |
---|
162 | printing quota. |
---|
163 | |
---|
164 | WARNING : as of today, 2003-02-06, group quotas are not |
---|
165 | implemented. |
---|
166 | |
---|
167 | SECURITY : You should ensure that only the print quota administrator |
---|
168 | can run the warnpykota command, but this is actually not |
---|
169 | enforced in the program. Any user able to launch warnpykota |
---|
170 | could flood over-quota users' email boxes. |
---|
171 | |
---|
172 | You should ensure that only the print quota administrator |
---|
173 | can run the edpykota command, but this is actually not |
---|
174 | enforced in the program. Any user could modify his/her |
---|
175 | or other people's print quota. |
---|
176 | |
---|
177 | launching : chmod 750 /usr/bin/warnpykota /usr/bin/edpykota |
---|
178 | should make you reasonably safe. |
---|
179 | |
---|
180 | ============================================================ |
---|
181 | |
---|
182 | Please e-mail bugs to: alet@librelogiciel.com (Jerome Alet) |
---|