'. t('Secure Site allows site administrators to make a site or part of a site private. You can restrict access to the site by role. This means the site will be inaccessible to search engines and other crawlers, but you can still allow access to certain people.') .'

'."\n". '

'. t('You can also secure remote access to RSS feeds. You can keep content private and protected, but still allow users to get notification of new content and other actions via RSS with news readers that support user:pass@example.com/node/feed URLs, or have direct support for user name and password settings. This is especially useful when paired with the Organic Groups module or other node access systems.') .'

'."\n". '

'. t('Configuration') .'

'."\n". ''."\n". '

'. t('Secure password storage') .'

'."\n". '

'. t('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. Drupal must be able to store passwords but should not be able to retrieve them.') .'

'."\n". '

'. t('Secure Site provides scripts that can handle stored passwords securely when properly set up. These scripts are contained in the digest_md5 directory. There are two scripts in this directory:') .'

'."\n". '
'."\n". '
stored_passwords.php
'. t('Add, delete, and update user passwords.') .'
'."\n". '
digest_md5.php
'. t('Perform digest authentication') .'
'."\n". '
'."\n". '

'. t('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:') .'

'."\n". '
    '."\n". '
  1. '. t('Set up a secure database') ."\n". '

    '. t('You can set up a password database in the same way you create a Drupal database. However, you should create a special database user for your password database. No other database users should have access to the password database.') .'

    '."\n". '
  2. '."\n". '
  3. '. t('Edit the configuration file') ."\n". '

    '. t('Configuration settings for the scripts are in digest_md5.conf.php, in the digest_md5 directory. 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, you must set $drupal to the absolute path to your Drupal installation. When you are done editing the configuration file, make it read-only.') .'

    '."\n". '
  4. '."\n". '
  5. '. t('Control access to the scripts') ."\n". '

    '. t('The first thing you can do secure the scripts is to move the digest_md5 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. On the Secure Site settings page, change the digest authentication script and password storage script to point to the new location. For example, if you moved the digest_md5 directory to /usr/local, you would use') .'

    '."\n". '
    /usr/local/digest_md5/digest_md5.php'."\n".
    	         '/usr/local/digest_md5/stored_passwords.php
    '."\n". '

    '. t('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 the digest_md5 directory for comparison. The important lines are') .'

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

    '. t('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 with the directory in which you placed the digest_md5 directory. On the Secure Site settings page, add sudo at the beginning of the line for the digest authentication script and the password storage script:') .'

    '."\n". '
    sudo /usr/local/digest_md5/digest_md5.php'."\n".
    	         'sudo /usr/local/digest_md5/stored_passwords.php
    '."\n". '

    '. t('If the rest of your system is secure, Drupal can now store passwords without being able to retrieve them.') .'

    '."\n". '
  6. '."\n". '
'."\n". '

'. t('Theming') .'

'."\n". '

'. t('Secure Site’s HTML output is controlled by three files:') .'

'."\n". '
'."\n". '
securesite-page.tpl.php
'. t('Template for Secure Site pages. Works in the same way as page.tpl.php.') .'
'."\n". '
securesite-user-login.tpl.php
'. t('Template for the user log-in form.') .'
'."\n". '
securesite-user-pass.tpl.php
'. t('Template for the password reset form.') .'
'."\n". '
'."\n". '

'. t('You can theme Secure Site’s HTML output by copying these files to your theme’s directory. The files in your theme’s directory will become the templates for all Secure Site HTML output.') .'

'."\n". '

'. t('Configuring cron jobs') .'

'."\n". '

'. t('If HTTP authentication is forced, cron jobs will need to authenticate themselves. See !link for more details on configuring cron jobs. These examples show how to add a user name and password:', array('!link' => l(t('Configuring cron jobs'), 'http://drupal.org/cron'))) .'

'."\n". '
45 * * * * /usr/bin/lynx -auth=username:password -source http://example.com/cron.php'."\n".
       '45 * * * * /usr/bin/wget --user=username --password=password -O - -q http://example.com/cron.php'."\n".
       '45 * * * * /usr/bin/curl --user username:password --silent --compressed http://example.com/cron.php
'."\n". '

'. t('Known issues') .'

'."\n". ''."\n"; } /** * FAPI definition for Secure Site admin settings form * @ingroup forms * @see system_settings_form() * @see securesite_admin_settings_validate() * @see securesite_admin_settings_submit() */ function securesite_admin_settings() { $form['authentication'] = array( '#type' => 'fieldset', '#title' => t('Authentication'), '#description' => t('Enable Secure Site below. Users must have the !access permission in order to access the site if authentication is forced.', array('!access' => l(t('access secured pages'), 'admin/user/permissions', array('fragment' => 'module-securesite')))) ); $form['authentication']['securesite_enabled'] = array( '#type' => 'radios', '#title' => t('Force authentication'), '#default_value' => variable_get('securesite_enabled', SECURESITE_DISABLED), '#options' => array( SECURESITE_DISABLED => t('Never'), SECURESITE_ALWAYS => t('Always'), SECURESITE_OFFLINE => t('During maintenance'), SECURESITE_403 => t('On restricted pages'), ), '#description' => t('Choose when to force authentication.'), ); $form['authentication']['securesite_type'] = array( '#type' => 'checkboxes', '#title' => t('Allowed authentication types'), '#default_value' => variable_get('securesite_type', array(SECURESITE_BASIC)), '#options' => array( SECURESITE_DIGEST => t('HTTP digest'), SECURESITE_BASIC => t('HTTP basic'), SECURESITE_FORM => t('HTML log-in form'), ), '#required' => TRUE, ); $form['authentication']['securesite_type']['#description'] = "\n".'

'. t('HTTP authentication requires extra configuration if PHP is not installed as an Apache module. See the !link section of the Secure Site help for details.', array('!link' => l(t('Known issues'), 'admin/help/securesite', array('fragment' => 'issues')))) .'

'."\n".'

'. t('Digest authentication protects a user’s password from eavesdroppers when you are not using SSL to encrypt the connection. However, it can only be used when a copy of the password is stored on the server.') .' '. t('For security reasons, Drupal does not store passwords. You will need to configure scripts to securely save passwords and authenticate users. See the !link section of the Secure Site help for details.', array('!link' => l(t('Secure password storage'), 'admin/help/securesite', array('fragment' => 'passwords')))) .'

'."\n".'

'. t('When digest authentication is enabled, passwords will be saved when users log in or set their passwords. If you use digest authentication to protect your whole site, you should allow guest access or allow another authentication type until users whose passwords are not yet saved have logged in. Otherwise, you may lock yourself out of your own site.') .'

'."\n"; $form['authentication']['securesite_digest_script'] = array( '#type' => 'textfield', '#title' => t('Digest authentication script'), '#default_value' => variable_get('securesite_digest_script', drupal_get_path('module', 'securesite') .'/digest_md5/digest_md5.php'), '#length' => 30, '#maxlength' => 300, '#description' => t('Enter the digest authentication script exactly as it should appear on the command line. Use absolute paths.'), ); $form['authentication']['securesite_password_script'] = array( '#type' => 'textfield', '#title' => t('Password storage script'), '#default_value' => variable_get('securesite_password_script', drupal_get_path('module', 'securesite') .'/digest_md5/stored_passwords.php'), '#length' => 30, '#maxlength' => 300, '#description' => t('Enter the password storage script exactly as it should appear on the command line. Use absolute paths.'), ); $form['authentication']['securesite_realm'] = array( '#type' => 'textfield', '#title' => t('Authentication realm'), '#default_value' => variable_get('securesite_realm', variable_get('site_name', 'Drupal')), '#length' => 30, '#maxlength' => 40, '#description' => t('Name to identify the log-in area in the HTTP authentication dialog.'), ); $form['guest'] = array( '#type' => 'fieldset', '#title' => t('Guest access'), '#description' => t('Guest access allows anonymous users to view secure pages, though they will still be prompted for a user name and password. If you give anonymous users the !access permission, you can set the user name and password for anonymous users below.', array('!access' => l(t('access secured pages'), 'admin/user/permissions', array('fragment' => 'module-securesite')))), ); $guest_access = !user_access('access secured pages', drupal_anonymous_user()); $form['guest']['securesite_guest_name'] = array( '#type' => 'textfield', '#title' => t('Guest user'), '#default_value' => variable_get('securesite_guest_name', ''), '#length' => 30, '#maxlength' => 40, '#description' => t('Leave empty to accept any name.'), '#disabled' => $guest_access, ); $form['guest']['securesite_guest_pass'] = array( '#type' => 'textfield', '#title' => t('Guest password'), '#default_value' => variable_get('securesite_guest_pass', ''), '#length' => 30, '#maxlength' => 40, '#description' => t('Leave empty to accept any password.'), '#disabled' => $guest_access, ); $form['login_form'] = array( '#type' => 'fieldset', '#title' => t('Customize HTML forms'), '#description' => t('Configure the message displayed on the HTML log-in form (if enabled) and password reset form below.') ); $form['login_form']['securesite_login_form'] = array( '#type' => 'textarea', '#title' => t('Custom message for HTML log-in form'), '#default_value' => variable_get('securesite_login_form', t('Enter your user name and password:')), '#length' => 60, '#height' => 3, ); $form['login_form']['securesite_reset_form'] = array( '#type' => 'textarea', '#title' => t('Custom message for password reset form'), '#default_value' => variable_get('securesite_reset_form', t('Enter your user name or e-mail address:')), '#length' => 60, '#height' => 3, '#description' => t('Leave empty to disable Secure Site’s password reset form.'), ); $form['#submit'][] = 'securesite_admin_settings_submit'; return system_settings_form($form); } function securesite_admin_settings_validate($form, &$form_state) { foreach ($form_state['values']['securesite_type'] as $type => $value) { if (empty($value)) { unset($form_state['values']['securesite_type'][$type]); } } sort($form_state['values']['securesite_type']); } /** * Restore core 403 error page when not using Secure Site page. */ function securesite_admin_settings_submit($form, &$form_state) { $values = $form_state['values']; if ($values['securesite_enabled'] != SECURESITE_403 || isset($values['op']) && $values['op'] == t('Reset to defaults')) { variable_set('site_403', variable_get('securesite_403', variable_get('site_403', ''))); variable_del('securesite_403'); } $script = variable_get('securesite_password_script', drupal_get_path('module', 'securesite') .'/digest_md5/stored_passwords.php'); $realm = variable_get('securesite_realm', variable_get('site_name', 'Drupal')); $securesite_guest_name = variable_get('securesite_guest_name', ''); if ( in_array(SECURESITE_DIGEST, variable_get('securesite_type', array(SECURESITE_BASIC))) && ( // Digest authentication was enabled. $values['securesite_guest_name'] != $securesite_guest_name || // Guest user name has changed. !in_array(SECURESITE_DIGEST, $values['securesite_type']) || // Digest authentication is being disabled. isset($values['op']) && $values['op'] == t('Reset to defaults') // Values are being reset to defaults. ) ) { // Delete guest user password. $args = array( escapeshellarg("name=$securesite_guest_name"), escapeshellarg("realm=$realm"), escapeshellarg('op=delete'), ); exec($script .' '. implode(' ', $args)); } elseif (in_array(SECURESITE_DIGEST, $values['securesite_type'])) { // If digest authentication is enabled, update guest user password. $args = array( escapeshellarg("name=$values[securesite_guest_name]"), escapeshellarg("realm=$realm"), escapeshellarg("pass=$values[securesite_guest_pass]"), ); exec($script .' '. implode(' ', $args)); } }