1 | # PyKota sample configuration file |
---|
2 | # |
---|
3 | # Copy this file into the /etc/pykota/ directory |
---|
4 | # under the name /etc/pykota/pykota.conf |
---|
5 | # |
---|
6 | # PyKota - Print Quotas for CUPS and LPRng |
---|
7 | # |
---|
8 | # (c) 2003, 2004, 2005 Jerome Alet <alet@librelogiciel.com> |
---|
9 | # This program is free software; you can redistribute it and/or modify |
---|
10 | # it under the terms of the GNU General Public License as published by |
---|
11 | # the Free Software Foundation; either version 2 of the License, or |
---|
12 | # (at your option) any later version. |
---|
13 | # |
---|
14 | # This program is distributed in the hope that it will be useful, |
---|
15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | # GNU General Public License for more details. |
---|
18 | # |
---|
19 | # You should have received a copy of the GNU General Public License |
---|
20 | # along with this program; if not, write to the Free Software |
---|
21 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
---|
22 | # |
---|
23 | # $Id$ |
---|
24 | # |
---|
25 | |
---|
26 | [global] |
---|
27 | # Storage backend for quotas |
---|
28 | # only PGStorage (PostgreSQL) and LDAPStorage (OpenLDAP) are supported. |
---|
29 | # MySQL and BerkeleyDB are planned. |
---|
30 | |
---|
31 | # the 'postgresql' value is deprecated, use 'pgstorage' instead. |
---|
32 | storagebackend: pgstorage |
---|
33 | |
---|
34 | # Quota Storage Server hostname (and optional port) |
---|
35 | # e.g. db.example.com:5432 |
---|
36 | storageserver: localhost |
---|
37 | |
---|
38 | # |
---|
39 | # name of the Quota Storage Database |
---|
40 | storagename: pykota |
---|
41 | |
---|
42 | # |
---|
43 | # Quota Storage normal user's name and password |
---|
44 | # These two fields contain a username and optional password |
---|
45 | # which may give readonly access to your print quota database. |
---|
46 | # |
---|
47 | # PLEASE ENSURE THAT THIS USER CAN'T WRITE TO YOUR PRINT QUOTA |
---|
48 | # DATABASE, OTHERWISE ANY USER WHO COULD READ THIS CONFIGURATION |
---|
49 | # FILE COULD CHANGE HIS PRINT QUOTA. |
---|
50 | # |
---|
51 | storageuser: pykotauser |
---|
52 | # storageuserpw: Comment out if unused, or set to Quota Storage user password |
---|
53 | |
---|
54 | # Should the database caching mechanism be enabled or not ? |
---|
55 | # If unset, caching is disabled. Possible values Y/N/YES/NO |
---|
56 | # caching mechanism works with both PostgreSQL and OpenLDAP backends |
---|
57 | # but may be really interesting only with OpenLDAP. |
---|
58 | # |
---|
59 | # ACTIVATING CACHE MAY CAUSE PRECISION PROBLEMS IN PRINT ACCOUNTING |
---|
60 | # IF AN USER PRINTS ON SEVERAL PRINTERS AT THE SAME TIME. |
---|
61 | # YOU MAY FIND IT INTERESTING ANYWAY, ESPECIALLY FOR LDAP. |
---|
62 | # |
---|
63 | # FYI, I ALWAYS SET IT TO YES ! |
---|
64 | # |
---|
65 | storagecaching: No |
---|
66 | |
---|
67 | # Should full job history be disabled ? |
---|
68 | # If unset or set to No, full job history is kept in the database. |
---|
69 | # This will be useful in the future when the report generator |
---|
70 | # will be written. |
---|
71 | # Disabling the job history can be useful with heavily loaded |
---|
72 | # LDAP servers, to not make the LDAP tree grow out of control. |
---|
73 | # Disabling the job history with the PostgreSQL backend works too |
---|
74 | # but it's probably less useful than with LDAP. |
---|
75 | disablehistory: No |
---|
76 | |
---|
77 | # LDAP example, uncomment and adapt it to your own configuration : |
---|
78 | #storagebackend: ldapstorage |
---|
79 | #storageserver: ldap://ldap.librelogiciel.com:389 |
---|
80 | #storagename: dc=librelogiciel,dc=com |
---|
81 | #storageuser: cn=notadmin,dc=librelogiciel,dc=com |
---|
82 | #storageuserpw: abc.123 |
---|
83 | # |
---|
84 | # TLS support for LDAP |
---|
85 | # |
---|
86 | # ldaptls can be set to either Yes or No |
---|
87 | # the default value when not set is No, meaning that TLS won't be used. |
---|
88 | #ldaptls: No |
---|
89 | # |
---|
90 | # cacert points to the CA Certificate file to use for TLS. |
---|
91 | # Ensure that every user who can launch PyKota commands can read this file. |
---|
92 | # There's NO default value for this directive. |
---|
93 | #cacert /etc/pykota/mycertfile |
---|
94 | # |
---|
95 | # |
---|
96 | # Here we define some helpers to know where |
---|
97 | # to plug into an existing LDAP directory |
---|
98 | #userbase: ou=People,dc=librelogiciel,dc=com |
---|
99 | #userrdn: uid |
---|
100 | #balancebase: ou=People,dc=librelogiciel,dc=com |
---|
101 | #balancerdn: uid |
---|
102 | #groupbase: ou=Groups,dc=librelogiciel,dc=com |
---|
103 | #grouprdn: cn |
---|
104 | #printerbase: ou=Printers,ou=PyKota,dc=librelogiciel,dc=com |
---|
105 | #printerrdn: cn |
---|
106 | #jobbase: ou=Jobs,ou=PyKota,dc=librelogiciel,dc=com |
---|
107 | #lastjobbase: ou=LastJobs,ou=PyKota,dc=librelogiciel,dc=com |
---|
108 | |
---|
109 | # These two fields are special, they either accept a branch |
---|
110 | # dn, like an ou for example, or the special keywords 'user' |
---|
111 | # and 'group'. If 'user' or 'group' is used, the print quota |
---|
112 | # entries will be created below the user or group entry itself, |
---|
113 | # which will then be used like a branch (you can mix and match |
---|
114 | # different values depending on what you want to do). |
---|
115 | #userquotabase: user |
---|
116 | #userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com |
---|
117 | #groupquotabase: group |
---|
118 | #groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com |
---|
119 | |
---|
120 | # |
---|
121 | # How to create new accounts and groups |
---|
122 | # authorized values are "below" and "attach(objectclass name [, fail|warn])" |
---|
123 | # |
---|
124 | # "below" creates the new accounts/groups as standalone entries |
---|
125 | # below the above defined 'userbase' ou |
---|
126 | # |
---|
127 | # attach(objectclass name [, action]) tries to find some existing user/group |
---|
128 | # using the above defined 'userrdn' or 'grouprdn' and 'userbase' |
---|
129 | # 'groupbase', and attach the PyKota specific entries to it. |
---|
130 | # if action is "warn" and no entry exists to attach to, a new |
---|
131 | # entry is created, and a message is logged. |
---|
132 | # if action is "fail" and no entry exists to attach to, program |
---|
133 | # logs an error message and aborts. |
---|
134 | # if action is not set, the default value is "fail". |
---|
135 | # |
---|
136 | # a possible value: newuser: attach(posixAccount, warn) |
---|
137 | #newuser : below |
---|
138 | #newgroup : below |
---|
139 | # |
---|
140 | # LDAP attribute which stores the user's email address |
---|
141 | #usermail : mail |
---|
142 | |
---|
143 | # |
---|
144 | # Choose what attribute contains the list of group members |
---|
145 | # common values are : memberUid, uniqueMember, member |
---|
146 | #groupmembers: memberUid |
---|
147 | |
---|
148 | # Activate low-level LDAP cache yes/no |
---|
149 | # Nothing to do with "storagecaching" which is higher level |
---|
150 | # and database independant. |
---|
151 | # This saves some search queries and may help with heavily |
---|
152 | # loaded LDAP servers. |
---|
153 | # This is EXPERIMENTAL. |
---|
154 | # |
---|
155 | # BEWARE : SETTING THIS TO 'YES' CAUSES PROBLEMS FOR NOW |
---|
156 | # BETTER TO LET IT SET TO 'NO' |
---|
157 | # ldapcache: no |
---|
158 | |
---|
159 | # Where to log ? |
---|
160 | # supported values : stderr, system (system means syslog, but don't use 'syslog' here) |
---|
161 | # if the value is not set then the default SYSTEM applies. |
---|
162 | logger: system |
---|
163 | |
---|
164 | # Enable debugging ? Put YES or NO there. |
---|
165 | # From now on, YES is the default in this sample |
---|
166 | # configuration file, so that debugging is activated |
---|
167 | # when configuring PyKota. After all works, just |
---|
168 | # put NO instead to save some disk space in your |
---|
169 | # logs. |
---|
170 | # Actually only database queries are logged. |
---|
171 | debug : Yes |
---|
172 | |
---|
173 | # Mail server to use to warn users |
---|
174 | # If the value is not set then localhost is used. |
---|
175 | smtpserver: localhost |
---|
176 | |
---|
177 | # Crash messages' recipient : in addition to the log files |
---|
178 | # each software crash can be sent to the author of PyKota |
---|
179 | # or any other person of your choice. By default this |
---|
180 | # is disabled. The recipient pykotacrashed@librelogiciel.com |
---|
181 | # reaches PyKota's author. |
---|
182 | # The 'adminmail' (defined a bit below) is CCed. |
---|
183 | # |
---|
184 | # Privacy concerns : what is sent is only : |
---|
185 | # |
---|
186 | # - a copy of the software's traceback |
---|
187 | # - a copy of the software's command line arguments |
---|
188 | # - a copy of the software's environment variables |
---|
189 | # |
---|
190 | # suggested value |
---|
191 | # crashrecipient: pykotacrashed@librelogiciel.com |
---|
192 | |
---|
193 | # Email domain |
---|
194 | # If the value is not set, and the mail attribute for the user |
---|
195 | # is not set in the PyKota storage, be it LDAP (see usermail directive |
---|
196 | # above) or PostgreSQL, then email messages are sent to |
---|
197 | # username@smtpserver |
---|
198 | # |
---|
199 | # If the value is set, then email messages are sent to |
---|
200 | # username@maildomain using the SMTP server defined above |
---|
201 | # |
---|
202 | # Set the appropriate value below, example.com set as per RFC2606. |
---|
203 | maildomain: example.com |
---|
204 | |
---|
205 | # Should we force usernames to be all lowercase when printing ? |
---|
206 | # Default is No. |
---|
207 | # This is a global option only. |
---|
208 | # Some people reported that WinXP sends mixed case usernames |
---|
209 | # setting 'utolower: Yes' solves the problem. |
---|
210 | # Of course you have to use lowercase only when adding |
---|
211 | # users with edpykota, because ALL database accesses are |
---|
212 | # still case sensitive. |
---|
213 | # |
---|
214 | # If utolower is Yes, the usernames received from the printing |
---|
215 | # system is converted to lowercase at the start of the cupspykota |
---|
216 | # backend or of the lprngpykota filter. |
---|
217 | # |
---|
218 | # If utolower is No, which is the default, strict case checking |
---|
219 | # is done, this means that users 'Jerome' and 'jerome' are |
---|
220 | # different. Printer and groups names are ALWAYS case sensitive. |
---|
221 | utolower: No |
---|
222 | |
---|
223 | # Should we split usernames on a specific separator when printing ? |
---|
224 | # Default is No, i.e. if the value is unset. |
---|
225 | # This is a global option only. |
---|
226 | # This option adds support for Samba's Winbind utility, which |
---|
227 | # prefixes usernames with domain name and separator character. |
---|
228 | # Of course if you set this then you have to use NO separator when |
---|
229 | # adding users with edpykota. |
---|
230 | # |
---|
231 | # If winbind_separator is set, the usernames received from the printing |
---|
232 | # system are split on the separator's value, and only the last part |
---|
233 | # (real username) is used. |
---|
234 | # |
---|
235 | # If winbind_separator is not set, which is the default, strict |
---|
236 | # username equality checking will be done (modulo the setting |
---|
237 | # of the 'utolower' directive), this means that users 'DOMAIN1/jerome', |
---|
238 | # 'Domain2/jerome' and 'jerome' are different. |
---|
239 | # winbind_separator: / |
---|
240 | |
---|
241 | # When creating users or groups accounts, should we reject users |
---|
242 | # or groups which are unknown from the system ? |
---|
243 | # The default if unset is NO. This means that by default, you |
---|
244 | # can create users or groups for which `getent passwd username` |
---|
245 | # or `getent group groupname` returns nothing. |
---|
246 | # |
---|
247 | # Allowed values : Yes | No |
---|
248 | # Default value : No |
---|
249 | # |
---|
250 | # reject_unknown: No |
---|
251 | |
---|
252 | # Do we want to hide jobs' title, filename and options for privacy |
---|
253 | # reasons ? |
---|
254 | # This may be required in some countries (Italy comes to mind). |
---|
255 | # Allowed values are YES and NO. |
---|
256 | # If unset, the default value is NO, meaning that jobs' title, filename |
---|
257 | # and options will be saved into the history. |
---|
258 | # This option can't be set on a per printer basis, only into the |
---|
259 | # [global] section. |
---|
260 | privacy : no |
---|
261 | |
---|
262 | # What is the accounting backend to use |
---|
263 | # |
---|
264 | # supported values : |
---|
265 | # |
---|
266 | # - hardware : asks the printer for its lifetime page counter |
---|
267 | # via either SNMP, AppleTalk, or any external |
---|
268 | # command. This method is the recommended one |
---|
269 | # in PyKota since its beginning. |
---|
270 | # |
---|
271 | # In the lines below "%(printer)s" is automatically replaced |
---|
272 | # at run time with your printer's Fully Qualified Domain Name |
---|
273 | # for network printers, if PyKota can extract it from its |
---|
274 | # environment. |
---|
275 | # e.g. myprinter.example.com |
---|
276 | # |
---|
277 | # Recommended values : |
---|
278 | # |
---|
279 | # accounter: hardware(snmp) |
---|
280 | # |
---|
281 | # Extracts the printer's internal page counter via SNMP. |
---|
282 | # |
---|
283 | # Or : |
---|
284 | # |
---|
285 | # accounter: hardware(pjl) |
---|
286 | # |
---|
287 | # Extracts the printer's internal page counter via PJL queries over port tcp/9100. |
---|
288 | # |
---|
289 | # Other Examples : |
---|
290 | # |
---|
291 | # accounter: hardware(/usr/bin/snmpget -v1 -c public -Ov %(printer)s mib-2.43.10.2.1.4.1.1 | cut -f 2,2 -d " ") |
---|
292 | # |
---|
293 | # Another untested example, using npadmin : |
---|
294 | # |
---|
295 | # accounter: hardware(/usr/bin/npadmin --pagecount %(printer)s) |
---|
296 | # |
---|
297 | # Another example, for AppleTalk printers which works fine : |
---|
298 | # (You may need the pap CUPS backend installed, and copy the |
---|
299 | # pagecount.ps file from untested/netatalk into /etc or any |
---|
300 | # appropriate location) |
---|
301 | # |
---|
302 | # accounter: hardware(/usr/share/pykota/papwaitprinter.sh "MyPrinter:LaserWriter@*" && /usr/bin/pap -p "MyPrinter:LaserWriter@*" /usr/share/pykota/pagecount.ps 2>/dev/null | /bin/grep -v status | /bin/grep -v Connect | /usr/bin/tail -1) |
---|
303 | # |
---|
304 | # An example for parallel printers like the HP Laserjet 5MP : |
---|
305 | # |
---|
306 | # accounter: hardware(/bin/cat /usr/share/pykota/pagecount.pjl >/dev/lp0 && /usr/bin/head -2 </dev/lp0 | /usr/bin/tail -1) |
---|
307 | # |
---|
308 | # This value can be set either globally or per printer or both. |
---|
309 | # If both are defined, the printer option has priority. |
---|
310 | # |
---|
311 | # Some examples and comments provided by Bob Martel from csuohio.edu |
---|
312 | # |
---|
313 | # For several printers I could not get the page count using snmpget. I |
---|
314 | # resorted to snmpwalk: |
---|
315 | # |
---|
316 | # accounter: hardware(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public %(printer)s | grep mib-2.43.10.2.1.4.1.1 | cut -d " " -f4) |
---|
317 | # |
---|
318 | # The last example is still more ugly, some of the printers only provided |
---|
319 | # their counters without names, but at least always on the same line: |
---|
320 | # |
---|
321 | # accounter: hardware(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public -Ov %(printer)s | grep Counter32 | tail -2 | head -1 | cut -d " " -f2) |
---|
322 | # |
---|
323 | # An example using netcat and a preformatted PJL job which you can find |
---|
324 | # in the untested/pjl directory, which is sent to a JetDirect print |
---|
325 | # server on port 9100 : |
---|
326 | # |
---|
327 | # accounter: hardware(/bin/nc -w 2 %(printer)s 9100 </usr/share/pykota/pagecount.pjl | /usr/bin/tail -2) |
---|
328 | # |
---|
329 | # An example using the contributed pagecount.pl script which does |
---|
330 | # the same as above, but should work on more printers : |
---|
331 | # |
---|
332 | # accounter: hardware(LC_ALL=C /usr/share/pykota/pagecount.pl %(printer)s 9100) |
---|
333 | # |
---|
334 | # NB : the LC_ALL=C is used because sometimes Perl can correctly set locale and is verbose |
---|
335 | # about it, causing PyKota to miss the correct answer. |
---|
336 | # |
---|
337 | # WARNING : In any case, when using an hardware accounter, please test the command line outside |
---|
338 | # of PyKota before. This will save you some headaches in case it doesn't work as expected. |
---|
339 | # |
---|
340 | # The waitprinter.sh is there to wait until the printer is idle again. |
---|
341 | # This should prevent a job to be sent to the printer while another one is |
---|
342 | # not yet finished (not all pages are printed, but the complete job is in |
---|
343 | # the printer) |
---|
344 | # |
---|
345 | # YOU ABSOLUTELY HAVE TO BE SURE YOU HAVE A SCRIPT WHICH WAITS FOR THE |
---|
346 | # PRINTER BEING READY BEFORE ASKING FOR ITS INTERNAL PAGE COUNTER. |
---|
347 | # |
---|
348 | # PYKOTA INCLUDES SUCH SCRIPTS FOR SNMP AND APPLETALK PRINTERS, MORE TO COME |
---|
349 | # |
---|
350 | # SOME OF THE ABOVE EXAMPLES DON'T USE SUCH A SCRIPT, YOU HAVE BEEN WARNED |
---|
351 | # |
---|
352 | # |
---|
353 | # WITH THE SPECIAL MAGIC hardware(snmp) AND hardware(pjl) VALUES, PYKOTA |
---|
354 | # TAKES CARE OF ALL THIS FOR YOU, SO PLEASE UNDERSTAND THAT IT IS PREFERABLE |
---|
355 | # TO USE THESE TWO METHODS : THEY WORK FINE, REQUIRE LITTLE TO NO CPU, |
---|
356 | # AND DO ALL THE HARD WORK AUTOMATICALLY. IF YOU REALLY NEED TO YOU CAN USE |
---|
357 | # YOUR OWN EXTERNAL COMMANDS AS DESCRIBED ABOVE, JUST BE CAREFUL WITH THIS. |
---|
358 | # |
---|
359 | # |
---|
360 | # - software : delegates the job's size computation to any |
---|
361 | # external command of your choice. |
---|
362 | # |
---|
363 | # best choice for this is probably to set it |
---|
364 | # this way : |
---|
365 | # |
---|
366 | # accounter: software() |
---|
367 | # |
---|
368 | # which uses PyKota's internal parser to compute |
---|
369 | # the size of the job. |
---|
370 | # |
---|
371 | # You could obtain exactly the same result with : |
---|
372 | # |
---|
373 | # accounter: software(/usr/bin/pkpgcounter) |
---|
374 | # |
---|
375 | # But in this case the job would be passed through |
---|
376 | # PyKota's internal parser a second time. |
---|
377 | # |
---|
378 | # pkpgcounter is a command line tool which is |
---|
379 | # part of PyKota and which can handle both |
---|
380 | # DSC compliant or binary PostScript, PCL5, PCL6 (aka PCLXL) |
---|
381 | # and PDF documents. More file formats will be added |
---|
382 | # in the future, as time permits. |
---|
383 | # |
---|
384 | # while pkpgcounter is the recommended value if you want |
---|
385 | # to use an external command here, you can use whatever |
---|
386 | # command you want provided your command accepts the job's |
---|
387 | # data on its standard input and prints the job's size in |
---|
388 | # pages as a single integer on its standard output. |
---|
389 | # |
---|
390 | # This value can be set either globally or on a per printer basis |
---|
391 | # If both are defined, the printer option has priority. |
---|
392 | # |
---|
393 | # accounter: hardware(/usr/share/pykota/waitprinter.sh %(printer)s && /usr/bin/snmpget -v1 -c public -Ov %(printer)s mib-2.43.10.2.1.4.1.1 | cut -f 2,2 -d " ") |
---|
394 | # accounter: hardware(snmp) |
---|
395 | # accounter: hardware(pjl) |
---|
396 | # accounter: software(/usr/bin/pkpgcounter) |
---|
397 | # |
---|
398 | # The following is only allowed since PyKota 1.21 |
---|
399 | accounter: software() |
---|
400 | |
---|
401 | # What should we do if the accounter's subprocess doesn't return |
---|
402 | # a valid result (for example doesn't return an integer on its stdout) |
---|
403 | # |
---|
404 | # Valid values are : 'continue' and 'stop'. 'stop' is the default |
---|
405 | # if unset. |
---|
406 | # |
---|
407 | # 'continue' means try to process as usual, this may introduce |
---|
408 | # accounting errors and free jobs. This was the default behavior |
---|
409 | # until v1.20alpha5. |
---|
410 | # |
---|
411 | # 'stop' means fail and stop the print queue. If an accounter |
---|
412 | # error occurs, most of the time this is a misconfiguration, so |
---|
413 | # stopping the print queue is usually the better thing to do |
---|
414 | # until the admin has fixed the configuration. |
---|
415 | # |
---|
416 | # This value can be set either globally or on a per printer basis |
---|
417 | # If both are defined, the printer option has priority. |
---|
418 | # |
---|
419 | # NB : This directive shouldn't do much now because in case |
---|
420 | # of external accounter error, PyKota just loops. |
---|
421 | # |
---|
422 | # onaccountererror: continue |
---|
423 | onaccountererror: stop |
---|
424 | |
---|
425 | # Print Quota administrator |
---|
426 | # These values can be set either globally or per printer or both. |
---|
427 | # If both are defined, the printer option has priority. |
---|
428 | # If these values are not set, the default admin root |
---|
429 | # and the default adminmail root@localhost are used. |
---|
430 | admin: John Doe |
---|
431 | adminmail: root@localhost |
---|
432 | |
---|
433 | # |
---|
434 | # Who should we send an email to in case a quota is reached ? |
---|
435 | # possible values are : DevNull, User, Admin, Both, External(some command) |
---|
436 | # The Both value means that the User and the Admin will receive |
---|
437 | # an email message. |
---|
438 | # The DevNull value means no email message will be sent. |
---|
439 | # This value can be set either globally or per printer or both. |
---|
440 | # If both are defined, the printer option has priority. |
---|
441 | # If the value is not set, then the default BOTH applies. |
---|
442 | # |
---|
443 | # Format of the external syntax : |
---|
444 | # |
---|
445 | # mailto: external(/usr/bin/mycommand >/dev/null) |
---|
446 | # |
---|
447 | # You can use : |
---|
448 | # |
---|
449 | # '%(action)s' will contain either WARN or DENY |
---|
450 | # '%(username)s' will contain the user's name |
---|
451 | # '%(printername)s' will contain the printer's name |
---|
452 | # '%(email)s' will contain the user's email address |
---|
453 | # '%(message)s' will contain the message if you want |
---|
454 | # to use it. |
---|
455 | # |
---|
456 | # On your command line, to pass arguments to your command. |
---|
457 | # Example : |
---|
458 | # |
---|
459 | # mailto: external(/usr/bin/callpager %(username)s "Quota problem on %(printername)s" >/dev/null) |
---|
460 | # |
---|
461 | # To automatically send a WinPopup message (this may only work with a PDC, |
---|
462 | # here the same machine does Samba as PDC + CUPS) : |
---|
463 | # |
---|
464 | # mailto: external(echo "%(message)s" | /usr/bin/iconv --to-code utf-8 --from-code iso-8859-15 | /usr/bin/smbclient -M "%(username)s" 2>&1 >/dev/null) |
---|
465 | # |
---|
466 | # NB : I use ISO-8859-15, but Windows expects UTF-8, so we pipe the message |
---|
467 | # into iconv before sending it to the Windows user. |
---|
468 | # |
---|
469 | # or more simply : |
---|
470 | # |
---|
471 | # mailto: external(/usr/share/pykota/mailandpopup.sh %(username)s %(printername)s "%(email)s" "%(message)s" 2>&1 >/dev/null) |
---|
472 | # |
---|
473 | # NB : The mailandpopup.sh shell script is now included in PyKota |
---|
474 | # |
---|
475 | # NB : in ANY case, don't forget to redirect your command's standard output |
---|
476 | # somewhere (e.g. >/dev/null) so that there's no perturbation to the |
---|
477 | # underlying layer (filter or backend) |
---|
478 | # |
---|
479 | mailto: both |
---|
480 | |
---|
481 | # |
---|
482 | # Grace delay in days |
---|
483 | # This value can be set either globally or per printer or both. |
---|
484 | # If both are defined, the printer option has priority. |
---|
485 | # If the value is not set then the default seven (7) days applies. |
---|
486 | gracedelay: 7 |
---|
487 | |
---|
488 | # |
---|
489 | # Poor man's threshold |
---|
490 | # If account balance reaches below this amount, |
---|
491 | # a warning message is sent by email |
---|
492 | # |
---|
493 | # If unset, default poor man's threshold is 1.0. |
---|
494 | # This option can only appear in the global section |
---|
495 | poorman: 2.0 |
---|
496 | |
---|
497 | # Poor man's warning message |
---|
498 | # The warning message that is sent if the "poorman" value is reached |
---|
499 | # Again this must appear in the global section |
---|
500 | poorwarn: Your Print Quota account balance is low. |
---|
501 | Soon you'll not be allowed to print anymore. |
---|
502 | |
---|
503 | # Soft limit reached warning message |
---|
504 | # The warning message that is sent if the soft quota limit is reached |
---|
505 | # May appear either globally or on a per-printer basis |
---|
506 | softwarn: Your Print Quota Soft Limit is reached. |
---|
507 | This means that you may still be allowed to print for some |
---|
508 | time, but you must contact your administrator to purchase |
---|
509 | more print quota. |
---|
510 | |
---|
511 | # Hard limit reached error message |
---|
512 | # The error message that is sent if the hard quota limit is reached |
---|
513 | # May appear either globally or on a per-printer basis |
---|
514 | hardwarn: Your Print Quota Hard Limit is reached. |
---|
515 | This means that you are not allowed to print anymore. |
---|
516 | Please contact your administrator at root@localhost |
---|
517 | as soon as possible to solve the problem. |
---|
518 | |
---|
519 | # one section per printer, or no other section at all if all options |
---|
520 | # are defined globally. |
---|
521 | # Each section's name must be the same as the printer's queue name as defined |
---|
522 | # in your printing system, be it CUPS or LPRng, between square brackets, for |
---|
523 | # example a print queue named 'hpmarketing' would appear in this file as |
---|
524 | # [hpmarketing] |
---|
525 | |
---|
526 | |
---|
527 | # Default policy to apply when either : |
---|
528 | # |
---|
529 | # - Printer doesn't exist in PyKota's database |
---|
530 | # - User doesn't exist in PyKota's database |
---|
531 | # - User has no quota entry for this Printer in PyKota's database |
---|
532 | # |
---|
533 | # Value can be either allow or deny or external(some command here) |
---|
534 | # |
---|
535 | # This value can be set either globally or per printer or both. |
---|
536 | # If both are defined, the printer option has priority. |
---|
537 | # If the value is not set then the default policy DENY applies. |
---|
538 | # There's no policy wrt inexistant groups, they are ignored. |
---|
539 | # |
---|
540 | # external policy can be used to launch any external command of your choice, |
---|
541 | # for example to automatically add the user to the quota storage |
---|
542 | # if he is unknown. Example : |
---|
543 | # |
---|
544 | # policy: external(/usr/bin/edpykota --add --printer %(printername)s --softlimit 50 --hardlimit 60 %(username)s >/dev/null) |
---|
545 | # |
---|
546 | # NB : If you want to limit users by their account balance value, it is preferable to |
---|
547 | # use the following policy to automate user account creation on first print : |
---|
548 | # |
---|
549 | # policy: external(/usr/bin/autopykota --initbalance 25.0 >/dev/null) |
---|
550 | # |
---|
551 | # This will automatically add the user if he doesn't already exist, and |
---|
552 | # set his initial balance value to 25.0 (for example). If the user already |
---|
553 | # exists then his balance value will not be modified. |
---|
554 | # Please don't use autopykota if you want to limit your users by page |
---|
555 | # quota, and in any case, carefully read autopykota's help or manpage |
---|
556 | # and understand its goal before using it in your own configuration. |
---|
557 | # |
---|
558 | # Of course you can launch any command of your choice with this, e.g. : |
---|
559 | # |
---|
560 | # policy: external(/usr/local/bin/myadminscript.sh %(username)s >/dev/null) |
---|
561 | |
---|
562 | # You can use : |
---|
563 | # |
---|
564 | # '%(username)s' will contain the user's name |
---|
565 | # '%(printername)s' will contain the printer's name |
---|
566 | # |
---|
567 | # On your command line, to pass arguments to your command. |
---|
568 | # |
---|
569 | # NB : Don't forget to redirect your command's standard output somewhere |
---|
570 | # (e.g. >/dev/null) so that there's no perturbation to the underlying |
---|
571 | # layer (filter or backend) |
---|
572 | # |
---|
573 | # If the printer, user, or user quota entry still doesn't exist after |
---|
574 | # external policy command was launched (the external command didn't add it), |
---|
575 | # or if an error occured during the execution of the external policy |
---|
576 | # command, then the job is rejected. |
---|
577 | # |
---|
578 | policy: deny |
---|
579 | |
---|
580 | # Pre and Post Hooks |
---|
581 | # These directives allow the easy plug-in of any command of your choice |
---|
582 | # at different phases of PyKota's execution. |
---|
583 | # Pre and Post Hooks can access some of PyKota's internal information |
---|
584 | # by reading environment variables as described below. |
---|
585 | # The actual phase of PyKota's execution is available in the |
---|
586 | # PYKOTAPHASE environment variable. |
---|
587 | # Pre and Post Hooks can be defined either globally, per printer, |
---|
588 | # or both. If both are defined, the printer specific hook has |
---|
589 | # priority. |
---|
590 | # |
---|
591 | # List of available environment variables : |
---|
592 | # NB : Most of these variables are also available during the execution |
---|
593 | # of external commands defined in the accounter and mailto |
---|
594 | # directives. |
---|
595 | # |
---|
596 | # PYKOTAMD5SUM : Contains an hexadecimal digest of the md5 sum of the job's datas |
---|
597 | # PYKOTAPHASE : BEFORE or AFTER the job is sent to the printer |
---|
598 | # PYKOTAACTION : ALLOW or DENY or WARN for current print job |
---|
599 | # PYKOTAUSERNAME : user's name |
---|
600 | # PYKOTAPRINTERNAME : printer's name |
---|
601 | # PYKOTAPGROUPS : list of printers groups the current printer is a member of |
---|
602 | # PYKOTAJOBID : job's id |
---|
603 | # PYKOTATITLE : job's title |
---|
604 | # PYKOTAFILENAME : job's filename |
---|
605 | # PYKOTACOPIES : number of copies |
---|
606 | # PYKOTAOPTIONS : job's options |
---|
607 | # PYKOTABALANCE : user's account balance |
---|
608 | # PYKOTALIFETIMEPAID : user's grand total paid |
---|
609 | # PYKOTALIMITBY : user print limiting factor, for example 'quota' or 'balance' |
---|
610 | # PYKOTAPAGECOUNTER : user's page counter on this printer |
---|
611 | # PYKOTALIFEPAGECOUNTER : user's life time page counter on this printer |
---|
612 | # PYKOTASOFTLIMIT : user's soft page limit on this printer |
---|
613 | # PYKOTAHARDLIMIT : user's hard page limit on this printer |
---|
614 | # PYKOTADATELIMIT : user's soft to hard limit date limit on this printer |
---|
615 | # PYKOTASTATUS : contains "CANCELLED" when SIGTERM was received by PyKota |
---|
616 | # else is not set. |
---|
617 | # PYKOTAJOBSIZEBYTES : contains the job's size in bytes. Always available. |
---|
618 | # PYKOTAPRECOMPUTEDJOBSIZE : contains the precomputed job's size |
---|
619 | # PYKOTAPRECOMPUTEDJOBPRICE : contains the precomputed job's price |
---|
620 | # PYKOTAJOBORIGINATINGHOSTNAME : contains the client's hostname if |
---|
621 | # it is possible to retrieve it. |
---|
622 | # PYKOTAPRINTERHOSTNAME : the printer's hostname or IP address for network |
---|
623 | # printers, or "localhost" if not defined or not |
---|
624 | # meaningful. |
---|
625 | # PYKOTAWARNCOUNT : the number of times the user was forbidden to print but a banner |
---|
626 | # page was still printed on the current printer. |
---|
627 | # PYKOTAOVERCHARGE : user's overcharging factor. |
---|
628 | # |
---|
629 | |
---|
630 | # PreHook : gets executed after being sure the user, printer and user quota |
---|
631 | # entry on the printer both exist in the PyKota database, and after |
---|
632 | # checking if the user is allowed to print or not, but just before |
---|
633 | # the job is sent to the printer (if allowed) |
---|
634 | # prehook has access to many environment variables : |
---|
635 | # |
---|
636 | # PYKOTAACTION contains either "ALLOW", "WARN" or "DENY" and |
---|
637 | # represents the action which is to be done wrt the print job. |
---|
638 | # PYKOTAPHASE contains 'BEFORE' during execution of prehook |
---|
639 | # |
---|
640 | # uncomment the line below to see what environment variables are available |
---|
641 | # prehook: /usr/bin/printenv >/tmp/before |
---|
642 | |
---|
643 | # PostHook : gets executed after the job has been added to the history. |
---|
644 | # posthook has access to all the environment variables defined above, |
---|
645 | # as well as two additionnal environment variables : PYKOTAJOBPRICE |
---|
646 | # and PYKOTAJOBSIZE. |
---|
647 | # PYKOTAPHASE contains 'AFTER' during execution of posthook. |
---|
648 | # |
---|
649 | # uncomment the line below to see what environment variables are available |
---|
650 | # posthook: /usr/bin/printenv >/tmp/after |
---|
651 | |
---|
652 | # AccountBanner : how should banner accounting be done ? |
---|
653 | # |
---|
654 | # NB : CUPS ONLY FOR NOW ! |
---|
655 | # |
---|
656 | # If enabled, banner pages printed from StartingBanner and/or EndingBanner |
---|
657 | # (depending on the value) will be included in the accounting for the |
---|
658 | # print job |
---|
659 | # |
---|
660 | # If disabled, banner pages printed from StartingBanner and EndingBanner will |
---|
661 | # *not* be included in the accounting for the print job |
---|
662 | # |
---|
663 | # IMPORTANT : CUPS generated banners are ALWAYS accounted for, although you |
---|
664 | # can refund them by using negative prices on printers. |
---|
665 | # |
---|
666 | # Allowed values : Starting | Ending | None | Both |
---|
667 | # |
---|
668 | # - Starting : only the starting banner will be accounted for. |
---|
669 | # - Ending : only the ending banner will be accounted for. |
---|
670 | # - Both : both starting and ending banners will be accounted for. |
---|
671 | # - None : banners will not be accounted for. |
---|
672 | # |
---|
673 | # Default value : |
---|
674 | # accountbanner: Both |
---|
675 | |
---|
676 | # Maximal number of times the banner will still be printed if |
---|
677 | # the user is forbidden to print. |
---|
678 | # |
---|
679 | # NB : CUPS ONLY FOR NOW ! |
---|
680 | # |
---|
681 | # This option can be set either globally or on a per printer basis. |
---|
682 | # Allowed values are 0 or any positive integer. |
---|
683 | # Default value is 0, which means that the banner won't be printed |
---|
684 | # at all if the user is forbidden to print. |
---|
685 | maxdenybanners: 0 |
---|
686 | |
---|
687 | # StartingBanner : if defined will print a banner before the rest of the job |
---|
688 | # is printed. The argument can be a printable file, or an executable file. |
---|
689 | # If not executable, the file will be printed as is. If executable, the |
---|
690 | # file will be executed and its output will be printed. |
---|
691 | # |
---|
692 | # NB : CUPS ONLY FOR NOW ! |
---|
693 | # |
---|
694 | # In any case, the banner content which will be sent to the printer |
---|
695 | # MUST be in a format your printer will accept !!! |
---|
696 | # |
---|
697 | # The pkbanner command included in PyKota can automatically generate |
---|
698 | # starting and ending banners in the PostScript format. You can use |
---|
699 | # this command in a pipe through GhostScript if your printer doesn't |
---|
700 | # accept PostScript as an input format. |
---|
701 | # NB : pkbanner's default page size is A4 |
---|
702 | # |
---|
703 | # startingbanner: /home/joe/mystaticbanner.ps |
---|
704 | # startingbanner: /usr/bin/pkbanner --pagesize=A4 --logo="/home/joe/mylogo.jpeg" --url="http://tech.example.com" |
---|
705 | # startingbanner: /usr/bin/pkbanner | gs -q -dNOPAUSE -dBATCH -dPARANOIDSAFER -sOutputFile=- -sDEVICE=lj5mono - |
---|
706 | # startingbanner: /usr/bin/pkbanner |
---|
707 | |
---|
708 | # EndingBanner : if defined will print a banner before the rest of the job |
---|
709 | # is printed. The argument can be a printable file, or an executable file. |
---|
710 | # If not executable, the file will be printed as is. If executable, the |
---|
711 | # file will be executed and its output will be printed. |
---|
712 | # |
---|
713 | # NB : CUPS ONLY FOR NOW ! |
---|
714 | # |
---|
715 | # In any case, the banner content which will be sent to the printer |
---|
716 | # MUST be in a format your printer will accept !!! |
---|
717 | # |
---|
718 | # The pkbanner command included in PyKota can automatically generate |
---|
719 | # starting and ending banners in the PostScript format. You can use |
---|
720 | # this command in a pipe through GhostScript if your printer doesn't |
---|
721 | # accept PostScript as an input format. |
---|
722 | # NB : pkbanner's default page size is A4 |
---|
723 | # |
---|
724 | # endingbanner: /home/joe/mystaticbanner.ps |
---|
725 | # endingbanner: /usr/bin/pkbanner --pagesize=A4 --logo="/home/joe/mylogo.jpeg" --url="http://tech.example.com" |
---|
726 | # endingbanner: /usr/bin/pkbanner | gs -q -dNOPAUSE -dBATCH -dPARANOIDSAFER -sOutputFile=- -sDEVICE=lj5mono - |
---|
727 | # endingbanner: /usr/bin/pkbanner |
---|
728 | |
---|
729 | # How should enforcement be done for this printer ? |
---|
730 | # |
---|
731 | # "laxist" is the default if value is not set, and allows users |
---|
732 | # to be over quota on their last job. |
---|
733 | # |
---|
734 | # "strict" tries to prevent users from ever being over quota. |
---|
735 | # |
---|
736 | # Enforcement can be defined either globally, per printer, |
---|
737 | # or both. If both are defined, the printer specific enforcement |
---|
738 | # setting has priority. |
---|
739 | # |
---|
740 | # valid values : "strict" or "laxist" |
---|
741 | # |
---|
742 | # default value |
---|
743 | # enforcement : laxist |
---|
744 | enforcement : strict |
---|
745 | |
---|
746 | # Should we trust the job size on this printer ? |
---|
747 | # |
---|
748 | # "yes" is the default, the jobsize, either computed |
---|
749 | # by the hardware or by software is trusted. |
---|
750 | # |
---|
751 | # ">N:precomputed" : uses the precomputed value if jobsize > N pages |
---|
752 | # ">N:25" : uses 25 if jobsize is >N pages |
---|
753 | # |
---|
754 | # General form : ">n:m" where n is a positive integer, and m is |
---|
755 | # either the word 'precomputed' or a positive integer. |
---|
756 | # The special form "yes" is also accepted and is the default. |
---|
757 | # |
---|
758 | # This directive can be set either globally or on a per printer |
---|
759 | # basis. Use this directive when hardware accounting for a particular |
---|
760 | # printer produces some glitches due to the printer returning |
---|
761 | # incorrect answers. |
---|
762 | # |
---|
763 | # NB : DON'T MODIFY THIS IF YOU DON'T NEED TO. THIS IS ONLY TO BE USED |
---|
764 | # AS A WORKAROUND FOR SOME PRINTERS. IT'S PROBABLY BETTER TO ALWAYS |
---|
765 | # SET THIS DIRECTIVE TO 'yes'. THIS DIRECTIVE WILL ONLY BE HONORED |
---|
766 | # IF PYKOTA DETECTS A DIFFERENCE BETWEEN THE PRECOMPUTED JOB SIZE |
---|
767 | # AND THE JOB SIZE AS COMPUTED BY PYKOTA EITHER USING HARDWARE OR |
---|
768 | # SOFTWARE. |
---|
769 | trustjobsize : yes |
---|
770 | |
---|
771 | # Should we deny duplicate jobs ? |
---|
772 | # |
---|
773 | # A duplicate is a job sent twice (or more) in a row to the same printer |
---|
774 | # by the same user. |
---|
775 | # |
---|
776 | # This can be defined either globally or on a per printer basis |
---|
777 | # The default value is 'no', meaning that duplicate jobs are |
---|
778 | # allowed. |
---|
779 | # |
---|
780 | # NB : if an user prints a job, a second user prints another |
---|
781 | # job, and the first user prints the first job again, |
---|
782 | # this is NOT considered as a duplicate since the two |
---|
783 | # identical jobs printed by the first user are not |
---|
784 | # one just after the other. |
---|
785 | # |
---|
786 | # Possible values are 'yes' and 'no' |
---|
787 | # |
---|
788 | denyduplicates : no |
---|