<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Digistan Wiki</title>
		<link>http://www.xitami.com</link>
		<description></description>
				<copyright></copyright>
		<lastBuildDate>Sun, 05 Feb 2012 22:12:03 +0000</lastBuildDate>
		
					<item>
				<guid>http://www.xitami.com/wiki:virtual-hosting</guid>
				<title>Virtual Hosting</title>
				<link>http://www.xitami.com/wiki:virtual-hosting</link>
				<description>

&lt;p&gt;A short article on virtual hosting (multihomed domains) in X5.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479922&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 04 May 2009 08:09:33 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>A short article on virtual hosting (multihomed domains) in X5.</p> <p>X5 does not do this, yet. Sorry.</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479922" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.xitami.com/wiki:directory-lists</guid>
				<title>Directory Lists</title>
				<link>http://www.xitami.com/wiki:directory-lists</link>
				<description>

&lt;p&gt;How to configure X5 to show directory lists.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479922&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 04 May 2009 07:38:28 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>How to configure X5 to show directory lists.</p> <p>X5 lets you enable directory listings per directory by creating a file called &quot;.httpdir&quot; in the webpages directory you want to make listable. That file must be readable by the X5 process. The file's contents are not relevant. X5 does <em>not</em> search parent directories for this file, so if the file is not present for a particular child directory, it won't be listable even if the parent is. (This behaviour could be changed.)</p> <p>To configure the style, create a file &quot;/http.css&quot; in your webpages root directory and override the styles that X5 uses for directory lists, which are:</p> <div class="code"> <pre> <code>/* X5 base style sheet Copyright (c) 1991-2009 iMatix Corporation - www.imatix.com You can override these styles by creating and editing http.css in your webpages directory. This CSS code is granted to the public domain. */ * { margin: 0; padding: 0; } BODY { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; background-color: white; } #error_head { font-size: 160%; margin: 10pt; border-width: 0 0 1pt 0; border-style: dashed; } #error_text { font-size: 120%; margin: 10pt; } #footer { margin: 10pt; border-width: 1pt 0 0 0; border-style: dashed; top: 90%; position: absolute; font-size: 85%; } #dir_head { font-size: 160%; margin: 10pt; border-width: 0 0 1pt 0; border-style: dashed; } #dir_text { font-size: 110%; margin: 10pt; } #dir_main { margin-left: 30pt; } .dir_table { width: 80%; } .dir_row { } .dir_name { font-weight: bold; } .dir_size { text-align: right; } .dir_time { text-align: right; } A { color: blue; text-decoration: none; } A:hover { color: white; background-color: black; }</code> </pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479923" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.xitami.com/wiki:2-5-patches</guid>
				<title>2.5 Patches</title>
				<link>http://www.xitami.com/wiki:2-5-patches</link>
				<description>

&lt;p&gt;This page lists various patches for Xitami 2.5.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479923&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 28 Apr 2009 11:45:29 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>This page lists various patches for Xitami 2.5.</p> <h3><span>64-bit Linux patch</span></h3> <p>Xitami/2.5 won't build on 64-bit Linux. The build issues an error &quot;Cannot compile: must change definition of 'qbyte'.&quot; To fix, edit sfl/prelude.h:99, and sfl/sfl.h:141 to read:</p> <div class="code"> <pre> <code>#if (defined (__64BIT__) || defined (__x86_64__))</code> </pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479923" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.xitami.com/wiki:access-logs</guid>
				<title>Access Logs</title>
				<link>http://www.xitami.com/wiki:access-logs</link>
				<description>

&lt;p&gt;Xitami/5 generates access logs in the standard Apache format as well as custom formats.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479923&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 18 Feb 2009 13:44:32 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Xitami/5 generates access logs in the standard Apache format as well as custom formats.</p> <h3><span>Log formats</span></h3> <p>Xitami/5 generates access logs in a variety of formats:</p> <ul> <li>CLF - NCSA/httpd common logging format.</li> <li>CLFX - W3C logging format as used by Apache. This is the default.</li> <li>Custom defined log format.</li> </ul> <p>Xitami uses templating to produce the log files. The templates for the above predefined formats are:</p> <ul> <li>CLF - '$from - $user [$datetime] &quot;$request&quot; $status $sent'</li> <li>CLFX - '$from - $user [$datetime] &quot;$request&quot; $status $sent &quot;$referer&quot; &quot;$agent&quot;'</li> </ul> <p>The log file format is specified by &#8212;access_log_format or /config/logging/access_log_format. If it is not one of the above three values, it is used as a template. The full list of template variables is:</p> <ul> <li>$agent - User-Agent header value</li> <li>$arguments - requested URI arguments</li> <li>$datetime - date/time in NCSA format</li> <li>$day - day as two digits</li> <li>$file - filename to which request was translated</li> <li>$from - client address, as dotted number</li> <li>$hh - hour, using 24-hour clock</li> <li>$method - HTTP method</li> <li>$mm - minutes as two digits</li> <li>$mon - month as two digits</li> <li>$path - requested URI path</li> <li>$query - query string, if any</li> <li>$recd - request size, in bytes</li> <li>$referer - Referer header</li> <li>$request - complete request line</li> <li>$sent - response size, in bytes</li> <li>$ss - seconds as two digits</li> <li>$status - response code, 3 digits</li> <li>$user - user name, if authenticated, else -</li> <li>$year - year as four digits</li> <li>$yy - year as two digits</li> <li>$VAR - environment variable VAR</li> </ul> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479923" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.xitami.com/wiki:feature-requests</guid>
				<title>Feature Requests</title>
				<link>http://www.xitami.com/wiki:feature-requests</link>
				<description>

&lt;p&gt;Main features request for Xitami/5, taken from Xitami list discussion&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479923&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 18 Feb 2009 13:43:50 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Main features request for Xitami/5, taken from Xitami list discussion</p> <ul> <li>Easy to use CGI</li> <li>Virtual hosts</li> <li>Stability on Windows Vista and later</li> <li>Extensibilty to ASP, PHP, MySQL</li> <li>CGI output via files as well as streams</li> <li>Automatic detection of non-parsed headers</li> <li>Automatic detection of executable (uri/filename without .exe)</li> <li>Cascading config files (default, server, vhost)</li> <li>Native gzip encoding</li> <li>Integration as win32 service (esp. for XP)</li> <li>True PHP implementation and support</li> <li>CGI I/O no-lock read of multipart/form-data (see email thread for details)</li> <li>URL Mod Rewrite integration</li> <li>Full SSI support</li> <li>32bit/64bit windows versions</li> <li>Remove FTP server (or rather, don't re-implement it)</li> <li>Individual virtual domain admin control</li> <li>Integrate server side 301/302/304 redirect capability</li> <li>Extended CLF logging as default</li> <li>Encrypt .aut file passwords</li> <li>Integrated SessionID into server</li> <li>Automatic detection/parsing of session user cookies (as $ENV_COOKIE?)</li> <li>LRWP support</li> </ul> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479923" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.xitami.com/wiki:security-and-access-control</guid>
				<title>Security and Access Control</title>
				<link>http://www.xitami.com/wiki:security-and-access-control</link>
				<description>

&lt;p&gt;A web server is only as good as its security.&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479923&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 18 Feb 2009 13:43:18 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>A web server is only as good as its security.</p> <h3><span>Overview</span></h3> <p>Xitami controls access to resources by applying <em>access control policies</em> that you define, as system administrator. In general terms, Xitami works through the list of all defined policies until it either gets a firm &quot;deny&quot; or &quot;allow&quot; for the current request.</p> <p>The general order of things after an incoming request has been validated, is to:</p> <ol> <li>First, reject any known bad IP addresses (that is, spammers and hackers).</li> <li>Second, reject certain types of access, such as image hotlinking.</li> </ol> <p>Policies can do various things:</p> <ol> <li>Deny an address based on a blacklist.</li> <li>Deny or allow the current request based on IP address or the value of certain HTTP headers.</li> <li>Request that the current user be authenticated via Basic or Digest authentication.</li> <li>Allow or deny authenticated users according to group.</li> <li>Automatically ban the current IP address based on the request URI.</li> </ol> <h3><span>Predefined policies</span></h3> <p>Policies are named. Xitami provides a set of default policies. You can redefine these in the xitami.cfg file. These are the default policies:</p> <div class="code"> <pre> <code>&lt;config&gt; &lt;access config_meta = &quot;discrete&quot;&gt; &lt;!-- Apply blacklist --&gt; &lt;policy name = &quot;blacklist&quot;&gt; &lt;from value = &quot;127.0.0.1&quot;&gt; &lt;skip /&gt; &lt;/from&gt; &lt;blacklist&gt; &lt;deny code = &quot;503&quot; text = &quot;Server overloaded&quot; /&gt; &lt;/blacklist&gt; &lt;/policy&gt; &lt;!-- Detect hostile requests, auto-ban offending IP addresses --&gt; &lt;policy name = &quot;auto-ban&quot;&gt; &lt;!-- Attempt to smash the server with long requests --&gt; &lt;detect limit = &quot;255&quot; comment = &quot;long request line&quot; /&gt; &lt;!-- Attempts at injections via the URI --&gt; &lt;detect value = &quot;%3Cscript&quot; comment = &quot;script injection&quot; /&gt; &lt;detect value = &quot;%3Cform&quot; comment = &quot;form injection&quot; /&gt; &lt;detect value = &quot;%20or&quot; comment = &quot;SQL injection&quot; /&gt; &lt;detect value = &quot;%20and&quot; comment = &quot;SQL injection&quot; /&gt; &lt;detect value = &quot;%20select&quot; comment = &quot;SQL injection&quot; /&gt; &lt;detect value = &quot;%20drop&quot; comment = &quot;SQL injection&quot; /&gt; &lt;!-- Attempts to navigate outside the web root --&gt; &lt;detect value = &quot;..&quot; comment = &quot;path climbing&quot; /&gt; &lt;detect value = &quot;%5c&quot; comment = &quot;Win32 paths&quot; /&gt; &lt;detect value = &quot;~&quot; comment = &quot;Unix paths&quot; /&gt; &lt;!-- Probe to see if we're a proxy server --&gt; &lt;detect value = &quot;http://&quot; comment = &quot;proxy probe&quot; /&gt; &lt;default&gt; &lt;echo&gt;W: hostile request from $from ($comment), blacklisting&lt;/echo&gt; &lt;echo&gt;W: request='$request'&lt;/echo&gt; &lt;ban /&gt; &lt;deny code = &quot;503&quot; text = &quot;Server overloaded&quot; /&gt; &lt;/default&gt; &lt;/policy&gt; &lt;!-- Deny hotlinking to /local URIs --&gt; &lt;policy name = &quot;coldlink&quot; uri = &quot;/local&quot;&gt; &lt;!-- Not proof against referrer fraud but good for most cases --&gt; &lt;local&gt; &lt;allow /&gt; &lt;/local&gt; &lt;always&gt; &lt;deny /&gt; &lt;/always&gt; &lt;/policy&gt; &lt;!-- Secure the /private area --&gt; &lt;policy name = &quot;private&quot; uri = &quot;/private&quot;&gt; &lt;always&gt; &lt;authenticate mechanism = &quot;basic&quot; realm = &quot;Private&quot; /&gt; &lt;/always&gt; &lt;group value = &quot;users&quot;&gt; &lt;allow /&gt; &lt;/group&gt; &lt;/policy&gt; &lt;!-- By default other resources are public --&gt; &lt;policy name = &quot;default&quot;&gt; &lt;always&gt; &lt;allow /&gt; &lt;/always&gt; &lt;/policy&gt; &lt;/access&gt; &lt;/config&gt;</code> </pre></div> <h3><span>Policy language</span></h3> <p>The access module excecutes all defined policies, except the policy named &quot;default&quot;, in order, stopping either when it has executed all policies, or has a 'deny' or 'allow' action. It will execute the default policy if no other policy provides a 'deny' or 'allow' action. If there are no policies which return a 'deny' or 'allow', the built in default action is 'deny'.</p> <p>The policy item can take these options:</p> <ul> <li><strong>uri</strong> - if specified, the policy applies only if the requested URI starts with this value. By default the policy applies all URIs.</li> </ul> <p>Each policy consists of a series of <em>rules</em> which contain <em>actions</em>. The access module processes the rules in struct order in a <em>single pass</em>. Rules are tests, which can pass or fail. If the rule passes, the access module executes the actions. A 'deny', 'allow', 'ban', or 'redirect' action ends processing of the actions, rules, and policies.</p> <p>The rules are somewhat like 'if' statements in a scripting language. The goal of this design is to make policy writing easier than the multi-pass design used by some web servers.</p> <p>The allowed rules are:</p> <ul> <li>&lt;blacklist&gt; - check if the IP address of the client application is blacklisted.</li> <li>&lt;from value = &quot;pattern&quot;&gt;&#8230;&lt;/from&gt; - check the IP address of the client application.</li> <li>&lt;header name = &quot;name&quot; value = &quot;pattern&quot;&gt;&#8230;&lt;/header&gt; - check the value of a specific request header.</li> <li>&lt;local&gt;&#8230;&lt;/local&gt; - check if the referrer is the current host.</li> <li>&lt;detect value = &quot;string&quot; limit = &quot;length&quot;&gt;&#8230;&lt;/detect&gt; - check if the request contains the specified value, or is longer than the specified size.</li> <li>&lt;group value = &quot;pattern&quot;&gt;&#8230;&lt;/group&gt; - check if the user is authenticated and in some group.</li> <li>&lt;always&gt;&#8230;&lt;/always&gt; - always execute the actions.</li> <li>&lt;default&gt;&#8230;&lt;/default&gt; - executes the actions for any successful rule that has <em>no</em> actions.</li> </ul> <p>The detect value is case insensitive. The detect rule allows a 'comment' attribute that is available for &lt;echo&gt; statements as $comment. The from and group patterns use the Unix wildcard syntax, where '*' matches zero or more instances of any character and '?' matches one instance of any character. The from pattern can also be a <a href="http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDR</a> specification, e.g:</p> <p>[[code]<br /> &lt;from value = &quot;64.182.*&quot; /&gt;<br /> &lt;from value = &quot;64.182.0.0/16&quot; /&gt;<br /> [[/code]]</p> <p>The allowed actions are:</p> <ul> <li>&lt;deny code = &quot;reply-code&quot; text = &quot;reply-text&quot; /&gt; - deny access to the resource. Default reply code is 403 - FORBIDDEN. Ends policy processing.</li> <li>&lt;allow /&gt; - allow access to the resource. Ends policy processing.</li> <li>&lt;authenticate mechanism = &quot;basic|digest&quot; [ realm = &quot;realmname&quot; ] /&gt; - attempts to authenticate the user using the Authorization credentials provided by the browser. If successful, continues policy processing. If not, returns a 401 UNAUTHORIZED response to the browers. The default mechanism is &quot;basic&quot;, and the default realm is the host name.</li> <li>&lt;redirect uri = &quot;uri&quot; /&gt; - redirects the browser to another URI, on the same or a different server, with a reply code 302 FOUND. The default uri is &quot;/&quot;. Ends policy processing.</li> <li>&lt;ban /&gt; - adds the browser's IP address to the blacklist. Ends policy processing.</li> <li>&lt;skip /&gt; - ends processing of this policy and continues with the next.</li> <li>&lt;echo&gt;Message text&lt;/echo&gt; - echoes a message to the console and log files. The message can contain substitution variables as defined below for access logs.</li> </ul> <h3><span>Blacklisting</span></h3> <p>Xitami maintains a single <em>blacklist</em> file that is applied to all incoming requests, as an in-built policy. The blacklist file (by default, &quot;blacklist.txt&quot;) consists of IP addresses, one per line. Whitespace, and any portion of lines starting with '#' are ignored.</p> <p>The <em>ban</em> rule adds an IP address to the blacklist file. If you want to track bans, use the &lt;echo&gt; action with text that is easy to find using a tool like grep. Echoed text goes into the alert log file (logs/alert_nnnn.log).</p> <p>To identify and block specific IP addresses, you should use the &lt;blacklist&gt; rule, which is very fast, rather than the &lt;from&gt; rule. The &lt;from&gt; rule is suitable for blocking groups of IP addresses (specified by wildcard). Note that the built-in blacklist policy always allows 127.0.0.1 (the local machine) to pass, even if that address has been blacklisted.</p> <p>Xitami automatically reloads modified blacklist files, and you can safely edit, delete, or replace the blacklist file at any time while the server is running. For example, here we start Xitami, then delete the blacklist.txt file, then re-create it with two banned addresses. This shows Xitami's console output:</p> <div class="code"> <pre> <code>2009-01-01 15:26:15: I: loaded configuration from ./http_base.cfg 2009-01-01 15:26:15: I: merged configuration from ./xitami.cfg 2009-01-01 15:26:15: I: blacklist file 'blacklist.txt' loaded (Thu, 01 Jan 2009 14:21:53 UTC, 1 entries) 2009-01-01 15:26:15: I: hostname is nb200802 (127.0.1.1) 2009-01-01 15:26:15: I: listening on port 8080, all network interfaces 2009-01-01 15:26:15: I: initializing HTTP/file plugin on '/' 2009-01-01 15:26:15: I: - serving files from 'webpages' directory 2009-01-01 15:26:16: I: ready for incoming HTTP requests 2009-01-01 15:26:35: W: blacklist file 'blacklist.txt' not found, or unreadable 2009-01-01 15:27:12: I: blacklist file 'blacklist.txt' loaded (Thu, 01 Jan 2009 14:27:11 UTC, 2 entries)</code> </pre></div> <p>Since reloading a very large blacklist file may take some resources, Xitami does this at most every 5 seconds. You can tune this time (called the &quot;nervosity&quot;) using the '&#8212;nervosity' command line option:</p> <div class="code"> <pre> <code>./xitami --nervosity 1 -X &quot;run a very nervous server&quot;</code> </pre></div> <h3><span>The auto-ban policy</span></h3> <p>The auto-ban policy detects the most frequent attempts to subvert your web server by sending it unfriendly requests. Xitami likes to shoot first and ask questions later, so any IP address (except 127.0.0.1, which is &quot;you&quot;) trying these requests gets immediately blacklisted. Here is a Perl program that tries them all:</p> <div class="code"> <pre> <code>#!/usr/bin/perl # Perl script to test various hostile requests use LWP::UserAgent; my $ua = new LWP::UserAgent; $ua-&gt;agent ('HTTP/Tests'); hostile (&quot;index.html?&quot; . sprintf (&quot;%80s&quot;, &quot;*&quot;)); hostile (&quot;index.html?&lt;script&gt;&quot;); hostile (&quot;index.html?&lt;form&gt;&quot;); hostile (&quot;index.html? or&quot;); hostile (&quot;index.html? and&quot;); hostile (&quot;index.html? select&quot;); hostile (&quot;index.html? drop&quot;); hostile (&quot;../index.html&quot;); hostile (&quot;c:\\win32\\system&quot;); hostile (&quot;~/bin/sh&quot;); # Probe server to see if we can use it as a proxy $ua-&gt;proxy('http', 'http://localhost:8080/'); hostile (&quot;/&quot;); sub hostile { my ($uri) = @_; $request = HTTP::Request-&gt;new (GET =&gt; &quot;http://localhost:8080/$uri&quot;); $response = $ua-&gt;request ($request); $response-&gt;code == 503 || die; }</code> </pre></div> <p>This what Xitami reports:</p> <div class="code"> <pre> <code>2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (long request line), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%20%20%20%20...20%20%20%20%20* HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (script injection), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%3Cscript%3E HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (form injection), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%3Cform%3E HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (SQL injection), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%20or HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (SQL injection), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%20and HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (SQL injection), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%20select HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (SQL injection), blacklisting 2009-01-02 13:28:01: W: request='GET /index.html?%20drop HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (path climbing), blacklisting 2009-01-02 13:28:01: W: request='GET /../index.html HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (Win32 paths), blacklisting 2009-01-02 13:28:01: W: request='GET /c:%5Cwin32%5Csystem HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (Unix paths), blacklisting 2009-01-02 13:28:01: W: request='GET /~/bin/sh HTTP/1.1' 2009-01-02 13:28:01: W: hostile request from 127.0.0.1 (proxy probe), blacklisting 2009-01-02 13:28:01: W: request='GET http://localhost:8080// HTTP/1.1'</code> </pre></div> <p>Note that the limit on requests is 255 chars, which is very strict. However, passing over-long requests is a favourite way to break into a web server. Properly written web applications pass long data via the content body (POST data), not the request line.</p> <p>After all this fun, the blacklist.txt file contains:</p> <div class="code"> <pre> <code>127.0.0.1</code> </pre></div> <p>Which the server loads but patiently ignores, as defined by the blacklist policy. Which you can change, as we explain next.</p> <h3><span>Custom policies</span></h3> <p>You write custom policies in xitami.cfg (the usual configuration file). There are two things you can do:</p> <ol> <li>Write new policies that are executed after the built-in ones.</li> <li>Replace the built-in policies with your own versions.</li> </ol> <p>Write your custom policies using the policy syntax explained above, as &lt;policy&gt; items within an &lt;access&gt; item. The general format for any custom policies is:</p> <div class="code"> <pre> <code>xitami.cfg: &lt;?xml?&gt; &lt;config&gt; &lt;access&gt; &lt;policy name = &quot;policy-name&quot;&gt; rules &lt;/policy&gt; &lt;/access&gt; &lt;/config&gt;</code> </pre></div> <p>Where there are usually other config items before and/or after the &lt;access&gt; item, and there will usually be multiple policies. Here are some examples of custom policies (assuming the general format we just explained:</p> <p>To change the default policy to deny access to any unauthenticated users:</p> <div class="code"> <pre> <code>&lt;policy name = &quot;default&quot;&gt; &lt;always&gt; &lt;allow /&gt; &lt;/always&gt; &lt;/policy&gt;</code> </pre></div> <p>To change the authentication mechanism on /private from Basic to Digest:</p> <div class="code"> <pre> <code>&lt;!-- Secure the /private area --&gt; &lt;policy name = &quot;private&quot; uri = &quot;/private&quot;&gt; &lt;always&gt; &lt;authenticate mechanism = &quot;digest&quot; realm = &quot;Private&quot; /&gt; &lt;/always&gt; &lt;group value = &quot;users&quot;&gt; &lt;allow /&gt; &lt;/group&gt; &lt;/policy&gt;</code> </pre></div> <p>To rewrite the blacklist policy:</p> <div class="code"> <pre> <code>&lt;policy name = &quot;blacklist&quot;&gt; &lt;blacklist&gt; &lt;echo&gt;Denied access to $from (blacklisted address)&lt;/echo&gt; &lt;deny code = &quot;503&quot; text = &quot;Server overloaded&quot; /&gt; &lt;/blacklist&gt; &lt;/policy&gt;</code> </pre></div> <p>Note that to change a built-in policy you need to rewrite it completely, there is no sensible way to merge custom and existing policies.</p> <h3><span>Authentication</span></h3> <p>Xitami uses the Apache <em>htpasswd</em> and <em>htdigest</em> file formats. To create password files in these formats, install those tools from Apache. On Debian Linux, do:</p> <div class="code"> <pre> <code>$ sudo apt-get install apache2-utils</code> </pre></div> <p>If you cannot or do not want to use the Apache tools, you can create a plain (unencrypted) htpasswd file by specifying each user name and password on a new line, separated by a colon, e.g.:</p> <div class="code"> <pre> <code>Kossi:secrets-are-better-shared Affi:lets-hope-it-works-this-time Admin:super-password</code> </pre></div> <p>Xitami will nag you if you use plain text passwords, but it's better than no authentication at all. You can also create password files in various languages. For details on the format of the htpasswd and htdigest files and examples of how to create these in PHP, Java, Ruby and C/C++, see <a href="http://httpd.apache.org/docs/2.2/misc/password_encryptions.html">the Apache documentation</a>.</p> <h3><span>User groups</span></h3> <p>Currently, user groups are not implemented and Xitami hard-defines the group &quot;users&quot;.</p> <h3><span>Debugging policies</span></h3> <p>Since policies are somewhat like a (very simple) security scripting language, Xitami gives you a way to debug them. Start the server with the &quot;&#8212;policy_trace 1&quot; command line option, and then run your specific test cases. Here is a typical test case, written in Perl:</p> <div class="code"> <pre> <code>#!/usr/bin/perl # Simple Perl script to test script injection attack use LWP::UserAgent; my $ua = new LWP::UserAgent; $ua-&gt;agent ('HTTP/Tests'); $request = HTTP::Request-&gt;new (GET =&gt; &quot;http://localhost:8080/index.html?&lt;script&gt;&quot;); $response = $ua-&gt;request ($request); print $response-&gt;status_line . &quot;\n&quot;;</code> </pre></div> <p>And this is what the server reports, when run with '&#8212;policy_trace 1' (some output removed for clarity):</p> <div class="code"> <pre> <code>ph@nb200802:~/work/trunk/base2/http$ ./xitami --policy_trace 1 Xitami/5.0 Copyright (c) 1996-2009 iMatix Corporation 2009-01-02 12:19:22: I: loaded configuration from ./http_base.cfg 2009-01-02 12:19:22: I: merged configuration from ./xitami.cfg 2009-01-02 12:19:22: I: listening on port 8080, all network interfaces 2009-01-02 12:19:23: I: ready for incoming HTTP requests 2009-01-02 12:19:26: P: starting policy check on request 'GET /index.html?%3Cscript%3E HTTP/1.1' 2009-01-02 12:19:26: P: executing 'blacklist' policy 2009-01-02 12:19:26: P: executing rule 'blacklist' 2009-01-02 12:19:26: P: executing 'auto-ban' policy 2009-01-02 12:19:26: P: executing rule 'detect' 2009-01-02 12:19:26: P: rule match: request contains '%3Cscript' 2009-01-02 12:19:26: P: execute action 'echo' 2009-01-02 12:19:26: W: hostile request from 127.0.0.1 (script injection), blacklisting 2009-01-02 12:19:26: P: execute action 'echo' 2009-01-02 12:19:26: W: request='GET /index.html? %Cscript3.614564E-313 HTTP/1.1' 2009-01-02 12:19:26: P: execute action 'ban' 2009-01-02 12:19:27: I: blacklist file 'blacklist.txt' loaded (Fri, 02 Jan 2009 11:19:26 UTC, 1 entries)</code> </pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479923" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.xitami.com/wiki:summary-of-features</guid>
				<title>Summary of Features</title>
				<link>http://www.xitami.com/wiki:summary-of-features</link>
				<description>

&lt;p&gt;Xitami/5 is a simple web server which focuses on security and ease of use. These are the key features explained in this document:&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=99&amp;amp;size=small&amp;amp;timestamp=1328479923&quot; alt=&quot;pieterh&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=99)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/pieterh&quot;  &gt;pieterh&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Wed, 18 Feb 2009 13:42:36 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Xitami/5 is a simple web server which focuses on security and ease of use. These are the key features explained in this document:</p> <ul> <li>Basic and Digest authentication mechanisms using Apache-compatible password files;</li> <li>Standard (NSCA, W3C) and customisable access logs;</li> <li>Scriptable access control using easy-to-write policy language;</li> <li>Predefined access policies: apply blacklist, block hotlinking, private web area;</li> <li>Allow/deny access depending on: client IP address, request headers, user group;</li> <li>Auto-ban for script &amp; form injections, path climbing, proxy probes, over-sized requests.</li> </ul> <p>The on-line help ('xitami &#8212;help') explains how to configure further aspects of the server through a set of command-line options:</p> <div class="code"> <pre> <code> --server_name Announced server name --port Server port for HTTP requests --public_port Public port for HTTP requests --trace Trace network traffic? --animate Animate HTTP agent? --verbose Verbose output? --listen Address (local network interface) to listen on --webroot Path to web root directory --index Index file name --default_types Default document types --monitor Monitor interval, seconds --record_stats Record performance statistics --log_path Active log file directory --keep_logs Keep log files --archive_path Archive log file directory --archive_cmd Archive log file command --alert_log Error log file name --access_log Access log file name --access_log_format Access log file format --debug_log Debug log file name --basic_auth Basic authentication filename --digest_auth Digest authentication filename --blacklist Blacklist filename --policy_trace Debug policy execution? --nervosity Security nervosity, seconds --header_max Max size of HTTP header --bucket_max Max size of content bucket --read_timeout Network read timeout, seconds --write_timeout Network write timeout, seconds --tcp_nodelay TCP/IP NODELAY option --tcp_rcvbuf TCP/IP receive buffer, in bytes --tcp_sndbuf TCP/IP send buffer, in bytes --polling_threads Number of polling OS threads --working_threads Number of working OS threads</code> </pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/pieterh" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=99&amp;size=small&amp;timestamp=1328479923" alt="pieterh" style="background-image:url(http://www.wikidot.com/userkarma.php?u=99)" /></a><a href="http://www.wikidot.com/user:info/pieterh" >pieterh</a></span></p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>
