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