<!--%%INCLUDE "i_defaulthead.incl" ("General PolluStop Configuration")-->
   <form action="general" method="post">

   <fieldset><legend>Web interface</legend>
      <p>Access port: <input type="text" name="httplistenport" value="%%HTML: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" 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>Private Key (unencrypted PEM format only)<br />
               <textarea name="sslprivatekey" cols="65" rows=5 style="width:auto;"></textarea></label>
            </div>
            <div><label>X509 Certificate (PEM format only)<br />
            <textarea name="sslcertificate" cols="65" rows=5 style="width:auto;" rows="2"><!--%%IF hascertificate-->%%settings.sslcertificate%%<!--%%ENDIF--></textarea></label></div>
            <div><label>X509 Certificate chain (PEM format only)<br />
            <textarea name="sslchain" cols="65" rows=5 style="width:auto;" rows="2">%%settings.sslchain%%</textarea></label></div>
            <!--%%IF hasprivatekey-->
            <p><label><input disabled="disabled" type="submit" name="clearsslpk" value="Clear Private Key and Certificate"> <input onclick="IAmSure(this, 'clearsslpk')" type="checkbox" name="clearsslpksure" value="1" />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="%%HTML: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>
      <p><select class="ed" name="findattach"><!--%%BOOLMENU settings.findattach DEFAULT defaultsettings.findattach DISPLAY enabledisable--></select>
      the built-in Find Attachments module.</p>
      <p><select style="width:auto" class="ed" name="findattachall"><!--%%BOOLMENU settings.findattachall DEFAULT defaultsettings.findattachall DISPLAY allownoallow--></select>
      the Find Attachments module to check for attachments in all messages, including outbound messages and messages normally not scanned for spam by PolluStop (Do not allow = only inbound, scanned messages are checked for attachments).</p>
   </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="%%HTML: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="allowdomainsettings"><!--%%BOOLMENU settings.allowdomainsettings DEFAULT defaultsettings.allowdomainsettings DISPLAY enabledisable--></select> per-domain settings</legend>
      <p class="explain">Domain administrators can configure whitelist, blacklist and a few settings unique to their domain. Anyone with the "Account Settings"/"BasicSettings" access right in CGP will be granted the right to modify these settings for his domain.</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><select class="ed" name="statistics" onchange="document.getElementById('statistics_options').style.display=this.selectedIndex?'':'none'"><!--%%BOOLMENU settings.statistics DEFAULT defaultsettings.statistics DISPLAY enabledisable--></select> statistics module</legend>
      <p class="explain">The statistics module gathers data about filtering, reporting and performance in three zones:</p>
      <ul class="explain"><li>Saved data, which is kept until a manual reset.</li>
         <li>Session data, which contains additional information such as message per unique recipient and is reset when the filter is restarted</li>
         <li>Daily data, which contains even more information such as spam targets and spam source IPs, and is used to generate an email-based daily report to the postmaster. This data is reset everyday.</li>
      </ul>
      <fieldset id="statistics_options" <!--%%IF NOT(settings.statistics)-->style="display:none"<!--%%ENDIF-->><legend><select class="ed" name="enabledailyreport"><!--%%BOOLMENU settings.enabledailyreport DEFAULT defaultsettings.enabledailyreport DISPLAY enabledisable--></select> daily report</legend>
         <p class="explain">The daily report contains details about various things, including frequent spam source IPs. As some servers are configured to receive mail from a single source (such an external spam appliance, or a relay), saving the IP address the CGP server received the message from may not be useful.</p>
         <p class="explain">By default, PolluStop will record that IP, but can also look at the Received header and record the first IP not matching a pre-defined list of default relays.</p>
         <p class="explain">This way, the gathered data will likely be the real, external source of spam, the last point in the relay chain that is not under your direct or indirect control.</p>
         <p>Ignore these source IPs:</p>
         <ul style="list-style:none; margin:0; padding:0" id="ignored_sources"><!--%%FORALL ip IN settings.dailyreportignoredsourceips-->
            <li><input type="text" size="15" maxlength="15" name="dailyreportignoredsourceips" value="%%HTML:ip[]%%" /></li><!--%%ENDFOR dom-->
            <li><input type="text" size="15" maxlength="15" name="dailyreportignoredsourceips" value="" /></li>
         </ul>
         <div class="link" onclick="AddBox('ignored_sources')">Add</div>
         <p class="explain">Note: this setting affects only newly gathered data. The data gathered about previous messages today will not be affected.</p>
         <p>You can trigger a partial daily report here: <input type="button" onclick="getReport()" value="Generate partial report"></p>
      </fieldset>

   </fieldset>

   <fieldset><legend>Maximum lines for timeout protection: <input type="text" name="maxlines" value="%%HTML: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="%%HTML: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>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>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="%%HTML: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" name="Apply" value="Save settings" /></p>
   </form>

   <form action="general" method="post">
   <fieldset><legend>Reset CLI password</legend>
      <p class="explain">To use another account for the CLI communication between PolluStop and CGP, click the button below. You will be logged out of PolluStop interface.</p>
      <p class="explain">Then login again, using the account you wish PolluStop to use for CLI. This account must have the Master access right.</p>
      <p class="error">Note that until a new CLI username/password is set on the login page, nobody will be able to use the web interface.</p>
      <p><input disabled="disabled" type="submit" name="resetcli" value="Reset CLI password"/></p>
      <p><label><input onclick="IAmSure(this, 'resetcli')" type="checkbox" name="resetclisure" value="1" /> I am sure</label></p>
   </fieldset>
   </form>

<!--%%INCLUDE "i_defaultfoot.incl"-->
