<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Notes</title>
	<atom:link href="http://notes.endnode.se/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.endnode.se</link>
	<description></description>
	<lastBuildDate>Sun, 25 Jul 2010 22:14:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Proxy for personal web filtering</title>
		<link>http://notes.endnode.se/2010/06/proxy-for-personal-web-filtering/</link>
		<comments>http://notes.endnode.se/2010/06/proxy-for-personal-web-filtering/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 13:49:25 +0000</pubDate>
		<dc:creator>Peter Hultqvist</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[monodevelop]]></category>
		<category><![CDATA[personal-proxy]]></category>
		<category><![CDATA[privacy]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://notes.endnode.se/?p=259</guid>
		<description><![CDATA[Moving from Firefox to Chromium I found it difficult to transfer all filtering and adblocking tweaks that was done in firefox using extensions. Some of them wasn&#8217;t even possible like prevent content from being downloaded. I have also had other ideas of how web filtering can be done which so far could not be found [...]]]></description>
			<content:encoded><![CDATA[<p>Moving from <a href="http://firefox.com">Firefox</a> to <a href="http://www.chromium.org/Home">Chromium</a> I found it difficult to transfer all filtering and adblocking tweaks that was done in firefox using extensions. Some of them wasn&#8217;t even possible like <a href="http://code.google.com/p/chromium/issues/detail?id=6975">prevent content from being downloaded</a>. I have also had other ideas of how web filtering can be done which so far could not be found in any current implementation.</p>
<p><span id="more-259"></span></p>
<h2>The Proxy Solution</h2>
<p>The answer to these need is writing a new http proxy intended for personal use. The main goal of the proxy is a modular filtering design. These filters can be applied on both requests and responses. They can modify the requests before being sent and also totally block them.</p>
<p>Using a proxy makes it easier in the future for me to change browser and keep my filtering with minor setup. Even running multiple browsers at the same time using the same live settings would be possible.</p>
<p>By writing this program myself I will make it easier for me to later add one hour hacks that I want to try out.</p>
<h2>Program design</h2>
<p>I want the program to be easy to use for average users, probably a single executable where all configuration is done in the web interface.</p>
<p>To achieve this simplicity the bar for making additions to the program is raised. Filters are described as modules but they are build into the binary. New modules means a new binary, that will work by simply replacing the binary executable. For other developers this mean that when you write a new module it must be included into the source tree.<br />
This stand of &#8220;module&#8221; design  is untested and I will gladly accept any ideas on this. Practically there could be a more external modules design using dll or similar.</p>
<h2>Personal Proxy</h2>
<p>The project is named &#8220;Personal Proxy&#8221; and is available at BitBucket<a href="http://bitbucket.org/">.org</a> under <a href="http://bitbucket.org/phq/personal-proxy">phq/personal-proxy</a>.</p>
<p>The program i written in C# and developed in <a href="http://monodevelop.com/">Monodevelop</a> but it works in VisualStudio as welll.</p>
<p>Source code can be downloaded using the download links on the project page. However if your want to conrtibute I suggest you use <a href="http://mercurial.selenic.com/">mercurial</a> and get the source code from the bitbucket repo.</p>
<p>hg clone ﻿﻿﻿﻿<a href="https://bitbucket.org/phq/personal-proxy">https://bitbucket.org/phq/personal-proxy</a></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.endnode.se/2010/06/proxy-for-personal-web-filtering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inverse Privacy Pad</title>
		<link>http://notes.endnode.se/2010/02/inverse-privacy-pad/</link>
		<comments>http://notes.endnode.se/2010/02/inverse-privacy-pad/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 10:31:43 +0000</pubDate>
		<dc:creator>Peter Hultqvist</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[headers]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[privacy]]></category>

		<guid isPermaLink="false">http://notes.endnode.se/?p=224</guid>
		<description><![CDATA[From EFF:s latest initiative about browsers carrying identifying bits you can now test how many identifying bits your own browser has at Panopticlick. From this I got the idea for this online notepad. If you already know the basics in http you can skip to the privacy pad part. What your browser reveal about itself [...]]]></description>
			<content:encoded><![CDATA[<p>From EFF:s latest initiative about <a href="https://www.eff.org/deeplinks/2009/09/new-cookie-technologies-harder-see-and-remove-wide">browsers carrying identifying bits</a> you can now test how many identifying bits your own browser has at <a href="https://panopticlick.eff.org/">Panopticlick</a>. From this I got the idea for this online notepad.<span id="more-224"></span></p>
<p>If you already know the basics in http you can <a href="#ipp">skip to the privacy pad part</a>.</p>
<h2>What your browser reveal about itself</h2>
<p>For every page you visit, your browser must first download the page. This is done by sending a request to the server that usually looks like this:</p>
<p><code>GET / HTTP/1.1<br />
Host: notes.endnode.se<br />
User-Agent: <strong>Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.2pre) Gecko/20100130 Ubuntu/9.10 (karmic) Namoroka/3.6.2pre</strong><br />
Accept: <strong>text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</strong><br />
Accept-Language: <strong>en-us,en;q=0.7,sv;q=0.3</strong><br />
Accept-Encoding: <strong>gzip,deflate</strong><br />
Accept-Charset: <strong>UTF-8,*</strong><br />
Keep-Alive: 115<br />
Connection: keep-alive<br />
</code></p>
<p>This is sent with every request for each html page, css-stylesheet and image that is requested. Especially the User-Agent line is mostly addressed since it is not only complex in contents but also that this varies a lot between different computers.</p>
<p>These headers can be combined into a fingerprint that the browser will reveal with every request.</p>
<h2><a name="ipp"></a>Inverse Privacy Pad</h2>
<p>The <a href="http://privacy.endnode.se/pad.php">inverse privacy pad</a> is an online notepad where you can write some notes and save them for later. Each visitor is presented a notepad based on their browsers fingerprint. This way every visitor will see a different text in their where their browser configuration differs.</p>
<p style="text-align: center;"><img class="aligncenter size-medium wp-image-227" title="privacy-pad" src="http://notes.endnode.se/wp-content/uploads/2010/02/privacy-pad-300x183.png" alt="Web browsers recieveing different notepads depending on their user-agent" width="300" height="183" /></p>
<p style="text-align: left;">Notes saved can only be accessed by others using the exact same configuration(or faking the same headers). Therefore the more unique your browser is, the easier you will be to track but you can be sure that there is a less chance for others to read you notes on this page.</p>
<p style="text-align: left;">Try it out yourself at the <a href="http://privacy.endnode.se/pad.php">inverse privacy pad</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.endnode.se/2010/02/inverse-privacy-pad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event based programming</title>
		<link>http://notes.endnode.se/2010/01/event-based-programming/</link>
		<comments>http://notes.endnode.se/2010/01/event-based-programming/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 21:04:27 +0000</pubDate>
		<dc:creator>Peter Hultqvist</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[event-programming]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[proof-of-concept]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[thread]]></category>

		<guid isPermaLink="false">http://notes.endnode.se/?p=167</guid>
		<description><![CDATA[Let&#8217;s write a simple tcp server/terminal. Usually my way of thinking must be adapted to the programming language being used. This is my small attempt to modify how the language works to my thinking. I call it event based problem solving. First of all, this is not a typical example of writing a tcp server [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s write a simple tcp server/terminal. Usually my way of thinking must be adapted to the programming language being used. This is my small attempt to modify how the language works to my thinking. I call it event based problem solving.</p>
<p><span id="more-167"></span><em>First of all, this is not a typical example of writing a tcp server in python. As a beginner you might still be able to get some knowledge, but to be able to understand the whole example you must understand threads and python decorators.</em></p>
<p>I want a program that listens on a tcp port. When a remote connection is established it will be connected to the terminal so that when I type on the terminal it is sent to the remote machine and when the remote machine send text it is printed on the terminal. Think of it as a reversed telnet client.</p>
<h2>My intuitive solution</h2>
<p>To make this work I need one function that listens for new connections, waitConnect(). When I get this new connection I initiate two new functions. First socket_reader() which read all incoming data and print it to the screen, stdout.write() and then terminal_reader() which will read what I type and send it to the connection, con.send(). Here is what it looks like:</p>
<div id="attachment_208" class="wp-caption aligncenter" style="width: 291px"><a href="https://notes.endnode.se/wp-content/uploads/2010/01/tcp.png"><img class="size-full wp-image-208" title="tcp" src="https://notes.endnode.se/wp-content/uploads/2010/01/tcp.png" alt="" width="281" height="180" /></a><p class="wp-caption-text">Simple TCP server</p></div>
<h3>The code</h3>
<p>A simplified version, without error checking, looks like this:</p>
<pre>def terminal_reader(con):
	while True:
		line = sys.stdin.readline()
		con.send(line.encode('utf-8'))
def socket_reader(con):
	while True:
		data = con.recv(1)
		sys.stdout.write(data.decode('utf-8'))
def waitConnect(s):
	while True:
		connection, address = s.accept() #
		sr = socket_reader(connection)
		tr = terminal_reader(connection)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(("127.0.0.1", 8082))
s.listen(5)
waitConnect(s)</pre>
<h2>Simple right?</h2>
<p>Everyone who is somewhat familiar with programming have already noticed that there is something missing. Ordinary functions would not work alone.</p>
<p>Many of the internal function calls within our functions are blocking, such as accept(), readline() and recv(). Without threads it is impossible to use blocking functions and still have the program responsive to both tcp input and terminal input at the same time.</p>
<h2>Event magic</h2>
<p>To make this possible we will do some slight modification to our program. We add the decorator <strong>@ed.function</strong> to all our three functions and in the end of our code we add ed.join(). Finally we must also add an import ed in the beginning of the code.</p>
<p>The ed is a library I wrote in python to accomplish something similar to the example above. It initiates a queue and a number of worker threads. The @ed.function decoration modifies the functions so that instead of being called immediately they will be queued. The worker threads will then run each function call. Finally the ed.join() will wait until the queue is empty and then exit.</p>
<p>What we have now is events in the form of function calls.</p>
<p>This is a proof-of-concept with only the basic functions as presented here. The code can be downloaded using <strong>&#8220;git clone <a href="http://src.endnode.se/git/event-demo">http://src.endnode.se/git/event-demo</a>&#8220;</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.endnode.se/2010/01/event-based-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Encrypted backup design</title>
		<link>http://notes.endnode.se/2010/01/encrypted-backup-design/</link>
		<comments>http://notes.endnode.se/2010/01/encrypted-backup-design/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 19:08:21 +0000</pubDate>
		<dc:creator>Peter Hultqvist</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://notes.endnode.se/?p=196</guid>
		<description><![CDATA[This is the first draft of the structural design behind the new backup solution called b4f. Currently the main goal is to have a system for encrypted off-site backup allowing for incremental backups. This will be a slightly technical post, but remember that anything, even the goals, can change. The goals in more detail: Encrypted [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first draft of the structural design behind the new backup solution called <a title="Backup for Friends" href="/b4f/">b4f</a>.</p>
<p>Currently the main goal is to have a system for encrypted off-site backup allowing for incremental backups.</p>
<p>This will be a slightly technical post, but remember that anything, even the goals, can change.</p>
<p><span id="more-196"></span>The goals in more detail:</p>
<ul>
<li>Encrypted &#8211; the backup might be stored on less trusted locations</li>
<li>Effective storage &#8211; incremental backup</li>
<li>Redundancy &#8211; have the backup stored on multiple locations</li>
<li>Traffic efficiency &#8211; allow to share the data between storage servers to minimize the traffic to the local storage</li>
<li>Local storage servers as well as remote, friends computers, removable disks or purchased networked storage</li>
<li>Share data among users, once the backup is already on a friends computer, sharing it will be much faster</li>
<li>Data instead of connection focused &#8211; the &#8220;protocol&#8221; should work offline without direct connection between server and client.</li>
</ul>
<h2>Server &#8211; Client design overview</h2>
<p>The design will be separated into two parts. The local client and the storage server.</p>
<p>The client will handle the filesystem, determine what to backup, preparing the data to be backed-up, keeping the cryptographic keys as well as deciding how the backups should be distributed.</p>
<p>The server will not work with files as the client, instead it will work with smaller units of data, called chunks, that the client prepares. The main task for the server will be to receive and store these units as well as distribute them when requested by the client.</p>
<p>Therefore the communication between the server and client is only about chunks, no files, therefore the system might be used to store other kind of data other than files.</p>
<h2>Local file-system</h2>
<div id="attachment_195" class="wp-caption alignright" style="width: 112px"><a href="https://notes.endnode.se/wp-content/uploads/2010/01/Snapshot.png"><img class="size-full wp-image-195" title="Snapshot" src="https://notes.endnode.se/wp-content/uploads/2010/01/Snapshot.png" alt="" width="102" height="155" /></a><p class="wp-caption-text">Snapshot</p></div>
<p>This is partly specific to the client. Other implementations might function differently and still be able to work with the same server.</p>
<p>One or more folders are selected to be backed-up. These will be indexed into a traditional file tree. Each file will be stored in a specific file structure. This tree with all its file meta-data will be combined into a snapshot. This snapshot will itself be in the form of a chunk that will be described later.</p>
<p>The client can further have other features such as automatic monitoring and backup.</p>
<h2>File storage</h2>
<div id="attachment_193" class="wp-caption aligncenter" style="width: 250px"><a href="https://notes.endnode.se/wp-content/uploads/2010/01/File.png"><img class="size-medium wp-image-193 " title="File" src="https://notes.endnode.se/wp-content/uploads/2010/01/File-240x300.png" alt="" width="240" height="300" /></a><p class="wp-caption-text">File structure</p></div>
<p>A file will have the most basic attributes such as name and change date.</p>
<p>The more specific part here is that the file will be split into several chunks. These will be the fundamental storage unit in the final backup system.</p>
<p>Thus the file structure only contain the ID to fnd these chunks, not their data.</p>
<h2>Chunk</h2>
<div id="attachment_192" class="wp-caption aligncenter" style="width: 309px"><a href="https://notes.endnode.se/wp-content/uploads/2010/01/Chunk.png"><img class="size-medium wp-image-192" title="Chunk" src="https://notes.endnode.se/wp-content/uploads/2010/01/Chunk-299x161.png" alt="" width="299" height="161" /></a><p class="wp-caption-text">Chunk</p></div>
<p>Each chunk is a piece of data from the file that is encrypted before being sent to the remote backup.</p>
<p>There is two parts identifying the data. First the ID that is an encrypted hash of the cleartext data. The second part is a hash of the encrypted data. There is also an encrypted key that follows each chunk that is used to decrypt the data.</p>
<p>The ID and decryption key comes in pairs for each chunk. Every new pair represents a new local key-change or a new user that is given access to the data.</p>
<p>The shared ID principle is used to make it possible for a single server to identify identical chunks of data that does not have to be transferred. One problem with current design is that M might upload false data with a specific chunk id that correlates to some data that A might later upload. When A is going to upload the correct data the server will believe it already has got the data and stop the upload. Thus the true data will not be backed-up. So far there is no way for the server to verify the ID hash since it does not have access to the data. <strong>Comments on this is very appreciated.</strong></p>
<h2>Order</h2>
<p>Since the design will work with both online and offline transports we introduce the order.</p>
<p>An order is a document signed by one user. The document states what chunks a specific server will store or release.</p>
<div id="attachment_194" class="wp-caption alignright" style="width: 310px"><a href="https://notes.endnode.se/wp-content/uploads/2010/01/Order.png"><img class="size-medium wp-image-194 " title="Order" src="https://notes.endnode.se/wp-content/uploads/2010/01/Order-300x223.png" alt="" width="300" height="223" /></a><p class="wp-caption-text">Order</p></div>
<p>The figure is currenlty missing target server to which the order applies.</p>
<p>Once a server receives an order it will start filling up with the chunks. They can come from the client computer or another server. Since the order verifies the data there is no need to further verify from where the data comes. Therefore an order with its chunks payload may be transferred on a removable disk and later uploaded to the server from an insecure machine.</p>
<p>The main operation can be one of the following:</p>
<ul>
<li>Put &#8211; store data on the server</li>
<li>Get &#8211; retrieve data from the server</li>
<li>Update &#8211; add new keys and ID:s to existing chunks</li>
</ul>
<p>Some additional conditions could be included in the order such as expire date.</p>
<p>In the end the order contain a list of Chunk ID:s that indicate what chunks this order affects.</p>
<h3>Put</h3>
<p>A put order authorizes that the server may store the listed chunks on the server. The server may get these from the users local machine but could also retrieve them from other servers.</p>
<h3>Get</h3>
<p>A get order authorized retrieval of data. This indicates that one user or server is allowed to retrieve the chunks from that server.</p>
<p>Although you must have the private key to decrypt the data, it is still of interest to limit ones access to this data.</p>
<h3>Update</h3>
<p>This order updates the chunks with more pairs of key and ID from new users.</p>
<h2>Key handling</h2>
<p>We have not been specific in this first draft about what keys there are, but we still have a few thoughts.</p>
<p>The system will be setup so that a secret key for decryption can be stored elsewhere. This key will be the only one necessary to restore the backup from a new computer.</p>
<p>There could be only one pair of asymmetric keys for both encryption and hash signing, or they could be two different.</p>
<h2>Similar protocols</h2>
<p>The previous post <a title="Permanent Link to Inspiration for swarm storage" rel="bookmark" href="http://notes.endnode.se/2009/03/inspiration-for-swarm-storage/">Inspiration for swarm storage</a>, was the initial inspiration for this design. Some of the goals from that post have been met.</p>
<p>So far the server has been described as an active one with a specific software that verifies signatures and minimize the traffic. Another option is still to use an existing service such as a ftp account. This would then need ftp support into the client.</p>
<p>Furthermore the snapshot might have more similarities with the bittorrent protocol and could thus be modified to be able to use existing trackers to initiate communication between client and servers.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.endnode.se/2010/01/encrypted-backup-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Measuring delay in webserver response</title>
		<link>http://notes.endnode.se/2010/01/measuring-delay-in-webserver-response/</link>
		<comments>http://notes.endnode.se/2010/01/measuring-delay-in-webserver-response/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 20:26:33 +0000</pubDate>
		<dc:creator>Peter Hultqvist</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[gplv3]]></category>
		<category><![CDATA[monitor]]></category>
		<category><![CDATA[optimizing]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://notes.endnode.se/?p=169</guid>
		<description><![CDATA[This is how to measure a webserver delay from the request to the first response. Thus it will only measure the time within the server, not the network delays. It is done using tcpdump to collect the data and a program I have written to extract the response time. This will monitor the delay between [...]]]></description>
			<content:encoded><![CDATA[<p>This is how to measure a webserver delay from the request to the first response. Thus it will only measure the time within the server, not the network delays.</p>
<p>It is done using tcpdump to collect the data and a program I have written to extract the response time.</p>
<p><span id="more-169"></span>This will monitor the delay between the clients request and the first response from the webserver. It works with other services as well as long as they follow the same request-response pattern as in http.</p>
<h2>Recording</h2>
<p>The recoding on the server is done using <a title="TCP Dump tutorial" href="http://danielmiessler.com/study/tcpdump/">tcpdump</a>. Run the following shell command as root to store the result into <strong>web.log</strong>.</p>
<p><code>tcpdump -tt -p -n "port 80 and tcp[13] &amp; 8 != 0" &gt; web.log</code></p>
<p>This will listen for packets on the first interface, if you want to specify which one, use &#8220;-i eth0&#8243;.</p>
<p>-tt will print the timestamp unformated.</p>
<p>-p makes sure the interface is not in promiscuous mode, which we don&#8217;t need since we know exactly what we are listening for.</p>
<p>-n will output all addressas in number format, no dns lookups.</p>
<p><code>Finally comes the filter that tells tcpdump what packages to record.</code></p>
<p><code>port 80 - only capture package to or from port 80 - our web server is at that port.<br />
</code></p>
<p><code>tcp[13] &amp; 8 != 0</code><code> - only capture packages with payload/data. This will discard all other packages used to initiate the connection and ACK.<br />
</code></p>
<h2>Extraction</h2>
<p>The program called <a title="Download webresponse.exe" href="http://lab.endnode.se/download/webresponse.exe"><em>webresponse</em></a> will parse the log using the following command:</p>
<p><code>cat response.log | mono webresponse.exe 123.123.123.123 &gt; delay.log</code></p>
<p>The output looks something like this:</p>
<pre>1263241029.252353 1.05
1263241030.639528 0.924
1263241031.623903 2.212
1263241032.659558 118.8014
1263241032.974350 12.255
1263241034.054304 1.254
1263241036.442082 1.404</pre>
<p>First comes the unix time followed by the response delay in milliseconds.</p>
<h2>Source</h2>
<p>WebResponse source code can be downloaded using git from <a href="http://src.endnode.se/#webresponse">http://src.endnode.se/git/webresponse</a></p>
<p><code>git clone http://src.endnode.se/git/webresponse</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notes.endnode.se/2010/01/measuring-delay-in-webserver-response/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.317 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-31 12:30:40 -->
