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