<?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>Janhouse.lv &#187; linkedin</title>
	<atom:link href="http://www.janhouse.lv/blog/tag/linkedin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.janhouse.lv</link>
	<description>Just another personal web site.</description>
	<lastBuildDate>Fri, 12 Apr 2013 10:40:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>New version of Tespeed (Terminal network speed test)</title>
		<link>http://www.janhouse.lv/blog/coding/tespeed-terminal-network-speed-test/</link>
		<comments>http://www.janhouse.lv/blog/coding/tespeed-terminal-network-speed-test/#comments</comments>
		<pubDate>Sun, 23 Sep 2012 21:26:57 +0000</pubDate>
		<dc:creator>Janhouse</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[speedtest]]></category>
		<category><![CDATA[speedtest.net]]></category>
		<category><![CDATA[tespeed]]></category>

		<guid isPermaLink="false">http://www.janhouse.lv/?p=1160</guid>
		<description><![CDATA[Most advanced computer users know about speedtest.net that helps testing your internet bandwidth. While it is a great tool, it has only flash version available on their web site and there are Android and iOS apps for your mobile phones, but there were no tools available for Linux servers without GUI. Back in 2009 I [...]]]></description>
				<content:encoded><![CDATA[<p><span style="color: #808080;">Most advanced computer users know about speedtest.net that helps testing your internet bandwidth. While it is a great tool, it has only flash version available on their web site and there are Android and iOS apps for your mobile phones, but there were no tools available for Linux servers without GUI.</span></p>
<p><span style="color: #808080;">Back in 2009 I made a PHP script that tested network speed, wrote the results to text file and generated PNG graphs to be shown on web. It used speedtest.net partner servers and it got the data usage from ifconfig thus making it read the total bandwidth, not just what had been left for the php script itself. I set it up on my home router so I could prove my ISP that their internet is far form what they advertised.</span></p>
<p><span style="color: #808080;">I also uploaded it to Sourceforge and forgot about it&#8217;s existence for some time.</span></p>
<p><span style="color: #808080;">Years have passed and it has been downloaded almost 17 000 times, even though it doesn&#8217;t really work in every case and it wasn&#8217;t that easy to set up.</span></p>
<p>So I figured I should make a new version, written in Python (just to practice it), and so I did.</p>
<p>The new <strong>Tespeed</strong> is <strong>available at Github: <a href="https://github.com/Janhouse/tespeed">https://github.com/Janhouse/tespeed</a></strong></p>
<p>It is licensed under MIT license.</p>
<p>There are still some bugs and planned features left to sort out, but after testing it on multiple computers it is working fine.</p>
<p>&nbsp;</p>
<div id="attachment_1158" class="wp-caption aligncenter" style="width: 765px"><a href="http://www.janhouse.lv/wp-content/uploads/2012/09/2012-09-23-233209_1440x900_scrot.png"><img class="size-full wp-image-1158" title="2012-09-23-233209_1440x900_scrot" src="http://www.janhouse.lv/wp-content/uploads/2012/09/2012-09-23-233209_1440x900_scrot.png" alt="" width="755" height="407" /></a><p class="wp-caption-text">Tespeed in automatic mode looking for best testing server and doing download and upload tests.</p></div>
<p style="text-align: left;">
<p>The new version finds closest servers and then picks the one with lowest latency.</p>
<p>&nbsp;</p>
<div id="attachment_1156" class="wp-caption aligncenter" style="width: 684px"><a href="http://www.janhouse.lv/wp-content/uploads/2012/09/2012-09-23-234110_1440x900_scrot.png"><img class="size-full wp-image-1156" title="2012-09-23-234110_1440x900_scrot" src="http://www.janhouse.lv/wp-content/uploads/2012/09/2012-09-23-234110_1440x900_scrot.png" alt="" width="674" height="266" /></a><p class="wp-caption-text">Available server list top 25 (by distance)</p></div>
<p>&nbsp;</p>
<p>You can also get a list of all available servers (and see the approximate distance to them) by using list-servers command.</p>
<p>&nbsp;</p>
<div class="wp-caption aligncenter" style="width: 609px"><a href="http://www.janhouse.lv/wp-content/uploads/2012/09/2012-09-23-234333_1440x900_scrot.png"><img title="2012-09-23-234333_1440x900_scrot" src="http://www.janhouse.lv/wp-content/uploads/2012/09/2012-09-23-234333_1440x900_scrot.png" alt="" width="599" height="367" /></a><p class="wp-caption-text">Manually specified test server.</p></div>
<p>&nbsp;</p>
<p>Please send me some feedback so I could make it better.</p>
<p>And go thank speedtest.net for this great service. <img src='http://www.janhouse.lv/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.janhouse.lv/blog/coding/tespeed-terminal-network-speed-test/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Hiding your web server behind proxy</title>
		<link>http://www.janhouse.lv/blog/server-stuff/hiding-your-web-server-behind-proxy/</link>
		<comments>http://www.janhouse.lv/blog/server-stuff/hiding-your-web-server-behind-proxy/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 15:33:15 +0000</pubDate>
		<dc:creator>Janhouse</dc:creator>
				<category><![CDATA[Server stuff]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://www.janhouse.lv/?p=557</guid>
		<description><![CDATA[In one of my previous blog posts I mentioned hiding your server behind proxy to protect yourself from long downtime. Since some of you wanted more information, I figured I should write about it. This will still only scratch the surface of it and you should do some additional reading if you want to get a [...]]]></description>
				<content:encoded><![CDATA[<p>In one of my <a title="Internet paranoid handbook" href="http://www.janhouse.lv/blog/things/internet-paranoid-handbook/" target="_blank">previous blog posts</a> I mentioned <a title="Hiding" href="http://www.janhouse.lv/blog/things/internet-paranoid-handbook/#8-Hiding" target="_blank">hiding your server behind proxy</a> to protect yourself from long downtime.</p>
<p>Since some of you wanted more information, I figured I should write about it. This will still only scratch the surface of it and you should do some additional reading if you want to get a better understanding of how these things work and what they can be used for.</p>
<p>Let&#8217;s begin!</p>
<p><span id="more-557"></span></p>
<p>The idea behind this <em>tutorial</em> is that you have 2 servers. One is used as a proxy and static content provider (yes, this is the box your other server is  hiding behind) and the other one is the server you keep your actual site on (database, scripts, etc.).</p>
<p>When user requests page on your site, proxy server passes this request to the backend server. Backend server then generates the page and sends it back to the proxy. Proxy then returns the page to the user requesting it.</p>
<p>To make it a bit faster, static content like images, CSS and javascript files are stored on your proxy server. These static files are synchronised from backend.</p>
<p>Also, to make it more secure and fast, multiple SSH tunnels are used between proxy and backend. All page requests from proxy to backend go through these SSH tunnels and web server on the backend listens for connections only locally so the site would not be accessible by making request to the backend directly.</p>
<p>Following diagram illustrates how it works:</p>
<p><a href="http://www.janhouse.lv/wp-content/uploads/2011/09/Diagram1.png"><img class="aligncenter size-full wp-image-558" title="Diagram1" src="http://www.janhouse.lv/wp-content/uploads/2011/09/Diagram1.png" alt="" width="692" height="236" /></a></p>
<p>Remember to tunnel everything, including your SMTP (e-mail) and possibly some other traffic. I <a title="Jailkit, mini_sendmail and custom HELO" href="http://www.janhouse.lv/blog/coding/jailkit-mini_sendmail-and-custom-helo/" target="_blank">already wrote about mini_sendmail</a> that can help you tunneling SMTP.</p>
<p>Also, log files on the proxy server should be disabled and backend server IP address should not appear in any configuration file on the proxy server.</p>
<p style="text-align: left;">In my case I used <a href="http://en.wikipedia.org/wiki/Nginx" target="_blank">Nginx</a> as web server and proxy, <a href="http://en.wikipedia.org/wiki/Rsync" target="_blank">rsync</a> as the tool to synchronise static files between the servers, <a href="http://en.wikipedia.org/wiki/Autossh" target="_blank">autossh</a> to keep tunnels open, <a href="http://www.acme.com/software/mini_sendmail/" target="_blank">mini_sendmail</a> to help tunnel SMTP.</p>
<p style="text-align: left;">To start the reverse tunnel using Autossh, use something like this on backend:</p>
<pre class="code">export AUTOSSH_PIDFILE=/tmp/tun1.pid &amp;&amp; autossh -M 2001 -fNgR 5101:127.0.0.1:10005 user@example.com
export AUTOSSH_PIDFILE=/tmp/tun2.pid &amp;&amp; autossh -M 2003 -fNgR 5102:127.0.0.1:10005 user@example.com
export AUTOSSH_PIDFILE=/tmp/tun3.pid &amp;&amp; autossh -M 2005 -fNgR 5103:127.0.0.1:10005 user@example.com
export AUTOSSH_PIDFILE=/tmp/tun4.pid &amp;&amp; autossh -M 2007 -fNgR 5104:127.0.0.1:10005 user@example.com</pre>
<p class="code">I would make some script to easily start or stop them all at once and add it to server startup. Also remember that you should use key authentication to open SSH connection automatically.</p>
<p>Make backend Nginx listen only locally:</p>
<pre class="code">listen 127.0.0.1:10005 default;</pre>
<p>Set up proxy box to pass all requests to backend:</p>
<pre class="code">upstream backend {
    server 127.0.0.1:5101;
    server 127.0.0.1:5102;
    server 127.0.0.1:5103;
    server 127.0.0.1:5104;
}
server {
    listen 80;
    server_name example.com;
    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://backend;
    }
}</pre>
<p>Also add virtual host or <em>location</em> block for static content on proxy box.</p>
<p>For static file synchronisation, create rsync.sh, make it executable and add to crontab.</p>
<pre class="code">#!/bin/bash
SOURCEPATH='/srv/static/'
DESTPATH='/srv/www/'
DESTHOST='example.com'
DESTUSER='user'
LOGFILE='rsynsync.log'
rsync -av -rsh=ssh $SOURCEPATH $DESTUSER@$DESTHOST:$DESTPATH 2&gt;&amp;1 &gt;&gt; $LOGFILE
echo "Completed at: `/bin/date`" &gt;&gt; $LOGFILE</pre>
<p>&nbsp;</p>
<p>These are just the basic steps but they should give you an idea how to use this.</p>
<p>For example, I use Nginx proxying to make server changes unnoticeable. Some Bittorrent trackers use this method to hide their servers and come back sooner after their proxy servers are taken down.</p>
<p>Depending on the site you are hosting, every setup can be different, so use your imagination to make it suit your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.janhouse.lv/blog/server-stuff/hiding-your-web-server-behind-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Internet paranoid handbook</title>
		<link>http://www.janhouse.lv/blog/things/internet-paranoid-handbook/</link>
		<comments>http://www.janhouse.lv/blog/things/internet-paranoid-handbook/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 10:47:40 +0000</pubDate>
		<dc:creator>Janhouse</dc:creator>
				<category><![CDATA[Things]]></category>
		<category><![CDATA[anonymity]]></category>
		<category><![CDATA[anonymous]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[paranoia]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[skype]]></category>
		<category><![CDATA[tor]]></category>

		<guid isPermaLink="false">http://m.janhouse.lv/?p=535</guid>
		<description><![CDATA[Knowing that internet is not all cute and cuddly and that the line between real and virtual sometimes gets kind of blurry, it is important to think a bit before acting, and possibly save you from getting in trouble. What I meant by &#8220;blurry line between real world and virtual one&#8221;  is that what happens [...]]]></description>
				<content:encoded><![CDATA[<p>Knowing that internet is not all <a href="http://www.janhouse.lv/wp-content/uploads/2011/07/2876184809_7214cf727d.jpg" target="_blank">cute and cuddly</a> and that the line between real and virtual sometimes gets kind of blurry, it is important to think a bit before acting, and possibly save you from getting in trouble.</p>
<p>What I meant by &#8220;blurry line between real world and virtual one&#8221;  is that what happens on internet not always stays on internet. If you read news, it is possible that you have noticed articles about police raids on some sort of network based service providers or their servers, governments asking communication service providers (e-mail, IM, others) to hand them private conversations to help in their investigations, or blocking network access and disturbing donation receiving.</p>
<p>While some &#8220;shady&#8221; network services were started by paranoid people (in a good sense), who think a lot about their security and anonymity, most others don&#8217;t realise how important it could be or just don&#8217;t care.</p>
<p>Who should care about this? People who call themselves media, political organisations, internet pirates and people who want to stay anonymous.</p>
<p>&nbsp;</p>
<p>Here are some quick tips that could be of some use to you:</p>
<div id='toc'><div id='toc_title' class='post-535'>Table of contents</div>
<ul><li><a href="#1-Domain-name">1. Domain name</a></li>
<li><a href="#2-Location">2. Location</a></li>
<li><a href="#3-Laws-of-your-country">3. Laws of your country</a></li>
<li><a href="#4-Inability-to-reach-users-after-takedown">4. Inability to reach users after takedown</a></li>
<li><a href="#5-Encryption">5. Encryption</a></li>
<li><a href="#7-Data-loss-and-downtime">7. Data loss and downtime</a></li>
<li><a href="#8-Hiding">8. Hiding</a></li>
<li><a href="#Conclusion">Conclusion</a></li>
</ul></li></ul>
</div>
<h3 id='1-Domain-name'>1. Domain name</h3>
<p>Since most of the visitors reach your service through domain name, make sure you use domain name(s) that <a href="http://www.networkworld.com/news/2011/011811-us-official-defends-domain-seizures.html" target="_blank">can&#8217;t be easily taken away </a>by your country&#8217;s government or <a href="http://torrentfreak.com/pirate-admins-sweat-as-ice-reveal-extradition-criteria-110704/" target="_blank">get you in problems for using them</a>.</p>
<p>&nbsp;</p>
<h3 id='2-Location'>2. Location</h3>
<h4 id='21-Choosing-country'>2.1. Choosing country</h4>
<p>Make sure your files are hosted on servers outside of your government&#8217;s reach. In case of  piracy, countries that don&#8217;t care about piracy or anti-piracy are best suited for this (Canda?).</p>
<p>Also make sure that your country doesn&#8217;t have official international investigation agreements with the hoster country.</p>
<h4 id='22-Choosing-data-center'>2.2. Choosing data center</h4>
<p>It would not hurt if the data center would be located deep under ground in some fortress that was previously used as a bomb shelter. Probably most countries have those.</p>
<h4 id='23-Dont-bring-your-work-to-home'>2.3. Don&#8217;t bring your work to home</h4>
<p>If there is something physical that can&#8217;t be encrypted and hidden, don&#8217;t keep it at home. Hell, don&#8217;t keep it at home even if it is encrypted!</p>
<p>&nbsp;</p>
<h3 id='3-Laws-of-your-country'>3. Laws of your country</h3>
<p>In certain cases, make sure that you can&#8217;t be extradited to other country. If necessary, move to new home. If you are dealing with some really  powerful people, this could be really tricky (Wikileaks case).</p>
<p>&nbsp;</p>
<h3 id='4-Inability-to-reach-users-after-takedown'>4. Inability to reach users after takedown</h3>
<p>Nothing scares away users more than leaving them wondering what is going one. Make sure you have some social messaging account that is hosted on safe grounds, that all your users know about. In case of problems inform them using those tools.</p>
<p>&nbsp;</p>
<h3 id='5-Encryption'>5. Encryption</h3>
<h4 id='51Disk-encryption'>5.1.Disk encryption</h4>
<p>Keep your data encrypted and don&#8217;t give the key to anyone. Also recommend this to your clients.</p>
<p>Since computers are getting more powerful all the time, complaining about CPU power needed to use data encryption is silly.</p>
<p>Also make sure that your encryption key can&#8217;t be accessed using <a href="http://citp.princeton.edu/memory/" target="_blank">cold boot attack</a>. If needed, glue the RAM to the motherboard! Seriously, this could help. <img src='http://www.janhouse.lv/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<h4 id='52-Connection-encryption'>5.2. Connection encryption</h4>
<p>Use connection encryption between your server and clients.</p>
<p>If you don&#8217;t trust your government and certificates given out by some companies, make your own and make sure your clients recognize it.</p>
<p>&nbsp;</p>
<h3 id='7-Data-loss-and-downtime'>7. Data loss and downtime</h3>
<p>Good old saying &#8220;Real men don&#8217;t make backups&#8221; is meant more like a joke and should not be taken seriously. Do make backups! Keep them far away from your main server, hide them, encrypt them, but make sure you have them (and try not to loose the key).</p>
<p>Having not only your data but also server configuration backed up could help reduce downtime in case of server change.</p>
<p>&nbsp;</p>
<h3 id='8-Hiding'>8. Hiding</h3>
<h4 id='81-Fake-identities-for-fake-servers'>8.1. Fake identities for fake servers</h4>
<p>Hiding your super powerful server behind cheap, anonymous VPS could help you stay unidentified by less powerful people. There are some hosting companies that provide cheap VPS hosting and allow you to enter fake owner data for small fee. If you can then hide your payment account and fake your domain name owner data, you could stay anonymous as long as your proxy hoster doesn&#8217;t give out your real server address. In this case even if your proxy is taken down, reopening is just a matter of getting new proxy server in some other part of the world.</p>
<h4 id='82-Anonymous-administration'>8.2. Anonymous administration</h4>
<p>There is always some risk that your server could be taken and data searched for leads.</p>
<p>If possible, leave no log files about your clients and administrators or make up some fake ones.</p>
<p>Use proxy! <a href="https://www.torproject.org/" target="_blank">Tor Project</a> should help you hide yourself.</p>
<h4 id='83-Dont-use-Skype'>8.3. Don&#8217;t use Skype</h4>
<p>Since Skype was bought by Micro$oft, it can&#8217;t provide anonymous communication anymore. As an extra, they probably added the famous &#8220;generic crash library&#8221; to it. <img src='http://www.janhouse.lv/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  OK, to be serious, most of the public IM and e-mail networks should be considered unsafe. Set up your own private encrypted IM network and don&#8217;t log stuff.</p>
<p>But if we keep talking about Micro$soft, try to stay away from it. You never know what is hiding in their lame binaries and &#8220;security through obscurity&#8221; (M$&#8217;s motto?) is stupid. Open source software is the future, go with it, explore how &#8220;security by design&#8221; works.</p>
<p>&nbsp;</p>
<h3 id='Conclusion'>Conclusion</h3>
<p>It is hard to write universal hiding guide for every project and each case is different. If you think it is necessary, get someone to give you good advices.</p>
<p>Remember that it takes only one small mistake to fail completely.</p>
<p>Most importantly keep your conscience clean and be good! If you are doing it for the right reasons (and have <a href="http://en.wikipedia.org/wiki/Public_relations" target="_blank">good PR campaign</a>), people will support you (shouldn&#8217;t they?).</p>
<p>&nbsp;</p>
<p>P.S. <em>Feel free to add more tips or point to some errors in the comment section. I&#8217;l try to keep this post up to date.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.janhouse.lv/blog/things/internet-paranoid-handbook/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hamster time tracker in system tray</title>
		<link>http://www.janhouse.lv/blog/linux/hamster-time-tracker-in-system-tray/</link>
		<comments>http://www.janhouse.lv/blog/linux/hamster-time-tracker-in-system-tray/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 04:22:06 +0000</pubDate>
		<dc:creator>Janhouse</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[bitbucket]]></category>
		<category><![CDATA[hamster]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[time-tracker]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.janhouse.lv/?p=444</guid>
		<description><![CDATA[Hamster-tray puts Hamster time tracker in system tray.]]></description>
				<content:encoded><![CDATA[<p><a href="http://projecthamster.wordpress.com/" target="_blank">Project Hamster</a> is probably the best Linux time tracker out there.</p>
<p>But there is a small problem. It is written to be used as Gnome panel applet. I guess that some things will change with Gnome 3 (maybe it will get better Gnome shell integration or something?) but the lead developer has written that <a href="http://projecthamster.wordpress.com/2011/02/15/no-hamster-for-gnome-3-0-but-one-for-3-0-2-perhaps/#comment-1711" target="_blank">there will be no tray icon</a> for Hamster:</p>
<blockquote><p><em>generally though the system or notification tray is the no-go zone and  one that triggered all the shunning in the panels (too many icons  behaving too differently etc).</em></p></blockquote>
<p>I found that there is <a href="http://albertomilone.com/wordpress/?p=502" target="_blank">script to use it with Ubuntu&#8217;s indicator applet</a> but could not find one for system tray.</p>
<p>So I did it myself.</p>
<div id="attachment_446" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.janhouse.lv/wp-content/uploads/2011/04/tray_hamster_inactive.png"><img class="size-medium wp-image-446 " title="Hamster tray" src="http://www.janhouse.lv/wp-content/uploads/2011/04/tray_hamster_inactive-300x51.png" alt="" width="300" height="51" /></a><p class="wp-caption-text">Inactive icon</p></div>
<p style="text-align: left;"><strong>I modified <a href="https://github.com/tseliot/hamster-appindicator" target="_blank">hamster-appindicator script</a> by Alberto Milone to work with system tray (instead of appindicator).</strong> It now behaves similar to the panel applet.  Only noticeable difference is that you don&#8217;t see current running task name and time in  the tray (because there is only an icon and no text) and how long it has been  running, but you can see it in the tooltip of the tray icon.</p>
<p>&nbsp;</p>
<div id="attachment_448" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.janhouse.lv/wp-content/uploads/2011/04/tray_hamster_menu.png"><img class="size-medium wp-image-448" title="tray_hamster_menu" src="http://www.janhouse.lv/wp-content/uploads/2011/04/tray_hamster_menu-300x195.png" alt="" width="300" height="195" /></a><p class="wp-caption-text">Right click menu</p></div>
<p>To make it more usable, I have  included green and red icons that are used to indicate running task (by default I made it use green icon but you can  change it  in the script).</p>
<p>Left mouse click toggles tracker window, right click shows menu.</p>
<div id="attachment_447" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.janhouse.lv/wp-content/uploads/2011/04/tray_hamster_open.png"><img class="size-medium wp-image-447 " title="tray_hamster_open" src="http://www.janhouse.lv/wp-content/uploads/2011/04/tray_hamster_open-300x143.png" alt="" width="300" height="143" /></a><p class="wp-caption-text">Opened window</p></div>
<p style="text-align: left;"><strong>Icons and script can be downloaded from <a href="https://bitbucket.org/janhouse/hamster-tray/downloads" target="_blank">https://bitbucket.org/janhouse/hamster-tray/downloads</a> .</strong></p>
<ul>
<li>Copy icons to /usr/share/icons/ or ~/.icons/</li>
<li>Install latest Hamster (I tested it with latest git version): <a href="http://projecthamster.wordpress.com/building-and-running/" target="_blank">http://projecthamster.wordpress.com/building-and-running/</a></li>
<li>Get latest hamster-tray version from <a href="https://bitbucket.org/janhouse/hamster-tray/downloads" target="_blank">https://bitbucket.org/janhouse/hamster-tray/downloads</a></li>
<li>make it executable and run it</li>
</ul>
<p>I&#8217;l later make hamster-tray PKGBUILD for Archlinux and put it on AUR.</p>
<p>If you want to point out any errors (it probably has some since I was making it in rush in the middle of the night) leave a comment. I&#8217;l try to update it at some point.</p>
<p><em>P.S. YAY! I can use Hamster again!</em> <img src='http://www.janhouse.lv/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&nbsp;</p>
<h2 id='UPDATE'><strong>UPDATE:</strong></h2>
<p style="padding-left: 30px;"><strong>08.04.2011.<br />
</strong></p>
<p>After upgrading my Archlinux today I noticed that it did not work anymore because upgrade contained Gnome3 stuff.</p>
<p>So the error was:</p>
<pre style="padding-left: 30px;">$ hamster-tray
Traceback (most recent call last):
  File "/usr/local/bin/hamster-tray", line 51, in &lt;module&gt;
    from hamster.applet import HamsterApplet
  File "/usr/lib/python2.7/site-packages/hamster/applet.py", line 29, in &lt;module&gt;
    import gnomeapplet
ImportError: libpanel-applet-2.so.0: cannot open shared object file: No such file or directory</pre>
<p>Quick dirty fix for the moment is to edit applet.py and remove line:</p>
<pre style="padding-left: 30px; text-align: left;">import gnomeapplet</pre>
<p>This will probably make it not work as Gnome 2 panel applet but I guess that those applets are removed from Gnome3 anyway.</p>
<p><strong>This is just a temporary fix and I will try to completely rewrite this script as soon as I get some time.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.janhouse.lv/blog/linux/hamster-time-tracker-in-system-tray/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Jailkit, mini_sendmail and custom HELO</title>
		<link>http://www.janhouse.lv/blog/coding/jailkit-mini_sendmail-and-custom-helo/</link>
		<comments>http://www.janhouse.lv/blog/coding/jailkit-mini_sendmail-and-custom-helo/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 22:53:50 +0000</pubDate>
		<dc:creator>Janhouse</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[chroot]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.janhouse.lv/?p=310</guid>
		<description><![CDATA[To be sure that a server stays safe in case when one site is compromised, I try to lock every single site in its own chroot jail. To make it a bit easier I use Jailkit. Since you probably don&#8217;t want to set up sendmail for each chroot, you could use mini_sendmail. It will work [...]]]></description>
				<content:encoded><![CDATA[<p>To be sure that a server stays safe in case when one site is compromised, I try to lock every single site in its own <em><a href="http://en.wikipedia.org/wiki/Chroot" target="_blank">chroot jail</a></em>. To make it a bit easier I use <em><a href="http://olivier.sessink.nl/jailkit/" target="_blank">Jailkit</a></em>.</p>
<p>Since you probably don&#8217;t want to set up <em><a href="http://en.wikipedia.org/wiki/Sendmail" target="_blank">sendmail</a></em> for each <em>chroot</em>, you could use <em><a href="http://www.acme.com/software/mini_sendmail/" target="_blank">mini_sendmail</a></em>. It will work as relay and will pass messages to actual <em>sendmail</em>.</p>
<p>The problem is that there is no way to specify a custom username or <em>hostname</em> and this could be quite important in some cases.</p>
<p>In order to solve this problem I did some quick and dirty modifications and here is the patch in case you need it:</p>
<pre class="code hide">--- Makefile
+++ Makefile
@@ -7,10 +7,10 @@
 BINDIR =	/usr/local/sbin
 MANDIR =	/usr/local/man
 CC =		gcc
-CFLAGS =	-O
-#CFLAGS =	-g
-LDFLAGS =	-s -static
-#LDFLAGS =	-g -static
+#CFLAGS =	-O
+CFLAGS =	-g
+#LDFLAGS =	-s -static
+LDFLAGS =	-g -static
 LDLIBS =	$(SYSV_LIBS)

 CC :=		$(DIET) $(CC)
--- mini_sendmail.c
+++ mini_sendmail.c
@@ -65,6 +65,8 @@
 static char* argv0;
 static char* fake_from;
 static int parse_message, verbose;
+static char* helo;
+static char* user;
 #ifdef DO_MINUS_SP
 static char* server;
 static short port;
@@ -80,7 +82,7 @@
 static void usage( void );
 static char* slurp_message( void );
 #ifdef DO_RECEIVED
-static char* make_received( char* from, char* username, char* hostname );
+static char* make_received( char* from, char* user, char* helo );
 #endif /* DO_RECEIVED */
 static void parse_for_recipients( char* message );
 static void add_recipient( char* recipient, int len );
@@ -111,6 +113,7 @@
     argv0 = argv[0];
     fake_from = (char*) 0;
     parse_message = 0;
+	server = "localhost";
 #ifdef DO_MINUS_SP
     server = "127.0.0.1";
     port = SMTP_PORT;
@@ -124,6 +127,10 @@
 	    fake_from = &amp;(argv[argn][2]);
 	else if ( strcmp( argv[argn], "-t" ) == 0 )
 	    parse_message = 1;
+	else if ( strncmp( argv[argn], "-h", 2 ) == 0 &amp;&amp; argv[argn][2] != '\0' )
+	    helo = &amp;(argv[argn][2]);
+	else if ( strncmp( argv[argn], "-u", 2 ) == 0 &amp;&amp; argv[argn][2] != '\0' )
+	    user = &amp;(argv[argn][2]);
 #ifdef DO_MINUS_SP
 	else if ( strncmp( argv[argn], "-s", 2 ) == 0 &amp;&amp; argv[argn][2] != '\0' )
 	    server = &amp;(argv[argn][2]);
@@ -162,14 +169,22 @@
 #endif /* DO_GETPWUID */
 	}

+	if ( user == (char*) 0 ){
+		user=username;
+	}
+
     if ( gethostname( hostname, sizeof(hostname) - 1 ) &lt; 0 )
 	show_error( "gethostname" );

+	if ( helo == (char*) 0 ){
+		helo=username;
+	}
+
     if ( fake_from == (char*) 0 )
-	(void) snprintf( from, sizeof(from), "%s@%s", username, hostname );
+	(void) snprintf( from, sizeof(from), "%s@%s", user, helo );
     else
 	if ( strchr( fake_from, '@' ) == (char*) 0 )
-	    (void) snprintf( from, sizeof(from), "%s@%s", fake_from, hostname );
+	    (void) snprintf( from, sizeof(from), "%s@%s", fake_from, helo );
 	else
 	    (void) snprintf( from, sizeof(from), "%s", fake_from );

@@ -181,7 +196,7 @@

     message = slurp_message();
 #ifdef DO_RECEIVED
-    received = make_received( from, username, hostname );
+    received = make_received( from, user, helo );
 #endif /* DO_RECEIVED */

     (void) signal( SIGALRM, sigcatch );
@@ -209,7 +224,7 @@
 	exit( 1 );
 	}

-    (void) snprintf( buf, sizeof(buf), "HELO %s", hostname );
+    (void) snprintf( buf, sizeof(buf), "HELO %s", helo );
     send_command( buf );
     status = read_response();
     if ( status != 250 )
@@ -337,7 +352,7 @@

 #ifdef DO_RECEIVED
 static char*
-make_received( char* from, char* username, char* hostname )
+make_received( char* from, char* user, char* helo )
     {
     int received_size;
     char* received;
@@ -349,8 +364,8 @@
     tmP = localtime( &amp;t );
     (void) strftime( timestamp, sizeof(timestamp), "%a, %d %b %Y %T %Z", tmP );
     received_size =
-	500 + strlen( from ) + strlen( hostname ) * 2 + strlen( VERSION ) +
-	strlen( timestamp ) + strlen( username );
+	500 + strlen( from ) + strlen( helo ) * 2 + strlen( VERSION ) +
+	strlen( timestamp ) + strlen( user );
     received = (char*) malloc( received_size );
     if ( received == (char*) 0 )
 	{
@@ -360,7 +375,7 @@
     (void) snprintf(
 	received, received_size,
 	"Received: (from %s)\n\tby %s (%s);\n\t%s\n\t(sender %s@%s)\n",
-	from, hostname, VERSION, timestamp, username, hostname );
+	from, helo, VERSION, timestamp, user, helo );
     return received;
     }
 #endif /* DO_RECEIVED */</pre>
<p>Save it as <strong>some.patch</strong>. Move it inside mini_sendmail source directory and run:</p>
<pre>patch -p0 &lt; some.patch
make
cp mini_sendmail /to/jail/usr/bin/sendmail</pre>
<p>You can specify username with <strong>-u</strong> and hostname (and <em>HELO</em> message) with <strong>-h</strong> parameter.</p>
<p>If you are going to use it with PHP, change<em><strong> sendmail_path</strong></em> in<em><strong> php.ini </strong></em>to something like this:</p>
<pre>sendmail_path = /usr/bin/sendmail -s127.0.0.1 -p5555 -unoreply -hexample.com -fnoreply@example.com -t -i</pre>
<p>This should make <em>php</em> connect to <em>sendmail</em> running on <em>127.0.0.1</em> port <em>5555</em> and send <em>example.com</em> as <em>HELO</em> and <em>noreply</em> as username.</p>
<p>Patch was made for version 1.3.6.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.janhouse.lv/blog/coding/jailkit-mini_sendmail-and-custom-helo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 2/27 queries in 0.009 seconds using memcached
Object Caching 561/710 objects using memcached

 Served from: www.janhouse.lv @ 2013-05-22 13:09:49 by W3 Total Cache -->