Authentication attempts are logged using syslog, if you're using the *_ALLOW configuration directives.
Since sitemaker now uses syslog, the rest is obsolete and kept only for historical purposes. However, it is a decent way to get password-protected mysites. You should use SSL if you do that. See the Secure Site howto
Sometimes it is nice to know who has looked at what data via your 'mySites'. If some users have permissions to make changes to the data or are allowed to delete records, it is also nice to have a record of who made what changes and when. This HOWTO describes the steps required to get mySiteMaker to create log files that retain records of significant* database queries as well as the user the made them for your mySites.
* Almost all queries are considered significant. An example of an insignificant query would be one of the behind the scenes queries that are involved to populate pulldown menus with values in the edit/add new records screens.
This may seem like a lot, but it's really not that bad... Also, keep in mind that a lot of the steps mentioned here require you to be acting as root.
If you have already installed mySiteMaker then you are likely to already have mySiteMaker directories for the HTML files as well as the CGI scripts. For logging, you may choose to use the existing HTML directory, but you may wish to create a new directory. The reason for creating a new directory is because access to logging mySites is password restricted.
For example:shell> mkdir /usr/local/apache/htdocs/mySites_loggingNOTE: This directory must exist before you attempt a "logging install" of mySiteMaker. We'll get to this in a bit.
shell> chown -R nobody /usr/local/apache/htdocs/mySites_logging
shell> cd /usr/local/apache/htdocs/mySites_logging
Example .htaccess file:
AuthUserFile /usr/local/apache/htdocs/mySites_logging/.htpasswd AuthName "mySiteMaker: logging" AuthType Basic <Limit GET POST> require valid-user </Limit>
Create an .htpasswd file. (or use Nafees' Apache mod_auth_any — This tool is nice because it allows you to use any command line program to authenticate users. This can eliminate the need to generate new passwords or to keep password files synchronized.)
Creating a new .htpasswd file is easy to do once you determine the location of the Apache password generating program, "htpasswd". On some systems it might be installed in "/usr/bin/htpasswd", or it could be in "/usr/local/apache/bin/htpasswd".
If it is installed "/usr/local/apache/bin/htpasswd", then to create the .htpasswd file you will need to run the command:
shell> /usr/local/apache/bin/htpasswd -c .htpasswd new_username
if it is installed in /usr/bin, then all you'll need to do is
shell> htpasswd -c .htpasswd new_username
The '-c' option tells the 'htpasswd' program that you want to create a new password file named '.htpasswd'. Once you have created the file, you can add additional users by just specifying the password file and leaving off the '-c'. For example, once the password file is created, you can just run the command this way:
shell> htpasswd .htpasswd another_username
Where is the root CGI-BIN directory? [/home/httpd/cgi-bin/] /usr/local/apache/htdocs/mySites_logging/
Where should I store the CGI files? [/usr/local/apache/htdocs/mySites_logging/mySiteMaker/] /usr/local/apache/htdocs/mySites_logging
Where is the root HTML directory? [/home/httpd/html/] /usr/local/apache/htdocs/
Where should I store the HTML files? [/home/httpd/html/mySiteMaker/] /usr/local/apache/htdocs/mySites_logging/
We need to configure apache so that we can execute the CGI scripts in the same directory that we also want to use to serve up HTML files. To do this simply add the following lines to the end of apache's access.conf (editing the path of course).
<Directory "/usr/local/apache/htdocs/mySites_logging">
Options Indexes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Note: The option, "Indexes" listed in the "Options" list, will allow people to see all of the files in the directory if they don't specify any specific files in the URL to "mySites_logging". If you would rather this not be the case (i.e. you would rather only URLs that specify specific files be allowed, like "mySites_logging/new_site.html"), then remove the word "Indexes" from the list.
AddHandler cgi-script .cgi
Once again, depending on how your copy of apache was installed, you will either have to specify the path to the "apachectl" program like this:
shell> /usr/local/apache/bin/apachectl restartOr you will be able to restart apache like this:
shell> apachectl restart
Search for the variable "LOG_FILE" and enter in the name you want the log file to have (with a space between "LOG_FILE" and the file name.) For example:
LOG_FILE my_log.log