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