1 | <!-- $Id$ --> |
---|
2 | |
---|
3 | <chapter> |
---|
4 | <title id="repykota">Create print quota usage reports with repykota</title> |
---|
5 | <para>Last modified on $Date$</para> |
---|
6 | |
---|
7 | <para> |
---|
8 | To account for print usage is good, however there must be a way to easily |
---|
9 | query the <emphasis>Quota Storage Server</emphasis> and generate |
---|
10 | reports describing current usage for every user on every printer. |
---|
11 | </para> |
---|
12 | |
---|
13 | <sect1> |
---|
14 | <title>Command line based Print Quota reports</title> |
---|
15 | |
---|
16 | <para> |
---|
17 | PyKota features a quota report generator, named <application>repykota</application>, |
---|
18 | with which you can print the current state of the quota database. |
---|
19 | </para> |
---|
20 | |
---|
21 | <para> |
---|
22 | <application>repykota</application> behaves differently when it is launched by the |
---|
23 | <literal>root</literal> user, compared to when it is launched by a normal user. |
---|
24 | </para> |
---|
25 | |
---|
26 | <para> |
---|
27 | In the first case, the print quota report will contain current account balance, |
---|
28 | soft and hard limits, number of pages printed since last reset, total number |
---|
29 | of pages printed, total paid, for possibly all users or all groups, depending |
---|
30 | on command line options. |
---|
31 | </para> |
---|
32 | |
---|
33 | <para> |
---|
34 | In the second case, i.e. when <application>repykota</application> is launched by |
---|
35 | a normal user, the user will only be allowed to see informations about himself or |
---|
36 | the groups he his a member of. |
---|
37 | </para> |
---|
38 | |
---|
39 | <para> |
---|
40 | Any user can limit the report to only one or more printers, by specifying the |
---|
41 | <literal>-P</literal> or <literal>--printer</literal> command line option, |
---|
42 | followed by one or more printer name or wildcard. If more than one printer name |
---|
43 | or wildcard is used, they must be separated by commas. |
---|
44 | </para> |
---|
45 | |
---|
46 | <para> |
---|
47 | Launching <application>repykota</application> with no arguments will generate |
---|
48 | a complete print quota report, depending on what you are allowed to see. |
---|
49 | </para> |
---|
50 | |
---|
51 | <para> |
---|
52 | Use the <literal>--help</literal> command line argument to learn what are |
---|
53 | the different command line options available. |
---|
54 | </para> |
---|
55 | |
---|
56 | <sect2> |
---|
57 | <title>Reference</title> |
---|
58 | <para> |
---|
59 | <cmdsynopsis> |
---|
60 | <command>repykota</command> |
---|
61 | <group choice="opt"><arg>-v</arg><arg>--version</arg></group> |
---|
62 | <group choice="opt"><arg>-h</arg><arg>--help</arg></group> |
---|
63 | <group choice="opt"><arg>-u</arg><arg>--users</arg></group> |
---|
64 | <group choice="opt"><arg>-g</arg><arg>--groups</arg></group> |
---|
65 | <group choice="opt"> |
---|
66 | <arg>-P <replaceable>printername</replaceable></arg> |
---|
67 | <arg>--printer <replaceable>printername</replaceable></arg> |
---|
68 | </group> |
---|
69 | <group choice="opt"> |
---|
70 | <arg><replaceable>name1</replaceable></arg> |
---|
71 | <arg><replaceable>name2</replaceable></arg> |
---|
72 | <arg><replaceable>...</replaceable></arg> |
---|
73 | <arg><replaceable>nameN</replaceable></arg> |
---|
74 | </group> |
---|
75 | </cmdsynopsis> |
---|
76 | </para> |
---|
77 | </sect2> |
---|
78 | </sect1> |
---|
79 | |
---|
80 | <sect1> |
---|
81 | <title>Web based Print Quota reports</title> |
---|
82 | |
---|
83 | <para> |
---|
84 | <application>PyKota</application> also features a CGI script to remotely access |
---|
85 | to print quota reports with a web browser, it is called <filename>printquota.cgi</filename> |
---|
86 | and you can put it in your web server's <filename>cgi-bin</filename> directory if a web server is installed on |
---|
87 | any machine on which <application>PyKota</application> is also installed and configured |
---|
88 | correctly. |
---|
89 | </para> |
---|
90 | |
---|
91 | <para> |
---|
92 | You can find <filename>printquota.cgi</filename> in the <filename>pykota/cgi-bin</filename> |
---|
93 | directory. Here's how to install it, provided that your web server's <filename>cgi-bin</filename> |
---|
94 | directory is <filename>/usr/lib/cgi-bin</filename> : |
---|
95 | <screen> |
---|
96 | port50-2:/home/jerome/pykota$ cp cgi-bin/printquota.cgi /usr/lib/cgi-bin |
---|
97 | port50-2:/home/jerome/pykota$ chmod 755 /usr/lib/cgi-bin/printquota.cgi |
---|
98 | </screen> |
---|
99 | |
---|
100 | <note> |
---|
101 | <title>Note</title> |
---|
102 | <para> |
---|
103 | Please ensure that the user your web server is run as, for example <literal>www-data</literal> under |
---|
104 | Debian, is allowed to read <filename>/etc/pykota/pykota.conf</filename> but for security reasons you |
---|
105 | must ensure that this user <emphasis>is not</emphasis> allowed to read <filename>/etc/pykota/pykotadmin.conf</filename> |
---|
106 | </para> |
---|
107 | </note> |
---|
108 | </para> |
---|
109 | |
---|
110 | <para> |
---|
111 | If you install the CGI script as described above, any user will be allowed to view the complete print |
---|
112 | quota report, for all users, groups and printers. This is then a different behavior compared to when |
---|
113 | a normal user wants a print quota report from the command line through <application>repykota</application>. |
---|
114 | If you find this disturbing, then the best is to ask for user authentication whenever the <application>printquota.cgi</application> |
---|
115 | CGI script is accessed. This CGI script will then automatically behave as expected, showing in the print quota |
---|
116 | report only what the authenticated user is allowed to see, just like when he launches <application>repykota</application> |
---|
117 | from the command line. As a special case, if the user authenticates using the <literal>root</literal> username, |
---|
118 | then there's no restriction on what may appear on the print quota report. |
---|
119 | </para> |
---|
120 | |
---|
121 | <para> |
---|
122 | To automatically ask for an authentication dialog whenever the CGI script is accessed, you have to configure |
---|
123 | your web server to do so. If your webserver is <ulink url="http://httpd.apache.org"><application>Apache</application></ulink>, then it's relatively easy. First you have to put |
---|
124 | <application>printquota.cgi</application> in its own subdirectory below your web server's <filename>cgi-bin</filename> |
---|
125 | directory, for example in <filename>cgi-bin/PyKota/</filename>. Then use the <application>htpasswd</application> |
---|
126 | command line tool to create a file which contains usernames and passwords for all your users allowed to see |
---|
127 | the print quota report from a web browser, and put this file outside of the directories served by <application>Apache</application> |
---|
128 | so that nobody could retrieve it. Finally create a file named <filename>.htaccess</filename> in |
---|
129 | <filename>cgi-bin/PyKota/</filename> with appropriate content in it. This file should tell <application>Apache</application> to automatically ask |
---|
130 | for an authentication whenever something from this directory is accessed, and to use the password file previously |
---|
131 | created to match usernames and passwords. |
---|
132 | You may also have to tweak <application>Apache</application>'s default configuration to allow the |
---|
133 | authentication mechanism. |
---|
134 | </para> |
---|
135 | |
---|
136 | <para> |
---|
137 | The detailed procedure to do all this is out of the scope of the present document, please refer to |
---|
138 | <application>Apache</application>'s <ulink url="http://httpd.apache.org/docs-project/">documentation</ulink> |
---|
139 | for all the gory details. |
---|
140 | </para> |
---|
141 | </sect1> |
---|
142 | </chapter> |
---|
143 | |
---|
144 | <!-- |
---|
145 | |
---|
146 | $Log$ |
---|
147 | Revision 1.6 2003/10/12 20:47:51 jalet |
---|
148 | Doc enhanced. |
---|
149 | |
---|
150 | Revision 1.5 2003/07/25 13:10:58 jalet |
---|
151 | Improved documentation |
---|
152 | |
---|
153 | Revision 1.4 2003/04/24 21:09:47 jalet |
---|
154 | Documentation slightly improved. |
---|
155 | |
---|
156 | Revision 1.3 2003/03/25 09:32:06 jalet |
---|
157 | Improved documentation. |
---|
158 | |
---|
159 | Revision 1.2 2003/03/08 22:22:40 jalet |
---|
160 | First bit of documentation |
---|
161 | |
---|
162 | Revision 1.1 2003/02/08 00:03:35 jalet |
---|
163 | Documentation skeleton added |
---|
164 | |
---|
165 | |
---|
166 | --> |
---|