root / pykota / trunk / conf / pykota.conf.sample @ 1313

Revision 1296, 15.8 kB (checked in by jalet, 21 years ago)

Clarification wrt database caching.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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 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.
32storagebackend: pgstorage
33
34# Quota Storage Server hostname (and optional port)
35# e.g. db.mydomain.com:5432
36storageserver: localhost
37
38#
39# name of the Quota Storage Database
40storagename: 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#
51storageuser: 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#
65storagecaching: 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.
75disablehistory: 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# Here we define some helpers to know where
85# to plug into an existing LDAP directory
86#userbase: ou=People,dc=librelogiciel,dc=com
87#userrdn: uid
88#balancebase: ou=People,dc=librelogiciel,dc=com
89#balancerdn: uid
90#groupbase: ou=Groups,dc=librelogiciel,dc=com
91#grouprdn: cn
92#printerbase: ou=Printers,ou=PyKota,dc=librelogiciel,dc=com
93#printerrdn: cn
94#jobbase: ou=Jobs,ou=PyKota,dc=librelogiciel,dc=com
95#userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com
96#groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com
97#lastjobbase: ou=LastJobs,ou=PyKota,dc=librelogiciel,dc=com
98#
99# How to create new accounts and groups
100# authorized values are "below" and "attach(objectclass name)"
101#
102# "below" creates the new accounts/groups as standalone entries
103# below the above defined 'userbase' ou
104#
105# attach(objectclass name) tries to find some existing user/group
106# using the above defined 'userrdn' or 'grouprdn' and 'userbase'
107# 'groupbase', and attach the PyKota specific entries to it.
108#
109# a possible value:  newuser: attach(posixAccount)
110#newuser : below
111#newgroup : below
112#
113# LDAP attribute which stores the user's email address
114#usermail : mail
115
116#
117# Choose what attribute contains the list of group members
118# common values are : memberUid, uniqueMember, member
119#groupmembers: memberUid
120
121# Where to log ?
122# supported values : stderr, system (system means syslog, but don't use 'syslog' here)
123# if the value is not set then the default SYSTEM applies.
124logger: system
125
126# Enable debugging ? Put YES or NO there.
127# From now on, YES is the default in this sample
128# configuration file, so that debugging is activated
129# when configuring PyKota. After all works, just
130# put NO instead to save some disk space in your
131# logs.
132# Actually only database queries are logged.
133debug : Yes
134
135# Mail server to use to warn users
136# If the value is not set then localhost is used.
137smtpserver: localhost
138
139# Should we force usernames to be all lowercase when printing ?
140# Default is No.
141# This is a global option only.
142# Some people reported that WinXP sends mixed case usernames
143# setting 'utolower: Yes' solves the problem.
144# Of course you have to user lowercase only when adding
145# users with edpykota, because ALL database accesses are
146# still case sensitive.
147#
148# If utolower is Yes, the usernames received from the printing
149# system is converted to lowercase at the start of the cupspykota
150# backend or of the pykota filter.
151#
152# If utolower is No, which is the default, strict case checking
153# is done, this means that users 'Jerome' and 'jerome' are
154# different. Printer and groups names are ALWAYS case sensitive.
155utolower: No
156
157# What is the accounting backend to use
158#
159# supported values :
160#
161#    - querying : asks the printer for its lifetime page counter
162#                 via either SNMP, AppleTalk, or any external
163#                 command. This method is the method used by
164#                 default in PyKota since its beginning.
165#
166#    - external : delegates the job's size computation to any
167#                 external command of your choice. A stupid and
168#                 completely unreliable example, but which
169#                 shows what this command may be is :
170#
171#                   accounter: external(/bin/grep -c showpage)
172#
173#                 Another one, which should work with all DSC
174#                 compliant Postscript files :
175#
176#                   accounter: external(/bin/grep -c "%%Page:")
177#
178#    - stupid : counts the occurences of the 'showpage' postscript
179#               statement in the document to be printed.
180#               THIS IS NOT RELIABLE. This is just to serve as
181#               an example on how to implement your own accounting
182#               method.
183#
184# This value can be set either globally or on a per printer basis
185# If both are defined, the printer option has priority.
186# if not set it defaults to 'querying'.
187#
188# A script which seems to be accurate, copy it from the
189# untested/postscript directory to another place.
190# accounter: external(/usr/local/bin/pagecount.sh)
191# WARNING : it may not work when multiple copies are asked.
192#           this breaks ghostscript, I don't know why yet.
193#
194# default value
195accounter: querying
196
197# Print Quota administrator
198# These values can be set either globally or per printer or both.
199# If both are defined, the printer option has priority.
200# If these values are not set, the default admin root
201# and the default adminmail root@localhost are used.
202admin: John Doe
203adminmail: root@localhost
204
205#
206# Who should we send an email to in case a quota is reached ?
207# possible values are : DevNull, User, Admin, Both, External(some command)
208# The Both value means that the User and the Admin will receive
209# an email message.
210# The DevNull value means no email message will be sent.
211# This value can be set either globally or per printer or both.
212# If both are defined, the printer option has priority.
213# If the value is not set, then the default BOTH applies.
214#
215#   Format of the external syntax :
216#
217#       mailto: external(/usr/bin/mycommand >/dev/null)
218#
219#   You can use :
220#
221#       '%(action)s'            will contain either WARN or DENY
222#       '%(username)s'          will contain the user's name
223#       '%(printername)s'       will contain the printer's name
224#       '%(email)s'             will contain the user's email address
225#       '%(message)s'           will contain the message if you want
226#                               to use it.
227#
228#   On your command line, to pass arguments to your command.
229#   Example :
230#
231#       mailto: external(/usr/bin/callpager %(username)s "Quota problem on %(printername)s" >/dev/null)
232#
233#   To automatically send a WinPopup message (this may only work with a PDC,
234#   here the same machine does Samba as PDC + CUPS) :
235#
236#       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)
237#
238#   NB : I use ISO-8859-15, but Windows expects UTF-8, so we pipe the message
239#        into iconv before sending it to the Windows user.
240#
241# or more simply :
242#
243#       mailto: external(/usr/bin/mailandpopup.sh %(username)s %(printername)s "%(email)s" "%(message)s" 2>&1 >/dev/null)
244#
245#   NB : The mailandpopup.sh shell script is now included in PyKota
246#
247#   NB : in ANY case, don't forget to redirect your command's standard output
248#        somewhere (e.g. >/dev/null) so that there's no perturbation to the
249#        underlying layer (filter or backend)
250#
251mailto: both
252
253#
254# Grace delay in days
255# This value can be set either globally or per printer or both.
256# If both are defined, the printer option has priority.
257# If the value is not set then the default seven (7) days applies.
258gracedelay: 7
259
260#
261# Poor man's threshold
262# If account balance reaches below this amount,
263# a warning message is sent by email
264#
265# If unset, default poor man's threshold is 1.0.
266# This option can only appear in the global section
267poorman: 2.0
268
269# Poor man's warning message
270# The warning message that is sent if the "poorman" value is reached
271# Again this must appear in the global section
272poorwarn: Your Print Quota account balance is low.
273 Soon you'll not be allowed to print anymore.
274
275# Soft limit reached warning message
276# The warning message that is sent if the soft quota limit is reached
277# May appear either globally or on a per-printer basis
278softwarn: Your Print Quota Soft Limit is reached.
279 This means that you may still be allowed to print for some
280 time, but you must contact your administrator to purchase
281 more print quota.
282 
283# Hard limit reached error message
284# The error message that is sent if the hard quota limit is reached
285# May appear either globally or on a per-printer basis
286hardwarn: Your Print Quota Hard Limit is reached.
287 This means that you are not allowed to print anymore.
288 Please contact your administrator at root@localhost
289 as soon as possible to solve the problem.
290
291# one section per printer, or no other section at all if all options
292# are defined globally.
293# Each section's name must be the same as the printer's queue name as defined
294# in your printing system, be it CUPS or LPRng.
295# If you don't want any special printer section, just comment out
296# the line below so that following options are global.
297[hpmarketing]
298
299# How to query the hpmarketing printer for its page counter.
300# THIS IS ONLY USED IF YOU HAVE SET 'accounter' TO 'querying'
301# JUST COMMENT IT OUT IF YOU USE ANY OTHER ACCOUNTING METHOD.
302# (it would be ignored anyway)
303#
304# In the lines below "%(printer)s" is automatically replaced
305# at run time with your printer's Fully Qualified Domain Name
306# e.g. myprinter.domain.com
307#
308# Only snmp(community, oid) and external(command) are supported
309#
310# Example :
311#     requester: external(/usr/bin/snmpget -v1 -c public -Ov %(printer)s mib-2.43.10.2.1.4.1.1 | cut -f 2,2 -d " ")
312# and :
313#     requester: snmp(public, mib-2.43.10.2.1.4.1.1)
314# are equivalent
315#
316# Another untested example, using npadmin :
317#     requester: external(/usr/bin/npadmin --pagecount %(printer)s)
318#
319# Another example, for AppleTalk printers which works fine :
320# (You may need the pap CUPS backend installed, and copy the
321# pagecount.ps file from untested/netatalk into /etc or any
322# appropriate location)
323#     requester: external(/usr/bin/papwaitprinter.sh "MyPrinter:LaserWriter@*" && /usr/bin/pap -p "MyPrinter:LaserWriter@*" /etc/pagecount.ps  2>/dev/null | grep -v status | grep -v Connect | tail -1)
324#
325# This value can be set either globally or per printer or both.
326# If both are defined, the printer option has priority.
327#
328# NB : The SNMP oid mib-2.43.10.2.1.4.1.1 works on HP Laserjet Printers, but it may
329#      be different with other brands, refer to your printer's documentation
330#      for details. Also you may have to specify -v2c or -v3 depending on your
331#      printer's support for different versions of the SNMP specification.
332#
333#
334# Some examples and comments provided by Bob Martel from csuohio.edu
335#
336# For several printers I could not get the page count using snmpget.  I
337# resorted to snmpwalk:
338#
339# requester: external(/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)
340#
341# The last example is still more ugly, some of the printers only provided
342# their counters without names, but at least always on the same line:
343#
344# requester: external(/opt/local/net-snmp/bin/snmpwalk -v 1 -Cc -c public -Ov %(printer)s | grep Counter32 | tail -2 | head -1 | cut -d " " -f2)
345#
346#
347# An example using netcat and a preformatted PJL job which you can find
348# in the untested/pjl directory, which is sent to a JetDirect print
349# server on port 9100 :
350#
351# requester: external(/bin/nc -w 2 %(printer)s 9100 <pagecount.pjl | /usr/bin/tail -2)
352#
353#
354# An example using the contributed pagecount.pl script which does
355# the same as above, but should work on more printers :
356#
357# requester: external(/usr/bin/pagecount.pl %(printer)s 9100)
358#
359#
360# WARNING : In any case, when using an external requester, please test the command line outside
361#           of PyKota before. This will save you some headaches in case it doesn't work as expected.
362#
363# The waitprinter.sh is there to wait until the printer is idle again.
364# This should prevent a job to be sent to the printer while another one is
365# not yet finished (not all pages are printed, but the complete job is in
366# the printer)
367requester: external(/usr/bin/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 " ")
368
369# Default policy for inexistant users (e.g. root)
370# either allow or deny or external(some command here)
371# This value can be set either globally or per printer or both.
372# If both are defined, the printer option has priority.
373# If the value is not set then the default policy DENY applies.
374# ATTENTION :
375#     Before 1.04 the default value was ALLOW, but unknown users
376#     allowed to print causes accuracy problems : their jobs are
377#     charged to the next person who prints on the same printer.
378# There's no policy wrt inexistant groups, they are ignored.
379#
380# external policy can be used to launch any external command of your choice,
381# for example to automatically add the user to the quota storage
382# if he is unknown. Example :
383#
384#       policy: external(/usr/bin/edpykota --add --printer %(printername)s --softlimit 50 --hardlimit 60 %(username)s >/dev/null)
385#
386# Of course you can launch any command of your choice with this, e.g. :
387#
388#       policy: external(/usr/local/bin/myadminscript.sh %(username)s >/dev/null)
389
390# You can use :
391#
392#       '%(username)s'          will contain the user's name
393#       '%(printername)s'       will contain the printer's name
394#
395#   On your command line, to pass arguments to your command.
396#
397#   NB : Don't forget to redirect your command's standard output somewhere
398#        (e.g. >/dev/null) so that there's no perturbation to the underlying
399#        layer (filter or backend)
400#
401# If the user still doesn't exist after external policy command was
402# launched (the external command didn't add it), or if an error occured
403# during the execution of the external policy command, the job is rejected.
404#
405policy: deny
Note: See TracBrowser for help on using the browser.