Installing ZendTo on Windows

This document describes very briefly how to run ZendTo on a Windows 2008R2 Server. It should be easily applicable to later versions of Windows Server. All version numbers given are the latest at the time of writing (Autumn 2012).

Requirements

Installation

Setup MySQL

  1. Setup MySQL's root@localhost password
  2. Using the mysql command line create ZendTo user and database:
    mysql> CREATE DATABASE zendto;
    mysql> GRANT ALL PRIVILEGES ON zendto.* TO zendto@localhost IDENTIFIED by 'password';
    mysql> FLUSH PRIVILEGES;
  3. Import Database:
    mysql --user=zendto --password='password' zendto < zendto.MySQL

Setup phpmyadmin

  1. Extract phpmyadmin folder into web root of website
    1. Configure config.inc.php's blowfish secret
    2. From IIS website's Home page, navigate to the phpmyadmin folder on the left then select IP Address and Domain Restrictions.
  2. Enter in only the IP/Subnets that will be allowed to view phpmyadmin

Setup IIS6 SMTP Service

  1. In IIS6 Manager right click on SMTP and select properties.
    1. Under Access only anonymous should be checked
    2. Under the Relay button only 127.0.0.1 should be checked, "Only the list below" should be selected.

Setup IIS Website

  1. From IIS website's Home page:
    1. Click on Limits on right and set timeout to 3600 and hit ok
    2. In PHP Manager:
      1. View php recommendations and apply all
      2. Set runtime limits:
        Maximum Post Size: 2040M
        Maximum Upload File Size: 2020M
        Maximum Execution Time: 7200
        Maximum Files to Upload: 20
        Maximum Input Time: 7200
        Memory Limit: 300M
    3. Open PHP.ini from the PHP Manager. At the end:
      [PHP_APC]
      extension=php_apc.dll
       
      [APC]
      apc.rfc1867 = on
      apc.max_file_size = 2000M
      apc.slam_defense = 0
      apc.enable_cli = 1
      apc.ttl = 7200
      apc.shm_size = 256M
      apc.cache_by_default = off
      apc.rfc1867_freq = 1M
      apc.mmap_file_mask = "C:\windows\temp\apc.XXXXXX"
      apc.shm_segments = 1
      apc.optimization = 0
      apc.user_ttl = 7200
      apc.num_files_hint = 1024
    4. Confirm Time Zone is correct
    5. Enable PHP Extensions in PHP Manager: APC, bz2, curl, exif, fileinfo, gd2, gettext, gmp, ldap, mbstring, mysql, openssl, pdo_mysql, xmlrpc
  2. Setup website in IIS for transfer.domain.local (with header for transfer. domain.com)
  3. Request and install SSL certificate
  4. Bind SSL certificate to website, setup rewrite rule for SSL:
    <rule name="Redirect to HTTPS" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
    <add input="{HTTPS}" pattern="^OFF$" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
    </rule>
  5. Extract zendto.tgz file into web root of website

Setup ClamAV

  1. Extract clamav for windows into a <web root of website>/clamav
  2. Copy out clamd.conf, freshclam.conf from the conf_examples and
    1. Comment out the "Example" line near the top
    2. Define Pidfile location
  3. Run freshclam.exe elevated As Administrator to get intial sync of definitions
  4. Install a Task in Task Scheduler as SYSTEM with highest privileges and set task to run every 4 hours for freshclam.exe

Setup RRDTool

Extract RRDTool for Windows into <web root of website>/rrdtool.

Setup ZendTo Website

  1. Set IUSR user to be able to write to the following directories (and create if not found):
    data
    data/dropoffs
    data/rrd
    data/temp
    cache
    clamav
  2. Set IUSR user to be able to read to the following directories and subfiles/folders:
    www
    lib
    bin
    sbin
    config
    templates*
    rrdtool
  3. Configure preferences.php file: (C:\\inetpub\\wwwroot\\transfer.domain.com\\ )
    define('NSSDROPBOX_BASE_DIR'
    define('NSSDROPBOX_LIB_DIR'
    define('NSSDROPBOX_DATA_DIR'
    define('MYZENDTO','FALSE');
  4. Define RRDTool's path without a semi-colon or it will fail
    define('RRD_DATA_DIR','\\inetpub\\wwwroot\\transfer.domain.com\\data\\rrd\\');
    define('RRD_DATA',RRD_DATA_DIR.'zendto.rrd');
    define('RRDTOOL','C:\\inetpub\\wwwroot\\transfer.domain.com\\rrdtool\\rrdtool.exe');
  5. Define MySQL instance variables in $NSSDROPBOX_PREFS
  6. Define real progress bar, local subnet array('10.10.') & RECAPTCHA Public and Private keys: https://www.google.com/recaptcha/admin/create
  7. Define LDAP lookup settings and default email domain & its Regular expression
  8. Define clamav as quiet "--quiet" with the correct path

Setup Tasks for Daily Processing

  1. Open a Command Prompt as administrator
  2. Navigate to sbin folder and run rrdInit.php to generate the rrd files in data/rrd:
    php.exe rrdInit.php <preferences.php>
  3. Open Task Scheduler and make the following tasks:
    "File clean up"
    <path to php>\php.exe <path to>\cleanup.php <path to>preferences.php
    "rrdUpdates"
    <path to php>\php.exe <path to>\rrdUpdate.php <path to>\preferences.php
    "Stats"
    <path to php>\php.exe <path to>stats.php <path to>\preferences.php
    "Purge failed transfers"
    1. forfiles -p "C:\windows\temp" -s -m php*.tmp -d -0 -c "cmd /c del @path"
    2. forfiles -p "C:\windows\temp" -s -m upload*.txt -d -0 -c "cmd /c del @path"
  4. All Tasks happen at midnight, daily
  5. Make sure all tasks are created for Windows 2008 R2, Windows 7 or double quotes in the command line options will be converted to the wrong ASCI and all tasks will fail with 0x1