You are here

function cloudflare_admin in CloudFlare 7.2

Same name and namespace in other branches
  1. 6 cloudflare.module \cloudflare_admin()
  2. 7 cloudflare.module \cloudflare_admin()

cloudflare_menu() page callback function.

1 string reference to 'cloudflare_admin'
cloudflare_menu in ./cloudflare.module
Implementation of hook_menu().

File

./cloudflare.module, line 132

Code

function cloudflare_admin() {
  $form = array();
  $form['ip_address_handling'] = array(
    '#type' => 'fieldset',
    '#title' => 'IP Address Detection',
    '#description' => t('<p>By default the X-Forwarded-For header is used determine the end-users IP address (default option). However, given the need to check forwarded IPs against a long list of trusted cloudflare IP ranges, this can increase load time and resource use on the server. </p>

      <p>You can also choose to use CF-Connecting-IP and continue to verify the header against trusted IP addresses (second option). </p>

      <p>The best option is to use CF-Connecting-IP and trust that the header is coming from a CloudFlare IP address (third option). While this option is the best in terms of resource usage and load time, for it to be secure your server either needs to only be accessible from CloudFlare, or have an upstream reverse proxy (such as varnish) that will verify that the request is coming from cloudflare if this header is present.</p>'),
  );
  $form['ip_address_handling']['cloudflare_cf_connecting_ip'] = array(
    '#type' => 'radios',
    '#options' => array(
      '0' => t('Use X-Forwarded-For header'),
      'verify' => t('Use CF-Connecting-IP header, but verify the header'),
      'trust' => t('Use CF-Connecting-IP header, and trust the header'),
    ),
    '#default_value' => variable_get('cloudflare_cf_connecting_ip', '0'),
  );
  $form['cloudflare_api_email'] = array(
    '#type' => 'textfield',
    '#title' => t('E-mail address'),
    '#description' => t('Email address for your Cloudflare account.  You can find it on the ') . l(t('Account Tab'), 'https://www.cloudflare.com/my-account.html'),
    '#default_value' => variable_get('cloudflare_api_email', ''),
  );
  $form['cloudflare_api_key'] = array(
    '#type' => 'textfield',
    '#title' => t('API key'),
    '#description' => t('API key for your Cloudflare account.  You can find it on the ') . l(t('Account Tab'), 'https://www.cloudflare.com/my-account.html'),
    '#default_value' => variable_get('cloudflare_api_key', ''),
  );
  return system_settings_form($form);
}