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