<!--%%INCLUDE "i_defaulthead.incl"-->
   <title>General PolluStop Configuration</title>
</head>
<body>
   <h1>General PolluStop Configuration<br />
   <span class="h2">%%domainname%%</span></h1>
   <!--%%INCLUDE "i_statuscodes.incl"-->
   <form action="general" method="post">

   <fieldset><legend>Web interface</legend>
      <p>Access port: <input type="text" name="httplistenport" value="%%settings.httplistenport%%" size="5" maxlength="5" /></p>
      <p>Access protocol: <select style="width:auto;" name="httpallowedmethods" onchange=" if (this.selectedIndex != 0) {l_redir.disabled = true; l_redir.selectedIndex=0;} else l_redir.disabled = false; l_sslcert.style.display = this.selectedIndex == 1 ? 'none' : '';">
         <option value="3" <!--%%IF EQUALS(settings.httpallowedmethods AND "3")-->selected<!--%%ENDIF-->>HTTP and HTTPS (on the same port)<!--%%if EQUALS(defaultsettings.httpallowedmethods AND "3")--> *<!--%%ENDIF--></option>
         <option value="1" <!--%%IF EQUALS(settings.httpallowedmethods AND "1")-->selected<!--%%ENDIF-->>HTTP (non-secure) only<!--%%if EQUALS(defaultsettings.httpallowedmethods AND "1")--> *<!--%%ENDIF--></option>
         <option value="2" <!--%%IF EQUALS(settings.httpallowedmethods AND "2")-->selected<!--%%ENDIF-->>HTTPS (secure) only<!--%%if EQUALS(defaultsettings.httpallowedmethods AND "2")--> *<!--%%ENDIF--></option>
      </select></p>
      <p><!--%%IF EQUALS(settings.httpallowedmethods AND "3")-->
         <select class="ed" name="httpautoredirect" id="httpautoredirect"><!--%%BOOLMENU settings.httpautoredirect DEFAULT defaultsettings.httpautoredirect DISPLAY enabledisable--></select>
         <!--%%ELSE-->
         <select class="ed" disabled name="httpautoredirect" id="httpautoredirect"><!--%%BOOLMENU EMPTYSTRING DEFAULT defaultsettings.httpautoredirect DISPLAY enabledisable--></select>
         <!--%%ENDIF--> automatic redirection to HTTPS on the login page.</p>
      <p class="explain">The Access Port is the TCP/IP port of the HTTP/HTTPS listener, that is, the port where you access this web interface, either in http or https mode.</p>
      <p class="explain">PolluStop uses the same port for HTTP and HTTPS access, for instance <span class="dyn">http://%%hostname%%:%%settings.httplistenport%%</span> and <span class="dyn">https://%%hostname%%:%%settings.httplistenport%%</span>.</p>

      <fieldset id="sslcert" <!--%%IF EQUALS(settings.httpallowedmethods AND "1")-->style="display:none;"<!--%%ENDIF-->><legend>SSL Certificate and Key</legend>
         <p class="explain">PolluStop uses by default a generic self-signed certificate for the HTTPS access. It is recommended you install your own ssl certificate and private key. If you don't have one, you can generate and self-sign one using OpenSSL - a self-signed certificate with your information is better than a generic one.</p>
         <p><select onchange="l_customcert.style.display = this.selectedIndex > 0 ? 'none' : '';" class="ed" name="sslcertificateusedef"><!--%%BOOLMENU settings.sslcertificateusedef DEFAULT defaultsettings.sslcertificateusedef DISPLAY usenouse--></select> default ssl certificate and private key.</p>
         <fieldset id="customcert" <!--%%IF settings.sslcertificateusedef-->style="display:none;"<!--%%ENDIF-->>
            <p><!--%%IF hasprivatekey--><input type="button" class="btn" value="Modify Private Key" onclick="this.parentNode.style.display='none'; this.parentNode.nextSibling.style.display='';"><!--%%ENDIF--></p><div <!--%%IF hasprivatekey-->style="display:none"<!--%%ENDIF-->>
               <label for="sslprivatekey">Private Key (unencrypted PEM format only)</label><br />
               <textarea id="sslprivatekey" name="sslprivatekey" cols="65" rows=5 style="width:auto;"></textarea>
            </div>
            <div><label for="sslcertificate">X509 Certificate (unencrypted PEM format only)</label><br />
            <textarea name="sslcertificate" cols="65" rows=5 style="width:auto;" rows="2"><!--%%IF hascertificate-->%%settings.sslcertificate%%<!--%%ENDIF--></textarea></div>
            <!--%%IF hasprivatekey-->
            <p><input disabled="disabled" type="submit" name="clearsslpk" class="btn" value="Clear Private Key and Certificate"> <input onclick="IAmSure(this, 'clearsslpk')" type="checkbox" name="clearsslpksure" id="clearsslpksure" value="1" /><label for="clearsslpksure">I am sure</label></p>
            <!--%%ENDIF-->
         </fieldset>
      </fieldset>
      <p class="errors">When any of these settings is changed, the http listener must be restarted. This may cause a delay or a temporary connection error. If the current address is no longer valid, you will be automatically redirected to the new address. If you get a "Page Not Found" or a "Forbidden" error, verify the url and port and try again.</p>
   </fieldset>

   <fieldset><legend>Command server</legend>
      <p class="explain">PolluStop runs a command server somewhat similar to the CLI/PWD interface of Communigate Pro. This control server is currently used by clustered installation to synchronize data between pollustop instances.</p>
      <p>Access port: <input type="text" name="pwdlistenport" value="%%settings.pwdlistenport%%" size="5" maxlength="5" /> (0 to disable command server, default: 8011)</p>
      <p class="explain">PolluStop must be completely restarted to apply a new port setting.</p>
   </fieldset>

   <script type="text/javascript">
         var l_redir = document.getElementById('httpautoredirect');
         var l_sslcert = document.getElementById('sslcert');
         var l_customcert = document.getElementById('customcert');
      </script>

   <fieldset><legend>Find Attachments </legend>
      <select class="ed" name="findattach"><!--%%BOOLMENU settings.findattach DEFAULT defaultsettings.findattach DISPLAY enabledisable--></select>
      the built-in Find Attachment module.
   </fieldset>

   <fieldset><legend><select class="ed" name="ocr_enabled"><!--%%BOOLMENU settings.ocr_enabled DEFAULT defaultsettings.ocr_enabled DISPLAY enabledisable--></select> image scanning (OCR)</legend>
      <p class="explain">PolluStop can extract images from messages and spawn an external process to perform optical character recognition on the image. Since OCR is a CPU-intensive task, PolluStop will use it after the normal scanning, only if the message score is low and one or more images can be extracted.</p>
      <p class="explain">The OCR tool provided in PolluStop's package is <a href="http://sourceforge.net/projects/tesseract-ocr" onclick="if ((arguments[0] || event).left) window.open(this.href); return false;" rel="external" >tesseract</a>, slightly modified to include the freeimage library to be able to read several common image types.</p>
      <p>Path to Tesseract: <input type="text" name="ocr_tesseract" value="%%SETTINGS("ocr_tesseract")%%" size="30" maxlength="255"> <span style="font-size:x-small"> (full path, or relative to your CGP base directory)</span></p>
      <p class="explain">When you enable this for the first time, be sure to monitor your server's CPU usage. If you receive a lot of image-based spam the OCR tool may take too much CPU and your mail will be delayed. The statistics page can give you an approximation of the CPU time used to decode the images.</p>
   </fieldset>

   <fieldset><legend><select class="ed" name="allowusersettings"><!--%%BOOLMENU settings.allowusersettings DEFAULT defaultsettings.allowusersettings DISPLAY enabledisable--></select> per-user settings</legend>
      <p class="explain">A few settings can be configured by the end-user, regarding his/her whitelist and blacklist. To access the per-user configuration page, one must login to PolluStop webadmin interface using his/her email account credentials.</p>
      <p class="errors">When PolluStop webadmin is not used in SSL mode (https), the passwords are RSA-encrypted on the client side and sent encrypted. The authentication system also produces a single-use token which is encrypted with the password, protecting the password and preventing replay attacks.</p>
      <p class="explain">PolluStop also allows the per-user settings page to be accessed from a pre-existing webmail session, using the session ID. This also allows a webmail skin to be modified to access PolluStop user settings.</p>
      <p class="explain" style="text-align:left">For instance, if you have an existing webmail session such as http://mail.yourdomain.com:8100/Session/&lt;session-id&gt;/hello.wssp, the session id can be used to access pollustop settings at http[s]://mail.yourdomain.com:8001/Session/&lt;session-id&gt;/user.</p>
      <p class="errors">The sessions created by PolluStop have a 5-minutes inactivity timeout. The sessions imported from webmail use the inactivity and session timeout from webuser settings. &quot;Inactivity&quot; means the browser window is closed without closing the session - a session should not timeout while the browser window is still open.</p>
   </fieldset>


   <fieldset><legend>Statistics </legend>
      <select class="ed" name="statistics"><!--%%BOOLMENU settings.statistics DEFAULT defaultsettings.statistics DISPLAY enabledisable--></select> the statistics module.
   </fieldset>

   <fieldset><legend>Maximum lines for timeout protection: <input type="text" name="maxlines" value="%%SETTINGS("maxlines")%%" size="8" maxlength="8" /></legend>
      <p class="explain">Process up to this number of lines in any given message. This avoids server timeouts when reading incorrectly-encoded MIME messages with large attachments. Set to 0 for unlimited (not recommended).</p>
   </fieldset>

   <fieldset><legend><select class="ed" name="modifysubject"><!--%%BOOLMENU settings.modifysubject DEFAULT defaultsettings.modifysubject DISPLAY enabledisable--></select> subject line modification: </legend>
      <p>Subject Prefix: <input type="text" name="subjectprefix" value="%%SETTINGS("subjectprefix")%%" size="16" maxlength="16" /></p>
      <p>Minimum score to add the prefix: <select name="spamlevel"><!--%%ENUMMENU settings.spamlevel DEFAULT defaultsettings.spamlevel in Scores--></select></p>
      <p class="explain">This feature will modify the Subject Line of any message considered as Spam. This is useful if you want the final filtering done by the mail client and not by CGPro (a few widely-used mail clients are unable to filter on a custom header field).</p>
      <p class="explain"><b>NOTE</b>: When this feature is enabled, messages are resubmitted via PIPE with the modified subject; PIPE must be enabled, and these messages will be processed twice by CGPro.</p>
   </fieldset>

   <fieldset><legend><select class="ed" name="enabledbdomains"><!--%%BOOLMENU settings.enabledbdomains DEFAULT defaultsettings.enabledbdomains DISPLAY enabledisable--></select> Directory-Based domains</legend>
      <p class="explain">By default PolluStop does not list Directory-Based domains and does not retrieve their settings. When this setting is enabled, Directory-Based domains will be fetched via CLI, the startup time of PolluStop will be a bit longer. Of course, CLI must <a href="password">be available</a>.</p>
   <p class="explain">PolluStop builds an internal table of account aliases by reading Communigate Pro's aliases settings files. However, Directory-Based domains does not have such files. PolluStop could try to attempt to retrieve all aliases via CLI, but this would take several minutes depending on the number of accounts. Instead, PolluStop tries to parse the Directory data file (Directory/Main.data). This takes about one second per 10K lines. If your Directory data file is big, this can increase the startup time of PolluStop as well as increase its memory usage. Aliases are usually not required for normal operation. However, if you specified a subset of account to be scanned in the <a href="filter">Filtered Accounts</a> page, disabling aliases can prevent some messages sent to these accounts to be scanned.</p>
      <select class="ed" name="enabledbdaliases"><!--%%BOOLMENU settings.enabledbdaliases DEFAULT defaultsettings.enabledbdaliases DISPLAY enabledisable--></select> the directory-based domains' account aliases
   </fieldset>

   <fieldset><legend>Logging</legend>
      <table>
         <tr><th style="vertical-align:top"><select name="log_parsingerrors"><!--%%BOOLMENU settings.log_parsingerrors DEFAULT defaultsettings.log_parsingerrors DISPLAY yesno--></select></td><td>Parsing Errors and warnings <span class="explain">(includes decoding errors and unknown charsets)</span></td></tr>
         <tr><th style="vertical-align:top"><select name="log_scoringvalues"><!--%%BOOLMENU settings.log_scoringvalues DEFAULT defaultsettings.log_scoringvalues DISPLAY yesno--></select></td><td>Scoring values <span class="explain">(all diagnostics modifiying the message score)</span></td></tr>
         <tr><th style="vertical-align:top"><select name="log_popfetcher"><!--%%BOOLMENU settings.log_popfetcher DEFAULT defaultsettings.log_popfetcher DISPLAY yesno--></select></td><td>Drop Mailboxes <span class="explain">(all drop mailbox-related messages - imap fetcher)</span></td></tr>
         <tr><th style="vertical-align:top"><select name="log_miscellaneous"><!--%%BOOLMENU settings.log_miscellaneous DEFAULT defaultsettings.log_miscellaneous DISPLAY yesno--></select></td><td>Other log messages</td></tr>
         <tr><th style="vertical-align:top"><select name="log_newwords"><!--%%BOOLMENU settings.log_newwords DEFAULT defaultsettings.log_newwords DISPLAY yesno--></select></td><td>New Words <span class="explain">(all words not found in the database are logged)</span></td></tr>
         <tr><th style="vertical-align:top"><select name="log_debugscan"><!--%%BOOLMENU settings.log_debugscan DEFAULT defaultsettings.log_debugscan DISPLAY yesno--></select></td><td style="text-align:left">Scan/list debug messages  <span class="explain">(why a message is scanned or used for training, whitelist, blacklist)</span></td></tr>
         <tr><th style="vertical-align:top"><select name="log_debug"><!--%%BOOLMENU settings.log_debug DEFAULT defaultsettings.log_debug DISPLAY yesno--></select></td><td>Very verbose debug log messages <span class="explain">(enable only for short periods.)</span></td></tr>
      </table>
      <p class="explain">All log entries are created in the CGPro log files.</p>
   </fieldset>

   <fieldset><legend>Backup files</legend>
      <p class="explain"><a name="backup"></a>Everytime settings or database are changed, a backup copy is made on the disk. While the settings file is very small (below 1kB), the database files can be a lot bigger (1Mb to 10Mb), and keeping all these backup can take a lot of disk space.</p>
      <p class="explain">PolluStop will automatically delete these backups after a few days.</p>
      <p class="explain">The Database files are usually not saved more than four times a day, and only when they are modified. You should be sure to have at least 30 Mb of free disk space for each day you want to keep database backups.</p>
      <p>Keep Settings file backups for up to <select class="nw" name="keepsettingsdays"><!--%%NUMERICMENU settings.keepsettingsdays DEFAULT defaultsettings.keepsettingsdays in (0, 1, 2, 7, 14, 30, 61, 91, 122, 182, 274, 365, 731, 99999)  DISPLAY historytimes--></select></p>
      <p>Keep database files backups for up to <select class="nw" name="keepdbdays"><!--%%NUMERICMENU settings.keepdbdays DEFAULT defaultsettings.keepdbdays in (0, 1, 2, 5, 7, 14, 30, 61, 91, 122, 182, 274, 365, 731, 99999)  DISPLAY historytimes--></select></p>
   </fieldset>

   <fieldset><legend>Special Flags: <input type="text" name="specialflags" value="%%SETTINGS("specialflags")%%" size="8" maxlength="8" /></legend>
   <p class="explain">Set custom options -- Leave at 0 unless you know what you are doing.</p>
   </fieldset>

   <p><input type="submit" class="btn" name="Apply" value="Save settings" /><input type="reset" class="btn" value="Reset" /></p>
   </form>
<!--%%INCLUDE "i_defaultfoot.incl"-->
