# $Id$ PyKota - Print Quota for CUPS and LPRng (c) 2003, 2004, 2005 Jerome Alet This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ==================================================================== How to improve PyKota's security : ---------------------------------- - Secure your printers : Tell them to refuse any print job not coming from your print server. Do this with telnet to set ACLs based on incoming IP addresses if possible, or through any other way. Put all your printers on a private unroutable subnet, different from the subnet on which your client hosts will reside. Ensure that the only machine allowed to access to this subnet is your print server. - Secure your print servers : Don't give shell access to your users on your print servers, and don't let them execute unauthorized commands : they could very well compile and/or execute tools like NetCat, and send datas directly to the printer in the case the printer is networked, thus bypassing the printing system and PyKota. Ensure that no regular user can read PyKota administrator's configuration file, but that both the PyKota Administrator and the user the printing system is run as can read it. With CUPS under Debian you may want to do : $ chown pykota.pykota pykota.conf pykotadmin.conf $ chmod 640 pykota.conf $ chmod 600 pykotadmin.conf Depending on your needs, you may want to put the user the printing system is run as in the group 'pykota', and relax permissions a bit so that this user can read the pykotadmin.conf file while printing. For example : $ chmod 640 pykotadmin.conf $ adduser lp pykota (this makes user 'lp' a member of group 'pykota') Letting any user read PyKota administrator's configuration file may expose passwords or database information which would allow write access to the database, and so may transform your print quota management in a nightmare. If you want to let users generate their own print quota reports, then ensure that /etc/pykota/pykota.conf is readable by these users. To do this you can either put this users in the group 'pykota' while ensuring they can't read pykotadmin.conf with 'chmod 600 pykotadmin.conf' or simply allow everyone to read pykota.conf with 'chmod 644 pykota.conf' - Secure your CGI scripts : If you use printquota.cgi or dumpykota.cgi, ensure that the user they are run as can read the pykota.conf file but NOT the pykotadmin.conf file. The particular user they will be run as depends on your web server's settings. If you want to further restrict the access to these CGI scripts, please read your web server's documentation to add either encryption, authentication or both. The CGI scripts will honor the content of the REMOTE_USER CGI environment variable which is set by your web server if an authentication took place. If REMOTE_USER contains 'root' then, even if you didn't authenticate using the real root account and password, the scripts will consider they have been run by a PyKota administrator and will report all datas if asked to do so. If REMOTE_USER is not present, which means that you didn't chose to secure access to your CGI scripts, the same will happen. If REMOTE_USER contains something else, only datas pertaining to this user will be made available through the web. NB : In any case, the CGI scripts actually included in PyKota only do readonly accesses to PyKota's database. - Secure your database connection : Depending on the database backend used, either PostgreSQL or OpenLDAP, you may have to take additionnal measures to render your database more secure. Please refer to your database system's documentation on configuration to learn how to do so. This is out of the scope of the present document which will only give basic informations. Keep in mind that if you use a centralized database, you may have to restrict which hosts can access to it (i.e. the Print Servers). For the PostgreSQL backend, PyKota already defines a user with read/write access and another user with read-only access to the Print Quota Database. PyKota doesn't set any passwords for these users though, but doing it is recommended, and explained elsewhere in PyKota's documentation. For the LDAP backend, you have to ensure that no regular user can write to any PyKota specific attribute or objectClass. Otherwise they could modify their quota at will. You also have to define two binding DNs in your LDAP tree, one of them should be able to have a read only access to everything. The other one should be able to write, for example your LDAP admin user is fine for this. Now put the readonly user in /etc/pykota/pykota.conf and the read-write one in /etc/pykota/pykotadmin.conf ====================================================================