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

Revision 1147, 11.5 kB (checked in by jalet, 21 years ago)

More work on cache

  • 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 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 IS HEAVILY RECOMMANDED WITH THE LDAP BACKEND !
60#
61storagecaching: No
62
63# LDAP example, uncomment and adapt it to your own configuration :
64#storagebackend: ldapstorage
65#storageserver: ldap://ldap.librelogiciel.com:389
66#storagename: dc=librelogiciel,dc=com
67#storageuser: cn=notadmin,dc=librelogiciel,dc=com
68#storageuserpw: abc.123
69#
70# Here we define some helpers to know where
71# to plug into an existing LDAP directory
72#userbase: ou=People,dc=librelogiciel,dc=com
73#userrdn: uid
74#balancebase: ou=People,dc=librelogiciel,dc=com
75#balancerdn: uid
76#groupbase: ou=Groups,dc=librelogiciel,dc=com
77#grouprdn: cn
78#printerbase: ou=Printers,ou=PyKota,dc=librelogiciel,dc=com
79#printerrdn: cn
80#jobbase: ou=Jobs,ou=PyKota,dc=librelogiciel,dc=com
81#userquotabase: ou=UQuotas,ou=PyKota,dc=librelogiciel,dc=com
82#groupquotabase: ou=GQuotas,ou=PyKota,dc=librelogiciel,dc=com
83#lastjobbase: ou=LastJobs,ou=PyKota,dc=librelogiciel,dc=com
84#
85# How to create new accounts and groups
86# authorized values are "below" and "attach(objectclass name)"
87#
88# "below" creates the new accounts/groups as standalone entries
89# below the above defined 'userbase' ou
90#
91# attach(objectclass name) tries to find some existing user/group
92# using the above defined 'userrdn' or 'grouprdn' and 'userbase'
93# 'groupbase', and attach the PyKota specific entries to it.
94#
95# a possible value:  newuser: attach(posixAccount)
96#newuser : below
97#newgroup : below
98#
99# LDAP attribute which stores the user's email address
100#usermail : mail
101
102#
103# Choose what attribute contains the list of group members
104# common values are : memberUid, uniqueMember, member
105#groupmembers: memberUid
106
107# Where to log ?
108# supported values : stderr, system (system means syslog, but don't use 'syslog' here)
109# if the value is not set then the default SYSTEM applies.
110logger: system
111
112# Enable debugging ? Put YES instead here,
113# but only if something went wrong and you want
114# to learn from where the problem comes from.
115# Actually only database queries are logged.
116debug : No
117
118# Mail server to use to warn users
119# If the value is not set then localhost is used.
120smtpserver: localhost
121
122# What is the accounting backend to use
123#
124# supported values :
125#
126#    - querying : asks the printer for its lifetime page counter
127#                 via either SNMP, AppleTalk, or any external
128#                 command. This method is the method used by
129#                 default in PyKota since its beginning.
130#
131#    - external : delegates the job's size computation to any
132#                 external command of your choice. A stupid and
133#                 completely unreliable example, but which
134#                 shows what this command may be is :
135#
136#                   accounter: external(/bin/grep -c showpage)
137#
138#                 Another one, which should work with all DSC
139#                 compliant Postscript files :
140#
141#                   accounter: external(/bin/grep -c "%%Page:")
142#
143#    - stupid : counts the occurences of the 'showpage' postscript
144#               statement in the document to be printed.
145#               THIS IS NOT RELIABLE. This is just to serve as
146#               an example on how to implement your own accounting
147#               method.
148#
149# This value can be set either globally or on a per printer basis
150# If both are defined, the printer option has priority.
151# if not set it defaults to 'querying'.
152#
153# A script which seems to be accurate, copy it from the
154# untested/postscript directory to another place.
155# accounter: external(/usr/local/bin/pagecount.sh)
156# WARNING : it may not work when multiple copies are asked.
157#           this breaks ghostscript, I don't know why yet.
158#
159# default value
160accounter: querying
161
162# Print Quota administrator
163# These values can be set either globally or per printer or both.
164# If both are defined, the printer option has priority.
165# If these values are not set, the default admin root
166# and the default adminmail root@localhost are used.
167admin: Jerome Alet
168adminmail: alet@librelogiciel.com
169
170#
171# Who should we send an email to in case a quota is reached ?
172# possible values are : DevNull, User, Admin, Both
173# The Both value means that the User and the Admin will receive
174# an email message.
175# The DevNull value means no email message will be sent.
176# This value can be set either globally or per printer or both.
177# If both are defined, the printer option has priority.
178# If the value is not set, then the default BOTH applies.
179mailto: both
180
181#
182# Grace delay in days
183# This value can be set either globally or per printer or both.
184# If both are defined, the printer option has priority.
185# If the value is not set then the default seven (7) days applies.
186gracedelay: 7
187
188#
189# Poor man's threshold
190# If account balance reaches below this amount,
191# a warning message is sent by email
192#
193# If unset, default poor man's threshold is 1.0.
194# This option can only appear in the global section
195poorman: 2.0
196
197# Poor man's warning message
198# The warning message that is sent if the "poorman" value is reached
199# Again this must appear in the global section
200poorwarn: Your Print Quota account balance is low.
201 Soon you'll not be allowed to print anymore.
202
203# Soft limit reached warning message
204# The warning message that is sent if the soft quota limit is reached
205# May appear either globally or on a per-printer basis
206softwarn: Your Print Quota Soft Limit is reached.
207 This means that you may still be allowed to print for some
208 time, but you must contact your administrator to purchase
209 more print quota.
210 
211# Hard limit reached error message
212# The error message that is sent if the hard quota limit is reached
213# May appear either globally or on a per-printer basis
214hardwarn: Your Print Quota Hard Limit is reached.
215 This means that you are not allowed to print anymore.
216 Please contact your administrator at root@localhost
217 as soon as possible to solve the problem.
218
219# one section per printer, or no other section at all if all options
220# are defined globally.
221# Each section's name must be the same as the printer's queue name as defined
222# in your printing system, be it CUPS or LPRng.
223# If you don't want any special printer section, just comment out
224# the line below so that following options are global.
225[hpmarketing]
226
227# How to query the hpmarketing printer for its page counter.
228# THIS IS ONLY USED IF YOU HAVE SET 'accounter' TO 'querying'
229# JUST COMMENT IT OUT IF YOU USE ANY OTHER ACCOUNTING METHOD.
230# (it would be ignored anyway)
231#
232# In the lines below "%(printer)s" is automatically replaced
233# at run time with your printer's Fully Qualified Domain Name
234# e.g. myprinter.domain.com
235#
236# Only snmp(community, oid) and external(command) are supported
237#
238# Example :
239#     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 " ")
240# and :
241#     requester: snmp(public, mib-2.43.10.2.1.4.1.1)
242# are equivalent
243#
244# Another untested example, using npadmin :
245#     requester: external(/usr/bin/npadmin --pagecount %(printer)s)
246#
247# Another example, for AppleTalk printers which works fine :
248# (You may need the pap CUPS backend installed, and copy the
249# pagecount.ps file from untested/netatalk into /etc or any
250# appropriate location)
251#     requester: external(/usr/bin/pap -p "%(printer)s:LaserWriter" /etc/pagecount.ps  2>/dev/null | grep -v status | grep -v Connect | tail -1)
252#
253# This value can be set either globally or per printer or both.
254# If both are defined, the printer option has priority.
255#
256# NB : The SNMP oid mib-2.43.10.2.1.4.1.1 works on HP Laserjet Printers, but it may
257#      be different with other brands, refer to your printer's documentation
258#      for details. Also you may have to specify -v2c or -v3 depending on your
259#      printer's support for different versions of the SNMP specification.
260#
261#
262# Some examples and comments provided by Bob Martel from csuohio.edu
263#
264# For several printers I could not get the page count using snmpget.  I
265# resorted to snmpwalk:
266#
267# 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)
268#
269# The last example is still more ugly, some of the printers only provided
270# their counters without names, but at least always on the same line:
271#
272# 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)
273#
274#
275# An example using netcat and a preformatted PJL job which you can find
276# in the untested/pjl directory, which is sent to a JetDirect print
277# server on port 9100 :
278#
279# requester: external(/bin/nc -w 2 %(printer)s 9100 <pagecount.pjl | /usr/bin/tail -2)
280#
281#
282# WARNING : In any case, when using an external requester, please test the command line outside
283#           of PyKota before. This will save you some headaches in case it doesn't work as expected.
284#
285# The waitprinter.sh is there to wait until the printer is idle again.
286# This should prevent a job to be sent to the printer while another one is
287# not yet finished (not all pages are printed, but the complete job is in
288# the printer)
289requester: 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 " ")
290
291# Default policy for inexistant users (e.g. root)
292# either allow or deny
293# This value can be set either globally or per printer or both.
294# If both are defined, the printer option has priority.
295# If the value is not set then the default policy DENY applies.
296# ATTENTION :
297#     Before 1.04 the default value was ALLOW, but unknown users
298#     allowed to print causes accuracy problems : their jobs are
299#     charged to the next person who prints on the same printer.
300# There's no policy wrt inexistant groups, they are ignored.
301policy: deny
Note: See TracBrowser for help on using the browser.