You are here

README.txt in Secure Site 8

Same filename in this branch
  1. 8 README.txt
  2. 8 digest_md5/README.txt
Same filename and directory in other branches
  1. 6.2 digest_md5/README.txt
  2. 7.2 digest_md5/README.txt
Digest authentication avoids transmitting passwords by exchanging character
strings (digests) that prove both the user and the Web server know the password.
This requires passwords for all users to be stored on the server. It is very
important to ensure that these passwords cannot be exposed to unauthorized
users. Web pages should be able to store passwords without being able to
retrieve them.

The scripts in this directory can handle stored passwords securely when properly
set up. There are two scripts in this directory:

stored_passwords.php: Add, delete, and update user passwords.
digest_md5.php: Perform digest authentication.

You can get help for these scripts by typing the script name followed by
"--help" on the command line. You must be able to run PHP from the command line.
Some configuration is required to make the scripts work properly:

1. Set up a secure database
---------------------------

You can set up a password database in the same way you create a Drupal database.
Your password database should have its own user. No other database users should
have access to the password database.

2. Edit the configuration file
------------------------------

Configuration settings for the scripts are in digest_md5.conf.php. You must set
$db_url to point to your password database. If you want to be able to use the
scripts from the command-line or non-Drupal Web pages, you must set $drupal to
the absolute path of your Drupal installation. When you are done editing the
configuration file, make it read-only.

3. Control access to the scripts
--------------------------------

The first thing you can do secure the scripts is to move this directory to a
location that is not accessible from the Internet. The configuration file
especially needs protection, because it contains information that allows access
to the password database.

If the sudo command is available on your system, you can change the file system
permissions on the all the files in the digest_md5 directory so that only
adminstrators have access to them. You would then add the user your Web server
runs as to the sudoers file. A sample sudoers file is provided in this directory
for comparison. The important lines are

  Defaults:apache	!authenticate
  Defaults:apache	!lecture
  apache	ALL=/usr/local/digest_md5/stored_passwords.php [A-z]*
  apache	ALL=/usr/local/digest_md5/digest_md5.php [A-z]*

This allows apache to use sudo only to run stored_passwords.php and
digest_md5.php. Replace apache with the name of the Web server user on your
system, and replace /usr/local/digest_md5 with the directory in which this file
is located.

If the rest of your system is secure, Web pages can now store passwords without
having the ability to retrieve them.

File

digest_md5/README.txt
View source
  1. Digest authentication avoids transmitting passwords by exchanging character
  2. strings (digests) that prove both the user and the Web server know the password.
  3. This requires passwords for all users to be stored on the server. It is very
  4. important to ensure that these passwords cannot be exposed to unauthorized
  5. users. Web pages should be able to store passwords without being able to
  6. retrieve them.
  7. The scripts in this directory can handle stored passwords securely when properly
  8. set up. There are two scripts in this directory:
  9. stored_passwords.php: Add, delete, and update user passwords.
  10. digest_md5.php: Perform digest authentication.
  11. You can get help for these scripts by typing the script name followed by
  12. "--help" on the command line. You must be able to run PHP from the command line.
  13. Some configuration is required to make the scripts work properly:
  14. 1. Set up a secure database
  15. ---------------------------
  16. You can set up a password database in the same way you create a Drupal database.
  17. Your password database should have its own user. No other database users should
  18. have access to the password database.
  19. 2. Edit the configuration file
  20. ------------------------------
  21. Configuration settings for the scripts are in digest_md5.conf.php. You must set
  22. $db_url to point to your password database. If you want to be able to use the
  23. scripts from the command-line or non-Drupal Web pages, you must set $drupal to
  24. the absolute path of your Drupal installation. When you are done editing the
  25. configuration file, make it read-only.
  26. 3. Control access to the scripts
  27. --------------------------------
  28. The first thing you can do secure the scripts is to move this directory to a
  29. location that is not accessible from the Internet. The configuration file
  30. especially needs protection, because it contains information that allows access
  31. to the password database.
  32. If the sudo command is available on your system, you can change the file system
  33. permissions on the all the files in the digest_md5 directory so that only
  34. adminstrators have access to them. You would then add the user your Web server
  35. runs as to the sudoers file. A sample sudoers file is provided in this directory
  36. for comparison. The important lines are
  37. Defaults:apache !authenticate
  38. Defaults:apache !lecture
  39. apache ALL=/usr/local/digest_md5/stored_passwords.php [A-z]*
  40. apache ALL=/usr/local/digest_md5/digest_md5.php [A-z]*
  41. This allows apache to use sudo only to run stored_passwords.php and
  42. digest_md5.php. Replace apache with the name of the Web server user on your
  43. system, and replace /usr/local/digest_md5 with the directory in which this file
  44. is located.
  45. If the rest of your system is secure, Web pages can now store passwords without
  46. having the ability to retrieve them.