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