<?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>Yet another web log</title>
	<atom:link href="http://blog.philippheckel.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.philippheckel.com</link>
	<description>Life, Linux and other things</description>
	<lastBuildDate>Tue, 24 Aug 2010 05:24:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Aware Context API (ACAPI) &#8211; Using the sensors in Java ME</title>
		<link>http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/</link>
		<comments>http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 05:43:33 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Java ME]]></category>
		<category><![CDATA[Symbian]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=481</guid>
		<description><![CDATA[The capabilities of cell phones increased dramatically in the last few years. While in the old days most mobile phones were primarily used to make phone calls, modern smart-phones are mostly all-round devices. With the possibility of accessing the Internet and the availability of various sensors (e.g. location or noise), mobile applications have become interactive [...]]]></description>
			<content:encoded><![CDATA[<p>The capabilities of cell phones increased dramatically in the last few years. While in the old days most mobile phones were primarily used to make phone calls, modern smart-phones are mostly all-round devices. With the possibility of accessing the Internet and the availability of various sensors (e.g. location or noise), mobile applications have become interactive and flexible. The trend towards location-based services and context-awareness allows applications to react on their surroundings and to behave intuitively towards the user.</p>
<p>For developers, context-awareness can be both a blessing and a curse. While the mobile operating systems iPhone OS and Android come with relatively good sensor-support, the vast majority of devices deal with Java ME&#8217;s basic and heterogeneous sensor functionalities.</p>
<p>The <strong>Aware Context API (ACAPI)</strong> aims to bridge this gap by providing a framework for building context aware applications for mobile devices based on Java ME. In this article, I&#8217;d like to introduce ACAPI, its structure and usage briefly. Please feel free to comment.</p>
<p><span id="more-481"></span></p>
<hr />
<b>Contents</b></p>
<div class="toc">
<ol>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Motivation-and-Goals">1. Motivation and Goals</a></li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Development-Team-and-Scope">2. Development Team and Scope</a></li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Aware-Context-API-ACAPI">3. Aware Context API (ACAPI)</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#ACAPI-Structure">3.1. ACAPI Structure</a></li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Implemented-Sensors">3.2. Implemented Sensors</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Example-Usage">4. Example Usage</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Example-Scenario-and-Code">4.1. Example Scenario and Code</a></li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Proof-of-Concept-Application">4.2. Proof-of-Concept Application</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Future-Work-and-Conclusion">5. Future Work and Conclusion</a></li>
<li><a href="http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/#Download-and-License">A. Download and License</a></li>
</ol>
</div>
<hr />
<h3 id="Motivation-and-Goals" >1. Motivation and Goals</h3>
<p>ACAPI is designed to allow easy and homogeneous access to the different sensors of the mobile device. It creates an abstraction between the available sensors and their usage so that developers can focus on the business logic rather than on how to use the sensor implementations.</p>
<blockquote><p><em>Example:</em> A mobile application shall notify the user if another (previously defined) person comes into his or her range, e.g. if the boss arrives at the office.</p></blockquote>
<p>Using the standard Java ME interfaces, developers have to get to know the different APIs and write a lot of code to solve this or similar problems. In this use case, the application needs to determine its position (<em>the office</em>), monitor the available devices around it (<em>the phone of the boss</em>) and be able to notify the user when both events occur. </p>
<p>The Aware Context API aims to solve this reoccurring problem with an easy-to-use event-based framework that allows defining <em>rules</em> for available sensor data. Using ACAPI, the given example can be solved easily by defining a <em>rule</em> and an <em>action</em> that is triggered when the rule matches:</p>
<ul>
<li><strong>Rule</strong>: Wi-Fi &#8220;OfficeWLAN&#8221; available <em>AND</em> Bluetooth device &#8220;BossPhone&#8221; available</li>
<li><strong>Action</strong>: Notify user, e.g. by playing a sound</li>
</ul>
<h3 id="Development-Team-and-Scope" >2. Development Team and Scope</h3>
<p>The ACAPI project was developed within the scope of a team project as part of the curriculum of a Master of Science Degree at the <a href="http://www.uni-mannheim.de/">University of Mannheim</a>. The project was a team-effort, carried out over a 1-year duration at the <a href="http://wifo1.bwl.uni-mannheim.de/">Chair of Business Administration and Information Systems</a>, under the supervision of <a href="http://wifo1.bwl.uni-mannheim.de/heinzl.html">Prof. Armin Heinzl</a> and his research assistants <a href="http://wifo1.bwl.uni-mannheim.de/hemmer.html">Erik Hemmer</a> and <a href="http://wifo1.bwl.uni-mannheim.de/stuckenberg.html">Sebastian Stuckenberg</a>. </p>
<p>The project team consisted of <a href="https://www.xing.com/profile/Lars_Bakker">Lars Bakker</a>, <a href="https://www.xing.com/profile/Philipp_Heckel">Philipp Heckel</a> (myself), <a href="https://www.xing.com/profile/Obie_Modisane">Obie Modisane</a>, <a href="https://www.xing.com/profile/Benjamin_Schubert13">Benjamin Schubert</a> and <a href="https://www.xing.com/profile/Moritz_Waechter2">Moritz Wächter</a>.</p>
<h3 id="Aware-Context-API-ACAPI" >3. Aware Context API (ACAPI)</h3>
<p>The Aware Context API is well-structured and is very easy to understand. It is easily extendible and supports a broad range of devices. It is mainly based on Java ME, but has native parts whenever needed (e.g. for Wi-Fi, battery or telephony). </p>
<h4 id="ACAPI-Structure" >3.1. ACAPI Structure</h4>
<p>ACAPI is horizontally structured into 3 different layers:</p>
<ul>
<li><strong>Sensor</strong>: On the lowest level, the <em>sensors</em> gather data about the current status and context of the phone. A Wi-Fi sensor, for instance, collects available devices and it issues an event whenever the data changes. Applications can either hook themselves directly into the sensor events or use higher abstractions (conditions and rules).</li>
<li><strong>Condition</strong>: In order to evaluate a single sensor, <em>conditions</em> compare the sensor&#8217;s properties to given values. They can become either <em>true</em> or <em>false</em>. A location condition, for example, becomes <em>true</em> if the phone gets into the range of certain coordinates. Similar to a sensor, a condition issues an event when the value changes (from <em>true</em> to <em>false</em>, or vice versa).</li>
<li><strong>Rule</strong>: To express more than one condition, <em>rules</em> can combine conditions to a more complex logical expression. In the above example, the rule only matches if both conditions match (&#8220;in the office&#8221; and &#8220;boss phone available&#8221;).</li>
</ul>
<p><img src="http://blog.philippheckel.com/wp-content/uploads/2010/08/acapi-structure.png" alt="" title="ACAPI structure" class="aligncenter size-full wp-image-503" style="border: none" /></p>
<p style="font-size: .8em; line-height: 115%"><strong>ACAPI Structure</strong> (simplified and incomplete!): The Aware Context API is layer-based. Each of the components is easily extendible and has event listeners to react on changes. This chart shows the interdependence of the different layers.</p>
<p>Using this layered structure, ACAPI fundamentally changes the development strategy of mobile applications. Instead of predefining a screen and/or process flow, applications are <strong>event-driven</strong>. Whenever a rule changes its state (match vs. no match), the application can react by displaying a different screen, notifying the user, or by performing other actions.</p>
<p>Besides the horizontal division, the API is also vertically divided in the two logical parts <em>Boolean</em> and <em>Fuzzy</em>. While the Boolean part assumes correct sensors, the Fuzzy conditions and rules take measurement errors and inaccuracy into account. While the Boolean conditions and rules can only become <em>true</em> or <em>false</em>, their Fuzzy counterparts implement a score-based system that only triggers when a certain threshold is reached. This is particularly relevant for sensors that supply accuracy data, e.g. GPS sensors.</p>
<h4 id="Implemented-Sensors" >3.2. Implemented Sensors</h4>
<p>The current code base of ACAPI includes several predefined sensors, including the most common: Bluetooth and GPS. Most sensors are entirely based on Java ME and will work on any phone that supports the corresponding JSR. However, since Java ME does not provide access to some functionalities, a few native implementations are required (e.g. for Wi-Fi, battery status or telephony status). </p>
<p>The following sensors are already implemented:</p>
<ul>
<li><strong>Battery Sensor</strong> (native S60): This sensor monitors the status of the battery (%) and the charger (enum value, e.g. on-battery, or plugged-in). There is currently only a Symbian S60 implementation for this sensor since Java ME does not allow access to the battery data.</li>
<li><strong>Bluetooth Sensor</strong>: This sensor monitors available devices, e.g. phones or laptops. It can react on joining or leaving devices. </li>
<li><strong>Custom Sensor</strong>: This sensor allows the integration of business logic in ACAPI, so that rules do not only include actual sensor data, but also virtual business sensor data.</li>
<li><strong>Location Sensor</strong> (GPS and Wi-Fi; partially native S60): This sensor monitors the position and the speed. It uses GPS and Wi-Fi triangulation to get a fast and accurate position. Since Java ME does not allow access to the wireless sensor, the Wi-Fi part is native S60 code.</li>
<li><strong>Noise Level  Sensor</strong>: This sensor monitors the noise level (<em>in decibels</em>) of the surrounding area.</li>
<li><strong>Time Sensor</strong>: This sensor delivers the current time and can react on date and time changes.</li>
<li><strong>Wireless Sensor</strong> (native S60): This sensor monitors the available Wi-Fi devices, i.e. access points. It can react on joining and leaving devices. In combination with a web service, it can be used to estimate the position. </li>
</ul>
<p>There are many other possible sensors that could be implemented using the available abstract classes. Examples include an orientation sensor (<em>react on device movement</em>) or a telephony sensor (<em>react on calls, SMS etc.</em>).</p>
<h3 id="Example-Usage" >4. Example Usage</h3>
<p>Having discussed the structure of the Aware Context API, the following section elaborates the above-mentioned example even further. It explains the scenario and shows specific example code.</p>
<h4 id="Example-Scenario-and-Code" >4.1. Example Scenario and Code</h4>
<p>As already briefly mentioned above, the example scenario for demonstrating the API is very simple: The application shall display a warning message and play a warning sound when the boss arrives at the office. </p>
<p><img src="/wp-content/uploads/2010/08/acapi-usecase.png" alt="" title="Use Case" width="500" height="205" class="aligncenter size-full wp-image-493" style="border: none" /></p>
<p>The two conditions depicted in the diagram above are combined in one Boolean rule, i.e. the rule only becomes <em>true</em> if both of the conditions match.</p>
<p>Similar to the API concept, its actual usage is also very simple. The following code snippet shows how to implement the above example in a regular Java ME application.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Conditions</span>
Condition inOffice <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WirelessNearCondition<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;OfficeWLAN&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Condition bossPhone <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BluetoothNearCondition<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;BossPhone&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// The two conditions create one rule</span>
Rule bossDetectionRule <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BooleanRule<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bossDetectionRule.<span style="color: #006633;">addCondition</span><span style="color: #009900;">&#40;</span>inOffice<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bossDetectionRule.<span style="color: #006633;">addCondition</span><span style="color: #009900;">&#40;</span>bossPhone<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// React when the rule matches</span>
bossDetectionRule.<span style="color: #006633;">addRuleListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RuleListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> ruleChanged<span style="color: #009900;">&#40;</span>Rule rule, <span style="color: #000066; font-weight: bold;">boolean</span> matches<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>matches<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        playWarningSound<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        displayWarningMessage<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Warning: boss has arrived!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Activate rule</span>
bossDetectionRule.<span style="color: #006633;">setActive</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In lines 2-3, the specific conditions are created. Since both conditions represent very generic cases (Bluetooth/WLAN device in range), ACAPI provides predefined conditions for them. In cases where more complex tests are desired, conditions can be extended via simple Java inheritance. Lines 6-8 combine the two conditions to a single Boolean rule, i.e. a rule that becomes either <em>true</em> or <em>false</em> depending on the status of its conditions. Since the application is supposed to react on changes in this particular rule, it registers itself as a listener in lines 11-17. When the rule is activated (line 20), it tells its conditions to register themselves at the corresponding sensors, which in turn get activated (if not already running). After this initialization, ACAPI notifies all registered listeners whenever the rule changes.</p>
<p>Depending on the status of the rules and conditions, i.e. on the device context, the application can change its appearance, behavior or internal state. In this case, it only plays a warning sound and displays a warning message (lines 14-15).</p>
<h4 id="Proof-of-Concept-Application" >4.2. Proof-of-Concept Application</h4>
<p>In order to test the implemented sensors and the rules engine of ACAPI, we developed a proof-of-concept application that implements a more sophisticated context driven use case.</p>
<p>A field service automation application that reacts upon the context the worker is in at the moment. This can be nicely done with the ACAPI and has a value for businesses. However, as this part of our project is not open source, I will not go into more detail here. </p>
<h3 id="Future-Work-and-Conclusion" >5. Future Work and Conclusion</h3>
<p>The Aware Context API provides a framework for building context-aware applications for mobile devices based on Java ME. By providing uniform interfaces to different sensors, the library allows the development of context-driven applications.</p>
<p>The idea and structure of ACAPI are very solid, however, the actual implementation is in a very early development stage. While most sensors and Boolean conditions/rules are already working on the test devices, the Fuzzy conditions and rules are yet to be implemented. The native part only covers Symbian S60 so far and lacks of stability. Hence, the future work will include the implementation of missing parts, testing as well as the documentation. </p>
<h3 id="Download-and-License" >A. Download and License</h3>
<p>ACAPI will be released as open source, possibly under GPL or a Creative Commons license. Since we have not finished cleaning up the code and commenting everything, the code is not available for download as yet. </p>
<p>However, since it will be open source anyway, I will give out the code upon request.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/08/22/aware-context-api-acapi-using-the-sensors-in-java-me/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hybrid Clouds: A Comparison of Cloud Toolkits</title>
		<link>http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/</link>
		<comments>http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#comments</comments>
		<pubDate>Sat, 08 May 2010 20:32:11 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Distributed Systems]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Eucalyptus]]></category>
		<category><![CDATA[Hyper-V]]></category>
		<category><![CDATA[OpenNebula]]></category>
		<category><![CDATA[oVirt]]></category>
		<category><![CDATA[RHEV]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[XenServer]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=307</guid>
		<description><![CDATA[In the last few years, the importance of the Internet has risen constantly and made it indispensable for businesses and most individuals to be on-line around the clock. One of the greatest drivers of this development was and still is the shift of the traditional one-to-many Web to an advanced, participatory version of the Word [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few years, the importance of the Internet has risen constantly and made it indispensable for businesses and most individuals to be on-line around the clock. One of the greatest drivers of this development was and still is the shift of the traditional one-to-many Web to an advanced, participatory version of the Word Wide Web. Rather than only making editorial information accessible to many users, the Web 2.0 encourages participation and enables user generated contributions. Leveraging this new paradigm, services like Flickr, Facebook, or Twitter have become very prominent examples for this development.</p>
<p>An essential part of this evolution, but mostly hidden to the end-consumer, is the set of tools that enable these large scale applications. <b>Cloud computing</b> is a relatively new technology that serves as underlying architecture for most of these platforms. By providing <a href="http://en.wikipedia.org/wiki/Virtualization">virtualized</a> computing resources as a service in a pay-as-you-go manner, cloud computing enables new business models and cost effective resource usage. Instead of having to maintain their own data center, companies can concentrate on their core business and purchase resources when needed. Especially when combining a privately maintained virtual infrastructure with publicly accessible clouds in a <b>hybrid cloud</b>, the technology can open up new opportunities for businesses and help consolidating resources.<br />
However, since cloud computing is a very new term, there are as many definitions of its components as there are opinions about its usefulness. Most of the corresponding technologies are only a few years old and the toolkits lack of maturity and interoperability.</p>
<p>This article introduces the basic concepts of cloud computing and discusses the technical requirements for setting up a hybrid cloud. It briefly looks into security concerns and outlines the status quo of current cloud technologies. In particular, it evaluates several existing cloud toolkits regarding its requirements, occurring problems and interoperability.</p>
<p><span id="more-307"></span></p>
<hr />
<b>Contents</b></p>
<div class="toc">
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#Cloud-Computing">1. Cloud Computing</a></p>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#Status-Quo">1.1. Status Quo</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#Definitions-and-Key-Characteristics">1.2. Definitions and Key Characteristics</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#Classifications">1.3. Classifications</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#toc-1-3-1-service-models-abstraction-classes">1.3.1. Service Models: Abstraction Classes</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/#toc-1-3-2-deployment-models-exposure-classes">1.3.2. Deployment Models: Exposure Classes</a></li>
</ol>
</li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#Hybrid-Clouds">2. Hybrid Clouds</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#Opportunities">2.1. Opportunities</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#Challenges-and-Issues">2.2. Challenges and Issues</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#toc-2-2-1-cost">2.2.1. Cost</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#toc-2-2-2-security-and-data-confidentiality">2.2.2. Security and Data Confidentiality</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#toc-2-2-3-availability">2.2.3. Availability</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/2/#Interoperability">2.2.4. Interoperability</a></li>
</ol>
</li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#Cloud-Toolkits">3. Cloud Toolkits</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#Market-Overview">3.1. Market Overview</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#Technical-Requirements-and-Restrictions">3.2. Technical Requirements and Restrictions</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#Hardware-Requirements">3.2.1. Hardware Requirements</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#Operating-Systems-and-Software-Restrictions">3.2.2. Operating Systems and Software Restrictions</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#OpenNebula-and-Eucalyptus">3.3. OpenNebula and Eucalyptus</a>
<ol>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#Eucalyptus">3.3.1. Eucalyptus</a></li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/3/#OpenNebula">3.3.2. OpenNebula</a></li>
</ol>
</li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/4/#Conclusion">4. Conclusion</a></li>
</ol>
</div>
<hr />
<b>Download as PDF</b>: This article is a slightly shortened version of my seminar paper. Feel free to download the <a href="http://www.philippheckel.com/files/hybrid-cloud-paper.pdf">original PDF version</a>, or the <a href="http://www.philippheckel.com/files/hybrid-cloud-presentation.pdf">presentation slides</a>.</p>
<hr />
<h3 id="Cloud-Computing" >1. Cloud Computing</h3>
<h4 id="Status-Quo" >1.1. Status Quo</h4>
<p>As newest concept in the development of distributed computing, cloud computing is often believed to be &#8220;<em>the next step in the evolution of the Internet</em>&#8221; (<a href="http://www.opencloudmanifesto.org/">Open Cloud Manifesto</a>). As foundation and enabler for <a href="http://en.wikipedia.org/wiki/Software_as_a_service">Software as a Service</a>, it delivers computing resources over the Internet and provides elastic scalability for any kind of application. While cluster and grid computing already allowed multiple computers to work together on complex tasks in a distributed manner, the cloud concept extends this idea even further: instead of regarding individual machines, cloud computing treats resources as a <em>utility</em>. That is computing time and storage are provisioned on-demand and paid per usage without the need for any upfront commitment.</p>
<p>As one of the first commercial providers of cloud services, Amazon launched a beta version of its <a href="http://aws.amazon.com/ec2/">Elastic Computing Cloud (EC2)</a> in August 2006 and announced production stability <a href="http://aws.typepad.com/aws/2008/10/big-day-for-ec2.html">in October 2008</a>. Google followed with a public beta of <a href="http://code.google.com/appengine/">App Engine</a> in <a href="http://googleappengine.blogspot.com/2008/04/introducing-google-app-engine-our-new.html">April 2008</a>, and Microsoft made its cloud platform <a href="http://www.microsoft.com/windowsazure/">Windows Azure</a> publicly available in <a href="http://blogs.msdn.com/windowsazure/archive/2010/02/01/windows-azure-platform-now-generally-available-in-21-countries.aspx">February 2010</a>. The well known alternatives to the commercial solutions are several open source cloud toolkits. Prominent examples include <a href="http://www.opennebula.org/">OpenNebula</a>, a project started by researchers of the University of Chicago and Madrid in 2008, as well as the <a href="http://www.eucalyptus.com/">Eucalyptus</a> cloud software, initiated by the University of California, Santa Barbara in 2007. </p>
<p>Even though there are already many commercial and open source cloud solutions, all of them are fairly young and have yet to prove their acceptance and durability. According to the <a href="http://www.opencloudmanifesto.org/">Open Cloud Manifesto</a>, the technology &#8220;<em>is still in its early stages, with much to learn and more experimentation to come</em>&#8220;. This particularly includes challenges that yet need to be overcome, e.g. data security within the cloud, or interoperability between different clouds. </p>
<h4 id="Definitions-and-Key-Characteristics" >1.2. Definitions and Key Characteristics</h4>
<p>Due to the actuality of the topic, there are several opinions about what cloud computing and its corresponding terms comprises. Some experts see the technology as &#8220;<em>one of the foundations of next generation computing</em>&#8221; (<a href="http://youtube.com/?v=6PNuQHUiV3Q">Tim O&#8217;Reilly, CEO of O&#8217;Reilly Media, 2008</a>), others believe that the term is just a buzz word to define &#8220;<em>everything that we currently do</em>&#8221; (<a href="http://youtube.com/?v=0FacYAI6DY0" title="What the Hell is Cloud Computing?">Larry Ellison, CEO of Oracle Corp., 2008</a>).</p>
<p>However, while the term is being criticized, there are still many intersecting definitions describing the technology. Some are broader than others and include not only the technical part, but also the services enabled by the cloud, i.e. SaaS applications. For the Laboratory of Distributed Systems of the University of California, Berkeley, for instance, &#8220;<em>cloud computing refers to both the applications delivered as services over the Internet and the hardware and systems software in the data centers that provide those services</em>&#8221; (<a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2009/EECS-2009-28.pdf">Armbrust et al., 2009</a>). Not contrary to that definition, but limiting the term to hardware and software, IBM describes cloud computing as &#8220;<em>an emerging computing paradigm where data and services reside in massively scalable data centers and can be ubiquitously accessed from any connected devices over the Internet</em>&#8221; (<a href="http://www.ibm.com/developerworks/xml/library/x-cloudpt1/">O&#8217;Neill, 2009</a>). </p>
<p>In this article, cloud computing is defined by the three key characteristics shared by many experts:</p>
<ul>
<li><b>Resource abstraction</b>: resources inside the cloud are not directly observable by the cloud user, but are virtualized using technologies like <a href="http://www.xen.org/">Xen</a> or <a href="http://www.linux-kvm.org/">KVM</a>, and can be accessed via an application programmable interface (API).</li>
<li><b>Elastic capacity</b>: the cloud appears to users as a pool of infinite capacity, being able to allocate and free resources on-demand. Scaling up and down avoids over- and under-utilization and thereby allows an optimal load.</li>
<li><b>Utility-based pricing</b>: storage, CPU time and network bandwidth are charged by the hour using a pay-per-use pricing model. Resources can be allocated almost instantaneously without any upfront commitment.</li>
</ul>
<h4 id="Classifications" >1.3. Classifications</h4>
<p>Similar to the attempts to define the term cloud computing, the categorization of it is rather difficult, if not &#8220;<em>impossible in the currently rapid evolution of the cloud landscape</em>&#8221; (<a href="http://portal.acm.org/citation.cfm?id=1564625">Lenk et al., 2009</a>). However, many papers classify cloud systems by their level of abstraction and their exposure to the Internet. </p>
<h5 id="toc-1-3-1-service-models-abstraction-classes">1.3.1. Service Models: Abstraction Classes</h5>
<p>In order create the illusion of infinite resources and elasticity, virtualization technology is needed. Depending on how abstracted resources are, different <em>service models</em> are differentiated (cmp. <a href="http://csrc.nist.gov/groups/SNS/cloud-computing/">NIST, 2009</a>, and <a href="http://www.eecs.berkeley.edu/Pubs/TechRpts/2009/EECS-2009-28.pdf">Armbrust et al., 2009</a>):</p>
<ul>
<li><b>Software as a Service (SaaS)</b>: at the highest level of abstraction, users are mostly unaware of the fact that are using cloud-enabled applications, and are hence not able to control the underlying resources. Instead, they simply use client interfaces such as web browsers. A popular example is the <a href="http://www.salesforce.com/">salesforce.com</a> CRM system.</li>
<li><b>Platform as a Service (PaaS)</b>: users are able to develop and deploy applications within the provider&#8217;s hosting environment, e.g. a Java application framework. Low-level resources are not controlled by the cloud user. Prominent example is the <a href="http://appengine.google.com/">Google App Engine</a>.
<li><b>Infrastructure as a Service (IaaS)</b>: at the lowest level of abstraction, cloud users have access to virtualized resources such as processing time, networking or storage. They are provided virtual machines and can run arbitrary software. Famous example is <a href="http://aws.amazon.com/ec2/">Amazon EC2</a>.
</ul>
<h5 id="toc-1-3-2-deployment-models-exposure-classes">1.3.2. Deployment Models: Exposure Classes</h5>
<p>Not every cloud is available for public use: depending on the level of exposure to the Internet, the following <em>deployment models</em> are differentiated (<a href="http://csrc.nist.gov/groups/SNS/cloud-computing/">NIST, 2009</a>):</p>
<ul>
<li><b>Public Cloud</b>: the cloud infrastructure is publicly accessible via an API. It is hosted by a cloud provider who sells its capacity using a pay-per-use payment model. All of the above mentioned examples are public clouds.
</li>
<li><b>Private Cloud</b>: the cloud infrastructure is hosted within the data center of an organization and used by local users only. It focuses on providing a flexible virtualized infrastructure rather than on selling the cloud resources.
</li>
<li><b>Hybrid Cloud</b>: the hybrid cloud approach extends the private cloud model by using both local and remote resources. It is usually used to handle flash crowds by scaling out when the local capacity is exhausted. This so called cloudbursting enables highly elastic environments. The key difference between private and hybrid clouds is &#8220;<em>the extension of service provider-oriented low cost cloud storage to the enterprise</em>&#8221; (<a href="http://cloudstoragestrategy.com/2010/01/cloud-storage-for-the-enterprise---part-2-the-hybrid-cloud.html">Lesem, 2010</a>). That is remote cloud resources are seamlessly integrated in the private cloud, and thereby create a hybrid cloud.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP-UN: WordPress version update notification with cron</title>
		<link>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/</link>
		<comments>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 13:32:30 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Cron]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=164</guid>
		<description><![CDATA[WordPress is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release. As [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/">WordPress</a> is a very popular open-source blog software and is used widely throughout the Internet. However, with great success comes great attack potential: like any other wide spread open-source software, WordPress is target for frequent hacking attacks and spam-bots. All the more important is it to always update the distribution to the latest release.</p>
<p>As Debian/Ubuntu user, I am spoiled when it comes to update management: <em>apt-get</em> updates most of my software, and <em>apticron</em> notifies me when updates are available. For WordPress however, the packaged versions of Debian/Ubuntu are really old and less adjustable which unfortunately makes a manual installation inevitable. While there are several automated WordPress update mechanisms out there, I couldn&#8217;t find a simple notify-on-update tool.</p>
<p>This post introduces the <em>WordPress Update Notifier</em> (WP-UN), a simple script that frequently compares the installed WordPress version with the latest available one. If a new version is available, it sends an e-mail to a given address.</p>
<p><span id="more-164"></span></p>
<h3 id="toc-requirements">Requirements</h3>
<p>WP-UN needs a local mail server such as <a href="http://www.sendmail.org/">Sendmail</a> or <a href="http://www.postfix.org/">Postfix</a> to deliver the notification e-mail. </p>
<h3 id="toc-download-installation">Download &amp; Installation</h3>
<p>Download the script, save it to your preferred location and make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un \
          http:<span style="color: #000000; font-weight: bold;">//</span>blog.philippheckel.com<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2010</span><span style="color: #000000; font-weight: bold;">/</span>01<span style="color: #000000; font-weight: bold;">/</span>wp-un
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un</pre></div></div>

<p>That&#8217;s it for the installation. The script can now be called by simply running <em>wp-un</em>.</p>
<p><strong>Download</strong>: <a href="http://blog.philippheckel.com/uploads/2010/01/wp-un">WP-UN 0.1, January 2010</a></p>
<h3 id="toc-usage">Usage</h3>
<p>Now you can call the script with the following arguments:</p>
<ul>
<li><strong>&#8211;test</strong>: to test if the notification works, use the <em>&#8211;test</em> parameter (optional).</li>
<li><strong>INSTALL-DIR</strong>: the path to your local WordPress installation, for example /var/www/myblog.</li>
<li><strong>NOTIFY-EMAIL</strong>: the e-mail address of the person to notify if a new WordPress version is available.</li>
</ul>
<p>By default, the script is completely silent so that adding a cronjob doesn&#8217;t require output redirections. If, however, the <em>&#8211;test</em> option is given, it is more verbose and sends the notification e-mail in any case.</p>
<p>If a new WordPress version is available, the output looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ wp-un --test /var/www/myblog admin@example.com
Checking installed version... WordPress 2.5.1
Checking latest version... WordPress 2.9.1
Update required; Sending notification to admin@example.com... done.</pre></div></div>

<p>If WordPress is up-to-date, WP-UN would normally not send any notification. If, however, the <em>&#8211;test</em> option is enabled, it sends the e-mail no matter what. In this case, the output will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ wp-un --test /var/www/myblog admin@example.com
Checking installed version... WordPress 2.9.1
Checking latest version... WordPress 2.9.1
Update not necessary; WordPress is up-to-date.
TEST-flag enabled: sending notfication to admin@example.com... done.</pre></div></div>

<p>The notification you receive will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"> The WordPress installation on host example.com needs an update:
&nbsp;
   Installed Version: WordPress 2.5.1
                  at: /var/www/myblog
&nbsp;
      Latest Version: WordPress 2.9.1
            Download: http://www.wordpress.org/latest.tar.gz</pre></div></div>

<h3 id="toc-as-cronjob">As cronjob</h3>
<p>If you want to be notified as soon as a new version comes out, installing a cronjob is a good idea. Simply run <em>crontab -e</em> and add the following line to the file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">0</span> <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>wp-un <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>myblog admin<span style="color: #000000; font-weight: bold;">@</span>example.com</pre></div></div>

<p>WP-UN will now run every morning at 6am and notify you if a new WordPress version is out there!</p>
<h3 id="toc-conclusion">Conclusion</h3>
<p>WP-UN is just one of many solutions and it&#8217;s only the work of one afternoon. However, it doesn&#8217;t need any additional software and keeps it simple. It serves its purpose and keeps my WordPress installation always up-to-date. If you have any suggestions or questions, feel free to comment below.></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/01/29/wp-un-wordpress-version-update-notification-with-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to: Postfix as mail relay with greylisting support</title>
		<link>http://blog.philippheckel.com/2010/01/28/how-to-postfix-as-mail-relay-with-greylisting-support/</link>
		<comments>http://blog.philippheckel.com/2010/01/28/how-to-postfix-as-mail-relay-with-greylisting-support/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 20:35:11 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Greylisting]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Postfix]]></category>
		<category><![CDATA[SQLgrey]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=30</guid>
		<description><![CDATA[Greylisting is a very efficient technique for fighting spam and can reduce the spam messages in your mailbox by more than 90%. It uses the fact that most spammers only try delivering their spam-mails once, whereas real mail transfer agents (such as the ones regular e-mail service providers are using) try delivering each message up [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.greylisting.org/">Greylisting</a> is a very efficient technique for fighting spam and can reduce the spam messages in your mailbox by more than 90%. It uses the fact that most spammers only try delivering their spam-mails once, whereas real mail transfer agents (such as the ones regular e-mail service providers are using) try delivering each message up to 4-5 days before they give up. </p>
<p>I have always wondered why most ESPs don&#8217;t offer greylisting for their mailboxes, but only rely on less effective and resource-hungry post-retrieval filter methods. Unfortunately, my e-mail provider is one of them so that I get at least a couple of spam mails a day &#8230;</p>
<p>Luckily, it is very easy to set up your own mail relay with greylisting support, i.e. a mail server that simply forwards the mail to your real provider once it passes the greylist-filter. </p>
<p>This little tutorial describes how to set up <a href="http://www.postfix.org">Postfix</a> and <a href="http://sqlgrey.sourceforge.net/">SQLgrey</a> as mail relay.</p>
<p><span id="more-30"></span></p>
<h3 id="toc-1-what-you-need">1. What you need</h3>
<ul>
<li>A dedicated or virtual private server with SSH root access.</li>
<li>Access to the DNS entries of your domain for adjusting the MX record; in this post called <em>example.com</em></li>
</ul>
<h3 id="toc-2-how-it-works">2. How it works</h3>
<p>If you have outsourced all e-mail services to a service provider like I have, the MX record of your domain usually points to your provider&#8217;s mail server. That is, your mails go directly to the mail server of your provider, e.g. <strong>Google&#8217;s mail server → your provider&#8217;s mail server</strong>. That is, your DNS configuration looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ dig example.com mx
...
example.com.		IN	MX	50 mx0.example.com.
mx0.example.com.	IN	A	(your provider's mail server IP)
...</pre></div></div>

<p>In order to pre-process mails with greylisting and blacklisting, your server will handle mails as intermediary, i.e., mails will always traverse your server first; in the above case something like <strong>Google&#8217;s mail server → your mail server → your provider&#8217;s mail server</strong>. Consequently, the MX record has to be changed to the IP address of your server:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ dig example.com mx
...
example.com.		IN	MX	50 mx0.example.com.
mx0.example.com.	IN	A	(your server IP)
...</pre></div></div>

<p><strong>But</strong>, first things first: we need to configure our server before we change the DNS records!</p>
<h3 id="toc-3-installation-configuration">3. Installation &amp; Configuration</h3>
<p>If you have a Debian based system, install Postfix, SQLgrey and MySQL using apt-get:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> postfix sqlgrey mysql-server</pre></div></div>

<p>This will install:</p>
<ul>
<li><strong><a href="http://www.postfix.org/">Postfix</a></strong>: a fully functioning MTA which will be configured as mail relay, i.e., instead of storing arriving mails on the system, it will just greylist them and then forward them to their real destination (your provider&#8217;s mail server).</li>
<li><strong><a href="http://sqlgrey.sourceforge.net/">SQLgrey</a></strong>: a SQL-based greylisting add-on for Postfix. Before accepting mails blindly, Postfix will ask the SQLgrey daemon whether to accept the mail or not. SQLgrey keeps track of mail delivery attempts and only replies with success if the foreign MTA tried delivering the mail at least twice.</li>
<li><strong><a href="http://www.mysql.com/">MySQL</a></strong>: a RDBMS which will be used as back-end for storing Postfix&#8217;s routing tables and SQLgrey&#8217;s caching tables. Both Postfix and SQLgrey also support other back-ends such as <a href="http://www.postgresql.org/">PostgreSQL</a>.</li>
</ul>
<h4 id="toc-3-1-configuring-sqlgrey">3.1. Configuring SQLgrey</h4>
<p>SQLgrey&#8217;s config files reside in <em>/etc/sqlgrey/</em>, the main configuration happens in <em>/etc/sqlgrey/sqlgrey.conf</em>. The file is well documented and offers many possibilities. </p>
<p>The most important options are:</p>
<ul>
<li><strong>inet</strong>: IP address and port to bind the daemon to, default is 127.0.0.1:2501</li>
<li><strong>db_*</strong>: database connection details, i.e., database, user and password</li>
<li><strong>greymethod</strong>: defines which <a href="http://en.wikipedia.org/wiki/Classful_network#Introduction_of_address_classes">IP class</a> to use for greylisting. Especially important for big e-mail service providers since the same mail might be delivered from two different IP addresses (Class C greylisting recommended!).</li>
<li><strong>optmethod</strong>: defines if greylisting is enabled by default (optout), or has to be enabled specifically for each address or domain (optin).</li>
</ul>
<h5 id="toc-3-1-1-config-file-etcsqlgreysqlgrey-conf">3.1.1. Config file /etc/sqlgrey/sqlgrey.conf</h5>
<p>My configuration looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #000080; font-weight:bold;">inet</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">10101</span> </span><span style="color: #808080; font-style: italic;"># bind to localhost:10101</span>
<span style="color: #000080; font-weight:bold;">reconnect_delay</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">5</span> </span><span style="color: #808080; font-style: italic;"># no reconnect before 5 minutes</span>
<span style="color: #000080; font-weight:bold;">max_connect_age</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">24</span> </span><span style="color: #808080; font-style: italic;"># no reconnect after 24 hours</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># database settings</span>
<span style="color: #000080; font-weight:bold;">db_type</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql</span>
<span style="color: #000080; font-weight:bold;">db_name</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sqlgrey</span>
<span style="color: #000080; font-weight:bold;">db_host</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> localhost</span>
<span style="color: #000080; font-weight:bold;">db_user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sqlgrey</span>
<span style="color: #000080; font-weight:bold;">db_pass</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sqlgreypassword</span>
<span style="color: #000080; font-weight:bold;">db_cleandelay</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> <span style="">1800</span> </span>
<span style="color: #000080; font-weight:bold;">clean_method</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> sync </span><span style="color: #808080; font-style: italic;"># 'async' is said to be buggy</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># greylist by class C network. eg: 2.3.4.6 connection</span>
<span style="color: #808080; font-style: italic;"># accepted if 2.3.4.145 did connect earlier</span>
<span style="color: #000080; font-weight:bold;">greymethod</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> classc</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># one must optin to have its (incoming) messages being greylisted</span>
<span style="color: #000080; font-weight:bold;">optmethod</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> optin</span></pre></div></div>

<h5 id="toc-3-1-2-database">3.1.2. Database</h5>
<p>SQLgrey has a fixed database structure which is set up automatically when the script is started. All that needs to be done is to create a new database <em>sqlgrey</em> with a corresponding user. You can do this manually, or with a tool like <a href="http://www.phpmyadmin.net/">phpMyAdmin</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> USER <span style="color: #ff0000;">'sqlgrey'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'sqlgreypassword'</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`sqlgrey`</span> ;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">ALL</span> PRIVILEGES <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #ff0000;">`sqlgrey`</span> <span style="color: #66cc66;">.</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'sqlgrey'</span>@<span style="color: #ff0000;">'localhost'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></div></div>

<h5 id="toc-3-1-3-populating-the-database">3.1.3. Populating the database</h5>
<p>SQLgrey automatically creates the required tables when it starts for the first time. So start the daemon using the provided init.d-script:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>sqlgrey start</pre></div></div>

<p>This creates a couple of tables in the <em>sqlgrey</em>-database. For our purpose and configuration, the tables <em>optin_email</em> and <em>optin_domain</em> are most interesting because only domains and e-mail addresses in these tables will be greylisted.</p>
<p>For our example, we will enable greylisting for the whole domain <em>example.com</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`sqlgrey`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`optin_domain`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`domain`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'example.com'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>That&#8217;s it for SQLgrey. Once we connect it to Postfix, it&#8217;ll provide us with the greylisting service we want. </p>
<h4 id="toc-3-2-configuring-postfix">3.2. Configuring Postfix</h4>
<p>Postfix is a very flexible and powerful mail transfer agent (MTA) and can be used as final destination, or mail forwarder (mail relay). For this scenario, Postfix will be a <em>mail relay</em> which only forwards an e-mail if</p>
<ul>
<li>its recipient is listed in the database</li>
<li>and it passes the greylisting-filter</li>
</ul>
<p>The configuration files of Postfix reside in <em>/etc/postfix/</em>. The most interesting file for our purpose is <em>/etc/postfix/main.cf</em>.</p>
<p>In order to not be confused by all the more or less useful config parameters, the file shown here is <em>minimal</em>, i.e., you <em>cannot</em> remove any parameter without major consequences. Details to each of them can be found in the <a href="http://www.postfix.org/postconf.5.html">Postfix configuration man-page</a>.</p>
<p>The most important parameters for the configuration as mail relay are:</p>
<ul>
<li><strong><a href="http://www.postfix.org/postconf.5.html#myhostname">myhostname</a></strong>: this defines your hostname, i.e., in this case <em>relay.example.com</em>. Regarding the hostname, two things must be considered very thoroughly:
<ol>
<li>The hostname must resolve to the IP address of your server, i.e., make sure you don&#8217;t state a fake host here. Postfix uses this value as <a href="http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol">HELO/EHLO</a> identification, and some mail servers might <strong>reject</strong> your mails if  this value doesn&#8217;t resolve to your server&#8217;s IP address.</li>
<li>If you use your top level domain here, e.g. example.com, some mail servers might additionally perform a <a href="http://en.wikipedia.org/wiki/MX_record">MX lookup</a> and match your server&#8217;s IP address with the one of the MX record. In case the MX record points to a different IP address than the A record of the TLD, foreign servers might also <strong>reject</strong> all your mails. In my case, this resulted in log entries like this:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">postfix/smtp: to=&lt;john.doe@example.com&gt;, 
  relay=mx.my-esp.tld:25,  status=bounced 
  (host mx.somedomain.com[1.2.3.4] refused to talk to me: 
  550 Forged HELO: you are not example.com)</pre></div></div>

<p>As you can see, the foreign hosts suspected me of forging the HELO name, and denied relaying my mails.</li>
</ol>
</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#relay_domains">relay_domains</a></strong>: this option links to the database table <em>relay_domains</em> and defines the domains managed by this mail server. If a recipient-domain is not in this table, Postfix will reject the mail. For this example, the domain <em>example.com</em> must be added to this DB table.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#relay_recipient_maps">relay_recipient_maps</a></strong>: this option links to the database table <em>relay_recipients</em> and defines the e-mail addresses managed by this mail server. If a recipient address is not in this table, Postfix will reject the mail. This option is closely linked to <em>relay_domains</em> and will not work without it!
<p>In this case, only one address will be added to this table: <em>john.doe@example.com</em>.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#transport_maps">transport_maps</a></strong>: this option links to the database table <em>transport</em> and defines to which mail server incoming mails will be forwarded. Routing can happen address- or domain-based.
<p>In this case, mails for <em>example.com</em> shall be forwarded to our provider&#8217;s mail server, i.e., this table must have an entry of the form <em>example.com</em> → <em>smtp:[mx.my-esp.tld]</em>.</p>
<p>For details on the value format, read the <a href="http://www.postfix.org/transport.5.html">transport man page</a>.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions</a></strong>: this is where the actual magic happens. This option checks the RCPT TO field of each incoming mail, i.e., the recipient, and then queries the greylisting service. Its options closely relate to the <em>relay_*</em>-tables from above:
<ul>
<li><strong><a href="http://www.postfix.org/postconf.5.html#permit_mynetworks">permit_mynetworks</a></strong> allows local applications to send e-mails. If you have web sites running on localhost that may use e-mail, do not remove this option.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#reject_unauth_destination">reject_unauth_destination</a></strong> queries the <em>relay_domains</em> SQL table, i.e., it checks whether a the incoming recipient domain is relayed by our server.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#reject_unlisted_recipient">reject_unlisted_recipient</a></strong> queries the <em>relay_recipients</em> SQL table to find out if the exact address is relayed.</li>
<li><strong><a href="http://www.postfix.org/postconf.5.html#check_policy_service">check_policy_service</a></strong> queries the SQLgrey daemon which in turn either allows or rejects the mail.</li>
</ul>
</li>
</ul>
<h5 id="toc-3-2-1-config-file-etcpostfixmain-cf">3.2.1 Config file /etc/postfix/main.cf</h5>
<p>Here&#8217;s the minimal <em>main.cf</em> config file to make Postfix a mail relay with greylisting support:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># This is a minimal main.cf config file. Make sure to read the above </span>
<span style="color: #808080; font-style: italic;"># comments so you understand what each option means.</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># server name; must resolve to your server's IP address</span>
<span style="color: #000080; font-weight:bold;">myhostname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> relay.example.com</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># avoid warning message 'dict_nis_init: NIS ...'</span>
<span style="color: #000080; font-weight:bold;">alias_maps</span> <span style="color: #000000;">=</span> 
&nbsp;
<span style="color: #000080; font-weight:bold;">relay_domains</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql:/etc/postfix/mysql_relay_domains.cf</span>
<span style="color: #000080; font-weight:bold;">relay_recipient_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql:/etc/postfix/mysql_relay_recipient_maps.cf</span>
<span style="color: #000080; font-weight:bold;">transport_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> mysql:/etc/postfix/mysql_transport_maps.cf</span>
&nbsp;
<span style="color: #000080; font-weight:bold;">smtpd_recipient_restrictions</span> <span style="color: #000000;">=</span>
        permit_mynetworks,
        reject_unauth_destination,
        reject_unlisted_recipient,
        check_policy_service inet:127.0.0.1:<span style="">10101</span></pre></div></div>

<h5 id="toc-3-2-2-database">3.2.2. Database</h5>
<p>Postfix is very flexible when it comes to address and route handling. In fact, its configuration doesn&#8217;t need a database back-end at all. However, using a SQL database makes everything much easier. I decided to use a very straight forward database structure which directly relates to Postfix&#8217; configuration options. </p>
<p>First, create a database <em>postfix</em> and a corresponding read-only user:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> USER <span style="color: #ff0000;">'postfix'</span>@<span style="color: #ff0000;">'127.0.0.1'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'postfixpassword'</span>;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">DATABASE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`postfix`</span> ;
<span style="color: #993333; font-weight: bold;">GRANT</span> <span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">ON</span> <span style="color: #ff0000;">`postfix`</span> <span style="color: #66cc66;">.</span> <span style="color: #66cc66;">*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'postfix'</span>@<span style="color: #ff0000;">'127.0.0.1'</span>;
<span style="color: #993333; font-weight: bold;">FLUSH</span> PRIVILEGES;</pre></div></div>

<p><strong>Note</strong>: It is important that you use <em>127.0.0.1</em> as host, and not <em>localhost</em>, because Postfix runs in a <a href="http://en.wikipedia.org/wiki/Chroot">chroot</a>-environment and wouldn&#8217;t be able to access <em>localhost</em>. </p>
<p>After setting up the database, add the following three tables:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`relay_domains`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`domain`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`active`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`domain`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`relay_recipients`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`email`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`active`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`email`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`transport`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`pattern`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`relay`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`active`</span> enum<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'n'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`pattern`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>In order to connect Postfix with the database, we need to create the three config files specified above: /etc/postfix/mysql_*.cf:</p>

<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /etc/postfix/mysql_relay_domains.cf</span>
<span style="color: #000080; font-weight:bold;">hosts</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 127.0.0.1</span>
<span style="color: #000080; font-weight:bold;">user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix-read</span>
<span style="color: #000080; font-weight:bold;">password</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfixpassword</span>
<span style="color: #000080; font-weight:bold;">dbname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix</span>
<span style="color: #000080; font-weight:bold;">query</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> SELECT domain FROM relay_domains WHERE domain='%s' AND active='y'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /etc/postfix/mysql_relay_recipient_maps.cf</span>
<span style="color: #000080; font-weight:bold;">hosts</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 127.0.0.1</span>
<span style="color: #000080; font-weight:bold;">user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix-read</span>
<span style="color: #000080; font-weight:bold;">password</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfixpassword</span>
<span style="color: #000080; font-weight:bold;">dbname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix</span>
<span style="color: #000080; font-weight:bold;">query</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> SELECT email FROM relay_recipients WHERE email='%s' AND active='y'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="properties" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># /etc/postfix/mysql_transport_maps.cf</span>
<span style="color: #000080; font-weight:bold;">hosts</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 127.0.0.1</span>
<span style="color: #000080; font-weight:bold;">user</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix-read</span>
<span style="color: #000080; font-weight:bold;">password</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfixpassword</span>
<span style="color: #000080; font-weight:bold;">dbname</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> postfix</span>
<span style="color: #000080; font-weight:bold;">query</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> SELECT relay FROM transport WHERE pattern='%s' AND active='y'</span></pre></div></div>

<p>Before we can now start testing our server, we need to compile these config files to Postfix compatible lookup tables. Do that by running the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ postmap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>mysql_<span style="color: #000000; font-weight: bold;">*</span>.cf</pre></div></div>

<h5 id="toc-3-2-3-populate-the-database">3.2.3. Populate the database</h5>
<p>Now we have to fill Postfix&#8217; database with the domains and addresses we&#8217;d like to relay. In particular, that means we have to add <em>example.com</em> to <em>relay_domains</em> and <em>transport</em>, and the full addresses to <em>relay_recipients</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`postfix`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`relay_domains`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`domain`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`active`</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'example.com'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`postfix`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`relay_recipients`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`email`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`active`</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'john.doe@example.com'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`postfix`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`transport`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`pattern`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`relay`</span> <span style="color: #66cc66;">,</span><span style="color: #ff0000;">`active`</span><span style="color: #66cc66;">&#41;</span>
   <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'example.com'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'smtp:[mx.my-e-mail-service-provider.tld]'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'y'</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The entry structure for each table is different. Please refer to the Postfix manual for details (cp. <a href="http://www.postfix.org/transport.5.html">transport</a>, <a href="http://www.postfix.org/postconf.5.html#relay_domains">relay_domains</a>, and <a href="http://www.postfix.org/postconf.5.html#relay_recipient_maps">relay_recipient_maps</a>).</p>
<p><strong>Note</strong>: the database structure above is not optimal since it requires redundant entries in three different tables. Even though the structure is not perfect, I have chosen this layout to make it easily understandable!</p>
<h3 id="toc-4-test-your-server">4. Test your server</h3>
<p>After this short configuration period it&#8217;s now time to finally start the Postfix server:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>postfix start</pre></div></div>

<p>To make sure you didn&#8217;t make any mistakes in the configuration, you should now check the log files. Postfix and SQLgrey both use syslog so that you should be able to determine the system&#8217;s status like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tail</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>syslog</pre></div></div>

<p>If the log doesn&#8217;t show any errors, we can now try if everything works as expected. To do so, simply connect to the server from your home computer via telnet:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ telnet relay.example.com 25
Connected to relay.example.com.
Escape character is '^]'.
220 relay.example.com ESMTP Postfix
HELO somebody
250 relay.example.com
MAIL FROM: some@address.tld
250 2.1.0 Ok
RCPT TO: john.doe@example.com
450 4.7.1 &lt;john.doe@example.com&gt;: 
   Recipient address rejected: Greylisted for 5 minutes</pre></div></div>

<p>If Postfix replies with a 450 error code, i.e., relay temporarily denied, everything works just fine. On the server side, the log should output something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">postfix/smtpd: connect from 1-2-3-4.your-isp.tld[4.3.2.1]
&nbsp;
sqlgrey: grey: new: 4.3.2(4.3.2.1), some@address.tld-&gt;john.doe@example.com 
postfix/smtpd: NOQUEUE: reject: RCPT from 1-2-3-4.your-isp.tld[4.3.2.1]: 
    450 4.7.1 &lt;john.doe@example.com&gt;: 
    Recipient address rejected: Greylisted for 5 minutes; 
    from=&lt;some@address.tld&gt; to=&lt;john.doe@example.com&gt; ....
&nbsp;
postfix/smtpd: disconnect from 1-2-3-4.your-isp.tld[4.3.2.1]</pre></div></div>

<p>Wait 5 minutes and try connecting again via telnet. This time, SQLgrey will detect that this is your second delivery attempt and add the sender e-mail and its IP address to the automatic white list (AWL). Postfix will accept your mail and forward it to your provider&#8217;s mail server (according to the <em>transport</em>-table):</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">postfix/smtpd: connect from 1-2-3-4.your-isp.tld[4.3.2.1]
&nbsp;
sqlgrey: grey: reconnect ok: 4.3.2(4.3.2.1), 
    some@address.tld -&gt; john.doe@example.com (00:22:42) 
sqlgrey: grey: from awl: 4.3.2, some@address.tld added 
&nbsp;
postfix/smtpd: client=1-2-3-4.your-isp.tld[4.3.2.1]
postfix/cleanup: message-id=&lt;201001...@relay.example.com&gt;
postfix/qmgr: from=&lt;some@address.tld&gt;, size=422, ...
postfix/smtp: to=&lt;john.doe@example.com&gt;, 
    relay=mx.my-esp.tld[12.34.56.78]:25, status=sent, ...
postfix/qmgr: removed
&nbsp;
postfix/smtpd: disconnect from 1-2-3-4.your-isp.tld[4.3.2.1]</pre></div></div>

<h3 id="toc-5-go-live-change-the-dns-record">5. Go live: change the DNS record</h3>
<p>Play around a little and make sure that everything works as expected. If it does, change the DNS record like described above, i.e., set the MX record of the domains to be relayed to your server&#8217;s IP address.</p>
<p><strong>Note</strong>: For the first few mails, you should definitely watch the logs. If anything goes wrong, you can always change back the MX record. But be aware that DNS changes might take up to 48h!</p>
<p>If you have any questions, please comment below. I am open for suggestions!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2010/01/28/how-to-postfix-as-mail-relay-with-greylisting-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dell Latitude E6400: the Ubuntu fan and noise problem</title>
		<link>http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/</link>
		<comments>http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 13:16:32 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Dell Latitude]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/</guid>
		<description><![CDATA[A couple of days ago, my 4 year old laptop (HP nx8220) decided that it was time to retire and refused to switch on a couple of times. Even though it works most of the time, I can&#8217;t rely on it anymore and will therefore look for new notebooks in the next week. On my [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago, my 4 year old laptop (HP nx8220) decided that it was time to retire and refused to switch on a couple of times. Even though it works most of the time, I can&#8217;t rely on it anymore and will therefore look for new notebooks in the next week.</p>
<p>On my journey through the Web I looked into the details of various business notebooks. I stumbled across the <strong>Dell Latitude E6400</strong>, which looks nice and has everything I wanted. Unfortunately, it also seems to have problems with <strong>Ubuntu</strong>. In particular, the fan seems to run all the time (and not too slow, but very loud) &#8211; as many forum posts and user reviews prove [<a href="http://www.linlap.com/wiki/dell+latitude+e6400">1</a>,<a href="http://karussell.wordpress.com/2009/07/03/dell-latitude-e6400-the-perfect-linux-notebook-or-is-ubuntu-the-perfect-linux/">2</a>,<a href="http://en.community.dell.com/forums/t/19282841.aspx">3</a>,<a href="http://en.community.dell.com/forums/t/19249116.aspx">4</a>].</p>
<p>Since I couldn&#8217;t find a solution, I decided to ask the Dell support via their support chat.<br />
<span id="more-25"></span></p>
<p><strong>Update Nov/09</strong>: It appears that a BIOS update addresses the heat problem. Please refer to the <a href="http://en.community.dell.com/forums/t/19247293.aspx?PageIndex=12">community forum post</a> (thanks to <a href="#comment-12920">chato</a>) for details. </p>
<p>Here&#8217;s what I found out. Note: This is a chat with the German Dell support from September 21, 2009, translated into English.</p>
<blockquote><p>
<strong>Me</strong>:<br />
The Latitude E6400 has (like many forum posts say) a big problem with Ubuntu. In particular, the fan is always on and makes a lot of noise.</p>
<p><strong>Agent</strong>:<br />
Welcome to the Dell Chat.</p>
<p><strong>Me</strong>:<br />
Hallo. I&#8217;d like to know if there already is a solution for this problem. I was thinking about buying a E6400, but I couldn&#8217;t find any solutions for the fan/noise problem in Ubuntu.</p>
<p><strong>Agent</strong>:<br />
Since we do not support Ubuntu on this device, Dell does not work on a solution. Ubuntu is currently only supported on netbooks. There is no solution.</p>
<p><strong>Me</strong>:<br />
Okay. Do you think there will be a solution in the future? Is Dell planning to support Ubuntu on the E6400? Or never?!</p>
<p><strong>Agent</strong>:<br />
As I said, we don&#8217;t sell the device with Ubuntu.</p>
<p><strong>Me</strong>:<br />
Okay. Thank you for the honest answer. I&#8217;m gonna have to buy a Thinkpad then &#8230; Have a nice day.</p>
<p><strong>Agent</strong>:<br />
I&#8217;m sorry. But we don&#8217;t support Linux.</p>
<p><strong>Me</strong>:<br />
It&#8217;s not your fault. Thanks anyway. Good bye.</p>
<p><strong>Agent</strong>:<br />
I&#8217;m so sorry.
</p></blockquote>
<p>So the outcome is: <strong>The Dell Latitude E6400 doesn&#8217;t support Ubuntu and is NOT planning to solve the fan/noise problem.</strong>. That means, I&#8217;m gonna have to buy one of those ugly Thinkpads. But what other solutions are there?! None!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/09/21/dell-latitude-e6400-the-ubuntu-fan-and-noise-problem/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Extract text from PDF files</title>
		<link>http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/</link>
		<comments>http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 17:17:05 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[PDF]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/</guid>
		<description><![CDATA[Adobe&#8217;s Portable Document Format (PDF) has reached great popularity over the last years and is the number one format for easy document exchange. It comes with great features such as embeddable images and multimedia, but also has rather unpleasant properties. The so called Security Features represent a simple Digital Rights Management (DRM) system and allow [...]]]></description>
			<content:encoded><![CDATA[<p>Adobe&#8217;s Portable Document Format (PDF) has reached great popularity over the last years and is the number one format for easy document exchange. It comes with great features such as embeddable images and multimedia, but also has rather unpleasant properties. The so called <em>Security Features</em> represent a simple Digital Rights Management (DRM) system and allow PDF authors to restrict the file usage. Using the DRM system, authors can allow or deny actions such as printing a file, commenting or copying content.</p>
<p>Even though this is a good idea for some situations, most of the times, it&#8217;s just annoying: Collecting ideas for seminar papers or a thesis, for instance, is almost impossible without being able to Copy &amp; Paste certain paragraphs from the PDF. </p>
<p><span id="more-24"></span></p>
<p>Fortunately, Linux can solve this problem with a simple tool called <strong>pdf to text</strong>. This command line tool simply strips all text from the PDF file and saves it to a given text-file.</p>
<h3 id="toc-installation">Installation</h3>
<p>The tool is part of the package <strong>poppler-utils</strong> and can be installed via your favorite package manager, e.g. apt-get:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> poppler-utils</pre></div></div>

<h3 id="toc-extract-text-from-pdf-files">Extract text from PDF files</h3>
<p>This is also pretty simple and the man-page gives the instructions: <em>pdftotext [options] &lt;PDF&gt; [&lt;text-file&gt;]</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ pdftotext PDF-file-with-copy-and-paste-restriction.pdf</pre></div></div>

<p>In case you&#8217;d like to perform this for every PDF-file in a folder (recursive search), simple do that:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">'*.pdf'</span> <span style="color: #660033;">-exec</span> pdftotext <span style="color: #ff0000;">&quot;{}&quot;</span> \;</pre></div></div>

<p>After executing the command, there will be a *.txt-file for each PDF file in the folder, &#8211; containing the plain-text of the corresponding PDF file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/08/09/extract-text-from-pdf-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simsafe: Simple command-line password safe</title>
		<link>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</link>
		<comments>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:20:29 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[GPG]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/</guid>
		<description><![CDATA[Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays, it appears to me as if almost everything in the big and fancy world of IT comes with the need to sign up and create an account. Every little online tool, every social networking site and of course every instant messenger account. System administrators hits it even harder: The setup of a server machine requires to create lots of different users for every kind of service, &#8212; be it Postfix, Sendmail, Courier, MySQL, PostgreSQL, etc. Most of them require some kind of super-user password or account.</p>
<p>This is where a password manager comes in handy: Open the password vault by typing in the master password, put in all you secrets and crucial information, save it and be happy. <em>As if!</em></p>
<p>Almost every password manager I found on the Web was crowded out by details so that it took minutes to add a single account. What I wanted was something like a text-file with password &#8212; and that&#8217;s what I made: <strong>A simple command-line password safe</strong>.</p>
<p><span id="more-22"></span></p>
<h3 id="toc-how-it-works">How it works</h3>
<p>Simsafe is nothing else but a simple Perl script wrapped around the symmetric encryption functions of GPG. Every box with GPG and Perl installed can hence use the script (= every linux box!). And even if the <em>simsafe</em>-script is not installed on the system, a simple <em>gpg &#8211;decrypt FILE</em> shows the plain text contents. That is, Simsafe files are nothing more but <strong>text-files with password!</strong></p>
<h3 id="toc-usage">Usage</h3>
<p>It&#8217;s simple and really easy to use.<br />
Syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe FILE</pre></div></div>

<h4 id="toc-create-a-new-password-safe-file">Create a new password safe file</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Creating a new password safe 'mySafe'
simsafe: Please enter the new password: (type in your password)
simsafe: Please confirm the password: (confirm your password)
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Encrypting with GPG ...</pre></div></div>

<h4 id="toc-addingremoving-entries-to-the-password-vault">Adding/Removing entries to the password vault</h4>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">$ simsafe mySafe
simsafe: Please enter the safe password: (type in your password)
simsafe: Decrypting with GPG ...
simsafe: Executing editor vi ...
  // VI or your favourite editor opens
  // and you can edit the plain text file
simsafe: Safe unchanged.</pre></div></div>

<h3 id="toc-get-it">Get it!</h3>
<p>It&#8217;s a reeeaallly small script and this post is possible longer than the perl-file itself, but here it is. Simply download it, make it executable and put it somewhere in your PATH.</p>
<p><strong>Download:</strong> <a href="/uploads/2009/04/simsafe">Simsafe v0.1, Apr. 2009</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/04/07/simsafe-simple-command-line-password-safe/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>KadS: a secure version of the Kademlia protocol</title>
		<link>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/</link>
		<comments>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 15:56:40 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Distributed Systems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Kademlia]]></category>
		<category><![CDATA[Peer-to-Peer]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/</guid>
		<description><![CDATA[There are various peer-to-peer protocols out there. All of them focus the decentralisation of storage and other system resources. Most implement a distributed hash table (DHT) to store information. That is, each node of the network only holds a small part of the hash table but is able to locate and retrieve any requested entry. [...]]]></description>
			<content:encoded><![CDATA[<p>There are various peer-to-peer protocols out there. All of them focus the decentralisation of storage and other system resources. Most implement a distributed hash table (DHT) to store information. That is, each node of the network only holds a small part of the hash table but is able to locate and retrieve any requested entry. <a href="http://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf">Kademlia</a>, a protocol designed by two <a href="http://www.nyu.edu/">NYU</a> students in 2002, is one of them.</p>
<p><span id="more-21"></span></p>
<h3 id="toc-the-kademlia-protocol">The Kademlia Protocol</h3>
<p>Kademlia is based on four simple remote procedure calls (RPCs) and guarantees a very fast and lightweight exchange of information by using the connection-less UDP instead of TCP. Every node as well as every entry of the DHT is tagged with an identifier, called <em>node ID</em> or <em>key</em>. By XORing identifiers, one can calculate the distance between them and is hence able to walk through the network knowing whether one is near or far to a specific node. This so called <em>XOR metric</em> makes it possible to group the entries of the DHT around the K closest nodes to the entry&#8217;s key. An entry with the key 10, for instance, will be stored at the nodes with a node ID close to 10.</p>
<h3 id="toc-kademlia-pki-kads-the-secure-extension">Kademlia + PKI = KadS: The Secure Extension</h3>
<p>In my Bachelor thesis, I am going to extend Kademlia from a simple peer-to-peer protocol to a <em>trusted</em> and <em>secure</em> network. The proposed KadS network is almost identical to the Kademlia network, i.e. it consists of the described RPCs and implements the same XOR metric. The major extension to the protocol is that every node is equipped with a public/private key-pair signed by a trusted CA. This extends the normal Kademlia network to a public key infrastructure (PKI) in which every communication is encrypted, every node can be trusted and only verified nodes can participate in the network.</p>
<p>Every connection is synchronously encrypted with a session key which is created and exchanged in a handshake procedure when two nodes first meet. That is, a node has a different session key for the connection with each node it knows in the network. The handshake is similar to the one used in other software except for the fact that both clients exchange their public key and need to verify each others identity. After a successful handshake, two nodes are able to exchange lightweight encrypted messages using the session key and the basic protocol applies</p>
<h3 id="toc-an-application-the-distributed-url-blacklisting-service">An application: The distributed URL blacklisting service</h3>
<p>As an application to the proposed KadS network, I chose a distributed URL blacklisting service. Please read more in my <a href="/uploads/2009/03/kads-url-blacklisting-2009-thesis-expose.pdf">Bachelor thesis exposé</a>, or simply download the whole thesis: </p>
<p><a href="/uploads/2009/05/Blacklisting-Malicious-Web-Sites-using-a-Secure-Version-of-the-DHT-Protocol-Kademlia.pdf">Blacklisting Malicious Web Sites using a Secure Version of the DHT Protocol Kademlia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2009/03/16/kads-a-secure-version-of-the-kademlia-protocol/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Server Virtualization with VMware Infrastructure (vSphere)</title>
		<link>http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/</link>
		<comments>http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/#comments</comments>
		<pubDate>Sat, 01 Nov 2008 15:25:51 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Distributed Systems]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[SaaS]]></category>
		<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/?p=410</guid>
		<description><![CDATA[In the last few years, the Internet has become increasingly important in various fields of our lives. Not only personal households have discovered the nearly endless possibilities of the Web, but also companies found many different ways of gaining revenue through the online world. Most of the global players and many medium-sized IT companies have [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few years, the Internet has become increasingly important in various fields of our lives. Not only personal households have discovered the nearly endless possibilities of the Web, but also companies found many different ways of gaining revenue through the online world. Most of the global players and many medium-sized IT companies have realized what opportunities the Web and its technologies provide and used them to build up new services for consumers and businesses. In order to compete with the evolving market, companies of traditional business areas such as newspapers or TV broadcasting companies had to diversify their product lines and are forced to react in a fast, flexible and cost efficient way on every day&#8217;s changes of demands and technologies. In fact, every company has to adapt these technologies efficiently to have a chance in the growing market.</p>
<p>As it brings its benefits, cost savings and new customers, every new technology also comes with the more or less known downsides. Even if IT managers are qualified to consider most of the details in how to use and implement them, new software, hardware or resources will &#8211; no matter what &#8211; always cause unpredicted problems. Due to the IT dependence of today&#8217;s companies, every downtime, bug or system overload of a production system directly results in declining profits and higher costs. Especially for service providers, every downtime is business critical to many dependent companies and has to be prevented.</p>
<p>Therefore, companies spend a considerably high amount of money and time to create a stable, flexible and extensible IT environment that supports their business by minimizing risks, increasing availability and allowing to provide better service levels to customers.</p>
<p><strong>Virtualization</strong> is a key technology that addresses to achieve these goals. It allows to run multiple virtual computers on the same physical system. By creating an abstraction of the underlying hardware, it allows to execute a variety of <em>virtual machines (VMs)</em> on top of a virtualized hardware.</p>
<p>This article will discuss how the technology of virtualization works, what advantages it offers and why it is an essential part of today&#8217;s data centers. The focus will be the server virtualization solution <em>VMware Infrastructure</em>, the flagship product suite of VMware Inc.</p>
<p><span id="more-410"></span></p>
<hr />
<strong>Update May 2010</strong><br />In May 2009, VMware rebranded <em>VMware Infrastructure</em> to <strong>vSphere</strong> by <a href="http://www.vmware.com/company/news/releases/vsphere-ga.html">releasing version 4 of the product</a>. According to VMware, the new version of the product <em>&#8220;extends the previous generation&#8221;</em> in and <em>&#8220;is the core of [its] <a href="/2010/05/08/hybrid-clouds-comparing-cloud-toolkits/">cloud computing</a> initiative&#8221;</em>. Please note that supposedly almost all features described in this article also apply to vSphere. A comparison of vSphere and VMware Infrastructure can be found in <a href="http://kb.vmware.com/kb/1010579">VMware&#8217;s knowledge base</a>.</p>
<hr />
<b>Contents</b></p>
<div class="toc">
<ol>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/#Evolution-of-Data-Centers-and-Software-Deployment">1. Evolution of Data Centers and Software Deployment</a></p>
<ol>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/#Software-as-a-Service">1.1. Software as a Service</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/#The-Impact-of-Virtualization-on-SaaS-Providers">1.2. The Impact of Virtualization on SaaS Providers</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Defining-Virtualization">2. Defining Virtualization</a>
<ol>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Advantages-of-Virtualization">2.1. Advantages of Virtualization</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Types-of-Virtualization">2.2. Types of Virtualization</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Players-on-the-Virtualization-Market">2.3. Players on the Virtualization Market</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#The-Anatomy-of-a-Virtual-Machine">2.4. The Anatomy of a Virtual Machine</a>
<ol>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#The-Hypervisor-Virtual-Machine-Monitor">2.4.1. The Hypervisor / Virtual Machine Monitor</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Resource-Management">2.4.2. Resource Management</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Virtual-Processors">2.4.3. Virtual Processors</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Virtual-Memory">3.4.4. Virtual Memory</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Virtual-Networking">2.4.5. Virtual Networking</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/2/#Virtual-Hard-Drive-Disks">2.4.6. Virtual Hard Drive Disks</a></li>
</ol>
</li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/3/#VMware-Infrastructure">3. VMware Infrastructure</a>
<ol>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/3/#Live-Migration">3.1. Live Migration</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/3/#Data-Center-Automation-and-High-Availability">3.2. Data Center Automation and High Availability</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/4/#The-Downside-of-Virtualization">4. The Downside of Virtualization</a>
<ol>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/4/#Technical-Limitations">4.1. Technical Limitations</a></li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/4/#Business-Aspects-and-Costs">4.2. Business Aspects and Costs</a></li>
</ol>
</li>
<li><a href="http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/5/#Conclusion">5. Conclusion</a></li>
</ol>
</div>
<hr />
<b>Download as PDF</b>: This article is a slightly shortened version of my seminar paper. Feel free to download the <a href="http://www.philippheckel.com/files/virtualisation-paper.pdf">original PDF version</a>, or the <a href="http://www.philippheckel.com/files/virtualisation-presentation.pdf">presentation slides</a>.</p>
<hr />
<h3 id="Evolution-of-Data-Centers-and-Software-Deployment" >1. Evolution of Data Centers and Software Deployment</h3>
<p>Traditionally, each big enterprise &#8211; be it an IT company or anything else &#8211; had their own IT department, their own IT infrastructure and therefore also a data center where all required services such as e-mail, SAP and Web servers were hosted. Over the last decade, the ongoing trend of outsourcing has changed a lot in the modern IT landscape. Companies continuously try to eliminate cost generating areas and outsource them to external service providers. </p>
<h4 id="Software-as-a-Service" >1.1. Software as a Service</h4>
<p>Not only many data centers, but also applications and services are operated and administered by so called application service providers (ASPs). Unlike the classic approach where software has to be purchased, licensed and installed on company owned servers, <em>&#8220;in the Software as a Service (SaaS) model, the application or service is deployed from a centralized data center across a network [..] providing access and use on a recurring fee basis&#8221;</em> (<a href="http://siia.net/estore/ssb-01.pdf">SIIA, 2001</a>). That is instead of generating uncompensated costs by running and maintaining required non-revenue generating services, one can concentrate on the core business and leave updates, security fixes and high availability issues to the service provider.</p>
<h4 id="The-Impact-of-Virtualization-on-SaaS-Providers" >1.2. The Impact of Virtualization on SaaS Providers</h4>
<p>While service providers are expanding their data centers, more and more companies reduce their IT to a minimum and &#8220;rent&#8221; many applications from ASPs. Hence, service providers have to shoulder thousands of different applications and operating systems (OS) in their own data center. Each of them has to be available 24/7 and adjustable to the customer&#8217;s wishes. Managing data centers of this size is very expensive and requires special technologies to be operated efficiently. Server virtualization, i.e. the hosting of many different guest OSs on one physical system, is a key technology for SaaS providers and has a major impact on their profitability. Due to the fact that virtualization reduces the number of required physical servers, a virtualized data center can minimize the hardware costs while at the same time allowing a flexible way of distributing resources to customers. Multi-tenant applications are designed to serve many customers at the same time, but often do not include the functionality to flexibly distribute available server resources such as memory or processor time. Virtualization implicitly includes the ability to assign resources according to any kind of rules. Service providers can for instance base resource allocation according to their pricing model and hence attract any kind of customer.</p>
<p>Moreover, virtualization allows SaaS providers to easily provide image-based virtual servers on the one hand, but makes it also possible to customize an application or operating system elaborately on the other hand. That is, service providers can for instance charge a small amount of money for a standardized virtual server with few processor power, and charge a higher price for adjustable systems with more CPU power. </p>
<p>On the application side, many services are designed to serve only one customer or organization. Virtualization makes it possible to run normal single tenant applications as if they were designed for more users without having to redesign them. It also can bring other benefits such as highly isolated systems or a better control over the service levels.</p>
<p>In fact, <em>&#8220;the benefits are so significant, that [..] no SaaS provider will be able to be competitive without using virtualization.&#8221;</em> (<a href="http://blogs.parallels.com/hostingandsaas/2007/07/saas-needs-virt.html">Parallels, 2007</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2008/11/01/server-virtualization-with-vmware-infrastructure-vsphere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unison &amp; multiple hosts: &#8220;Warning: inconsistent state.&#8221;</title>
		<link>http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/</link>
		<comments>http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 16:18:34 +0000</pubDate>
		<dc:creator>Philipp C. Heckel</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Synchronization]]></category>
		<category><![CDATA[Unison]]></category>

		<guid isPermaLink="false">http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/</guid>
		<description><![CDATA[As some of you might know, Unison is this great tool that allows bidirectional synchronisation of two hosts, &#8211; no matter which operating system they&#8217;re running&#8230; Well, at least the well known ones are supported. Since Unison can also be used to sychronise more than two hosts, it&#8217;s perfect for big amounts of data that [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you might know, <a href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a> is this great tool that allows bidirectional synchronisation of two hosts, &#8211; no matter which operating system they&#8217;re running&#8230; Well, at least the well known ones are supported.</p>
<p>Since Unison can also be used to sychronise more than two hosts, it&#8217;s perfect for big amounts of data that has to be shared in a team. </p>
<p>A scenario like this is possible and works for me: UserA &lt;-&gt; Server &lt;-&gt; UserB.<br />
But of course, also other users could sync with the server. Unison rocks!</p>
<p>Today, after reinstalling his OS, my friend got the following error message:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Warning: inconsistent state.  
The archive file is missing on some hosts.
For safety, the remaining copies should be deleted.
  Archive are96968da50882488164ef52510703a8e on 
     host &amp;lt;UserAs-local-hostname&amp;gt; is MISSING
  Archive ar664775fc717afcf6cc46edbc47d25641 on ...</pre></div></div>

<p><span id="more-15"></span></p>
<h3 id="toc-the-easy-solution">The easy solution</h3>
<p>Unison keeps archive-files for each pair it synchronises with. One on each host, i.e. one on your local PC (UserA) and one on the server, both stored in a folder called <em>~/.unison</em> and looking like the files above.</p>
<p>The easiest solution would be to just <strong>delete all archive-files</strong> on the server as unison suggests. <strong>But</strong> that would result in a situation where all the other users that sync their files with the server would have to do a slow sync which is <em>extremely slow</em> and sometimes takes more than 20 minutes for large folders (e.g. > 10 GB).</p>
<h3 id="toc-the-best-solution">The best solution &#8230;</h3>
<p>&#8230; is to just delete the required archive-files on the server. Pretty easy, that&#8217;s how it works:</p>
<p>Log on to the server (assuming that it&#8217;s a Linux machine, but it certainly works similar for any other system) and find the relevant archive files:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> mysyncuser<span style="color: #000000; font-weight: bold;">@</span>mysyncserver.com
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.unison
$ <span style="color: #c20cb9; font-weight: bold;">fgrep</span> <span style="color: #ff0000;">'//UserAs-local-hostname/'</span> <span style="color: #c20cb9; font-weight: bold;">ar</span><span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>You should get something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Binary file ar664775fc717afcf6cc46edbc47d25641 matches</pre></div></div>

<p>Delete the listed files and it should work like a charm. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.philippheckel.com/2008/10/25/unison-and-multiple-hosts-warning-inconsistent-state/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
