<?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>Rule of Tech &#187; Tech</title>
	<atom:link href="http://ruleoftech.com/journal/category/tech/feed" rel="self" type="application/rss+xml" />
	<link>http://ruleoftech.com</link>
	<description>Everything and nothing but still something about Tech</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:58:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using CAcert.org signed certificates for TLS</title>
		<link>http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls</link>
		<comments>http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls#comments</comments>
		<pubDate>Mon, 09 Jan 2012 19:26:56 +0000</pubDate>
		<dc:creator>Marko</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[certs]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://ruleoftech.wordpress.com/?p=31</guid>
		<description><![CDATA[<p>Setting up Transport Layer Security (TLS), or as previously known as Secure Sockets Layer (SSL), for Apache, Postfix and IMAP like Dovecot is fairly easy. You just need some digital certificates and configuration. If you don&#8217;t want to pay for certificates from trusted sources like Thawte or you just don&#8217;t need that kind of trust (for development purposes), you can always produce your own certificates.&#8230; <a href="http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls" class="read_more">Continue reading <span class=\\\"meta-nav\\\">&#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<p>Setting up Transport Layer Security (TLS), or as previously known as Secure Sockets Layer (SSL), for Apache, Postfix and IMAP like Dovecot is fairly easy. You just need some digital certificates and configuration. If you don&#8217;t want to pay for certificates from trusted sources like Thawte or you just don&#8217;t need that kind of trust (for development purposes), you can always produce your own certificates. But there is also a middle way: using <a href="http://www.cacert.org/">CAcert.org</a> signed certificates.</p>
<p><strong>Background</strong><br />
<a href="http://en.wikipedia.org/wiki/CAcert.org">Wikipedia tells us that CAcert.org is</a> a community-driven certificate authority that issues free public key certificates. CAcert automatically signs certificates for email addresses controlled by the requester and for domains for which certain addresses (such as &#8220;hostmaster@example.com&#8221;) are controlled by the requester. Thus it operates as a robot certificate authority. CAcert certificates can be used like any other SSL certificates although they are considered weak because CAcert does not emit any information in the certificates other than the domain name or email address. To create higher-trust certificates, users can participate in a web of trust system whereby users physically meet and verify each other&#8217;s identities. They are also not as useful in web browsers as certificates issued by commercial CAs such as VeriSign, because most installed web browsers do not distribute CAcert&#8217;s root certificate. Thus, for most web users, a certificate signed by CAcert behaves like a self-signed certificate. </p>
<p><strong>Generating Certificates</strong><br />
The procedure to sign your certificate at CAcert is rather simple. This guide assumes that the certificates are in <em>/etc/ssl/cacert/</em> and you are as <em>root</em>.</p>
<p>0. <a href="https://wiki.cacert.org/HELP/6">Join CAcert.org</a> and fill in your details. After email verification and login, add domain and service will try to verify that you can read mail on one of following accounts: root, hostmaster, postmaster, admin, webmaster or email addresses that can be found on whois data of domain that you provided.</p>
<p>1. Generate a private key that is not file encrypted:</p>
<pre>
<code>openssl genrsa -out domainname.key 1024
chown root:root domainname.key
chmod 0400 domainname.key</code>
</pre>
<p>Private keys should belong to &#8220;root&#8221; and be readable only by root.</p>
<p>You could also create a private key that is encrypted: <code>openssl genrsa -des3 -out domainname.key 1024</code></p>
<p>2. Create a CSR with the RSA private key (output will be PEM format). Do not enter extra attributes at the prompt and leave the challenge password blank (press enter): </p>
<pre>
<code>openssl req -new -key domainname.key -out domainname.csr</code>
</pre>
<p>3. Verify the contents of the CSR or private key:</p>
<pre>
<code>openssl req -noout -text -in domainname.csr</code>
<code>openssl rsa -noout -text -in domainname.key</code>
</pre>
<p>4. Send your public key to be signed by and request new server certificate from CAcert.org web site (Class 1 certificate). When you are asked for CSR paste content of <em>domainname.csr</em>. It should look like this:</p>
<pre>
-----BEGIN CERTIFICATE REQUEST-----
MIIB3TCCAUYCAQAwgZwxCzAJBgNVBAYTAkZJMRAwDgYDVQQIEwdVdXNpbWFhMQ8w
...clip...
MQ==
-----END CERTIFICATE REQUEST-----
</pre>
<p>You can verify the content of request before sending it</p>
<pre>
<code>openssl req -in domainname.csr -text -verify -noout</code>
</pre>
<p>5. Copy the Server Certificate from the CAcert.org webpage and put it in <em>domainname.crt</em> file and add permissions.</p>
<pre>
<code>chmod a=r domainname.crt</code>
</pre>
<p>Check at least the contents of Validity and Subject fields:</p>
<pre>
<code>openssl x509 -in domainname.crt -text -noout</code>
</pre>
<p>6. Get CAcert.org root certificate</p>
<pre>
<code>wget -nv https://www.cacert.org/certs/root.crt -O cacert-org.crt
chmod a=r cacert-org.crt</code>
</pre>
<p>Check the contents:</p>
<pre>
<code>openssl x509 -in cacert-org.crt -text -noout</code>
</pre>
<p>After that you&#8217;re ready to configure your services like Apache, Postfix and Dovecot to use the new certificate. Read about it later.</p>
<h2  class="related_post_title">Related journal entries</h2><ul class="related_post"><li><a href="http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos" title="Installing Sun JDK 1.6 on CentOS">Installing Sun JDK 1.6 on CentOS</a></li><li><a href="http://ruleoftech.com/journal/wordpress-mod_rewrite-rules-taking-over-mod_status-and-mod_info" title="WordPress mod_rewrite rules taking over mod_status and mod_info">WordPress mod_rewrite rules taking over mod_status and mod_info</a></li><li><a href="http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos" title="Installing Apache Tomcat 6 on CentOS">Installing Apache Tomcat 6 on CentOS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Apache Tomcat 6 on CentOS</title>
		<link>http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos</link>
		<comments>http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:49:53 +0000</pubDate>
		<dc:creator>Marko</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://ruleoftech.wordpress.com/?p=40</guid>
		<description><![CDATA[<p>CentOS is great substitute for Red Hat Enterprise Linux but is missing some useful packages like Apache Tomcat 6. Installing Apache Tomcat 6 on CentOS 5 from gzip-package is fairly easy. The following guide is at least for CentOS 5.4.</p>
<p><strong>Pre-Requirements</strong><br />
First you need to install Sun JDK and you can follow the instructions given in <a href="http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos">Installing Sun JDK 1.6 on CentOS</a></p>
<p>After Java is on place it&#8217;s time to get ready for Tomcat.&#8230; <a href="http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos" class="read_more">Continue reading <span class=\\\"meta-nav\\\">&#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<p>CentOS is great substitute for Red Hat Enterprise Linux but is missing some useful packages like Apache Tomcat 6. Installing Apache Tomcat 6 on CentOS 5 from gzip-package is fairly easy. The following guide is at least for CentOS 5.4.</p>
<p><strong>Pre-Requirements</strong><br />
First you need to install Sun JDK and you can follow the instructions given in <a href="http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos">Installing Sun JDK 1.6 on CentOS</a></p>
<p>After Java is on place it&#8217;s time to get ready for Tomcat.</p>
<p><strong>Download Apache Ant and Tomcat</strong></p>
<ol>
<li>Download <a href="http://ant.apache.org/">apache-ant</a> and <a href="http://tomcat.apache.org/">apache-tomcat</a> -packages.
<li>Extract those packages to <code>/opt/</code>
<ul class="listcodeblock">
<li>
<pre>
#[root@srv ~]# cd /opt
# tar -xzf apache-tomcat-6.0.26.tar.gz
# tar -xzf apache-ant-1.7.1-bin.tar.gz
</pre>
</li>
</ul>
</li>
<li>Create a symbolic link for Ant
<ul class="listcodeblock">
<li>
<pre>
# ln -s /opt/apache-ant-1.7.1/bin/ant /usr/bin/
</pre>
</li>
</ul>
</li>
</ol>
<p><strong>Create start script</strong></p>
<ol>
<li>Create a tomcat user so that we don&#8217;t need root privileges for Tomcat
<ul class="listcodeblock">
<li>
<pre>
# useradd -d /opt/apache-tomcat-6.0.26/ tomcat
</pre>
</li>
</ul>
</li>
<li>Create start script to /etc/init.d for starting and stopping Tomcat
<ul class="listcodeblock">
<li>
<pre>
#  vim /etc/init.d/tomcat
</pre>
</li>
</ul>
</li>
<li>The script is (via <a href="http://www-128.ibm.com/developerworks/java/library/l-secjav.html">Build a safe cage for Tomcat</a>)
<ul class="listcodeblock">
<li>

<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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># tomcat       Starts Tomcat Java server.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># chkconfig: 345 88 12</span>
<span style="color: #666666; font-style: italic;"># description: Tomcat is the server for </span>
<span style="color: #666666; font-style: italic;"># Java servlet applications.</span>
<span style="color: #666666; font-style: italic;">### BEGIN INIT INFO</span>
<span style="color: #666666; font-style: italic;"># Provides: $tomcat</span>
<span style="color: #666666; font-style: italic;">### END INIT INFO</span>
&nbsp;
<span style="color: #007800;">JAVA_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>java<span style="color: #000000; font-weight: bold;">/</span>jdk1.6.0_18
<span style="color: #7a0874; font-weight: bold;">export</span> JAVA_HOME
<span style="color: #007800;">TOMCAT_HOME</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat-6.0.26<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #007800;">START_TOMCAT</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat-6.0.26<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>startup.sh
<span style="color: #007800;">STOP_TOMCAT</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>apache-tomcat-6.0.26<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>shutdown.sh
&nbsp;
<span style="color: #666666; font-style: italic;"># Source function library.</span>
. <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>functions
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$START_TOMCAT</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$STOP_TOMCAT</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
&nbsp;
<span style="color: #007800;">RETVAL</span>=<span style="color: #000000;">0</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">umask</span> 077
&nbsp;
start<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> $<span style="color: #ff0000;">&quot;Starting Tomcat Java server: &quot;</span>
        daemon <span style="color: #c20cb9; font-weight: bold;">su</span> <span style="color: #660033;">-c</span> <span style="color: #007800;">$START_TOMCAT</span> tomcat
        <span style="color: #7a0874; font-weight: bold;">echo</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$RETVAL</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
stop<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> $<span style="color: #ff0000;">&quot;Shutting down Tomcat Java server: &quot;</span>
        daemon <span style="color: #c20cb9; font-weight: bold;">su</span> <span style="color: #660033;">-c</span> <span style="color: #007800;">$STOP_TOMCAT</span> tomcat
        <span style="color: #7a0874; font-weight: bold;">echo</span>
        <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$RETVAL</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
restart<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        stop
        start
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
  start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        start
        <span style="color: #000000; font-weight: bold;">;;</span>
  stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        stop
        <span style="color: #000000; font-weight: bold;">;;</span>
  restart<span style="color: #000000; font-weight: bold;">|</span>reload<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        restart
        <span style="color: #000000; font-weight: bold;">;;</span>
  <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 {start|stop|restart}&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #007800;">$?</span></pre></td></tr></table></div>

</li>
</ul>
</li>
<li>Give executable rights for that script
<ul class="listcodeblock">
<li>
<pre>
# chmod 755 /etc/init.d/tomcat
</pre>
</li>
</ul>
</li>
<li>Add the script to CentOS services
<ul class="listcodeblock">
<li>
<pre>
# chkconfig --add tomcat
</pre>
</li>
</ul>
</li>
<li>Check the changes
<ul class="listcodeblock">
<li>
<pre>
# chkconfig --level 234 tomcat on
# chkconfig --list tomcat

tomcat 0:off 1:off 2:on 3:on 4:on 5:off 6:off
</pre>
</li>
</ul>
</li>
<li>You should see that the service uses levels 2, 3 and 4</li>
<li>Test that the script is working and it gives no errors
<ul class="listcodeblock">
<li>
<pre>
# service tomcat start
# service tomcat stop
</pre>
</li>
</ul>
</li>
<li>Everythings ready</li>
</ol>
<h2  class="related_post_title">Related journal entries</h2><ul class="related_post"><li><a href="http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports" title="Redirect HTTP and HTTPS traffic to Tomcat&#8217;s ports">Redirect HTTP and HTTPS traffic to Tomcat&#8217;s ports</a></li><li><a href="http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls" title="Using CAcert.org signed certificates for TLS">Using CAcert.org signed certificates for TLS</a></li><li><a href="http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos" title="Installing Sun JDK 1.6 on CentOS">Installing Sun JDK 1.6 on CentOS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Sun JDK 1.6 on CentOS</title>
		<link>http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos</link>
		<comments>http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:28:52 +0000</pubDate>
		<dc:creator>Marko</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[sysadmin]]></category>

		<guid isPermaLink="false">http://ruleoftech.com/?p=138</guid>
		<description><![CDATA[<p>CentOS doesn&#8217;t have a package for Sun JDK so it has to installed manually. It&#8217;s fairly easy but there are some steps to do that. This guide has been tested on CentOS 5.4 x64_86.</p>
<p><strong>Step 1. Initial setup for building RPM</strong><br />
-!- Do this with a non-root user</p>
<ol>
<li>Create ~/.rpmmacros
<ul class="listcodeblock">
<li>
<pre>
$ vim ~/.rpmmacros
%_topdir /home/<username>/rpmbuild
%_tmppath %{_topdir}/tmp
</username></pre>
</li>
</ul>
</li>
<li>Create needed folders:
<ul class="listcodeblock">
<li>
<pre>
$ mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}
</pre>
</li>
</ul>
</li>
<li>Build environment needs to be complete.</li>&#8230; <a href="http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos" class="read_more">Continue reading <span class=\\\"meta-nav\\\">&#8594;</span></a></ol>]]></description>
			<content:encoded><![CDATA[<p>CentOS doesn&#8217;t have a package for Sun JDK so it has to installed manually. It&#8217;s fairly easy but there are some steps to do that. This guide has been tested on CentOS 5.4 x64_86.</p>
<p><strong>Step 1. Initial setup for building RPM</strong><br />
-!- Do this with a non-root user</p>
<ol>
<li>Create ~/.rpmmacros
<ul class="listcodeblock">
<li>
<pre>
$ vim ~/.rpmmacros
%_topdir /home/<username>/rpmbuild
%_tmppath %{_topdir}/tmp
</pre>
</li>
</ul>
</li>
<li>Create needed folders:
<ul class="listcodeblock">
<li>
<pre>
$ mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}
</pre>
</li>
</ul>
</li>
<li>Build environment needs to be complete. Some needed packages are:
<ul class="listcodeblock">
<li>
<pre>
$ sudo yum install -y rpm-build gcc gcc-c++ redhat-rpm-config
</pre>
</li>
</ul>
</li>
</ol>
<p><strong>Step 2. Installing your favorite JDK</strong></p>
<ol>
<li>Download Sun JDK 1.6 update 14 from Sun Java download or the <a href="http://java.sun.com/products/archive/">Sun JDK archive</a>.
<ul>
<li>Choose the correct platform (for me it&#8217;s Linux x64) and download jdk-6u18-linux-x64-rpm.bin</li>
</ul>
</li>
<li>Give it executable rights: <code>$ chmod 755 jdk-6u18-linux-x64-rpm.bin</code></li>
<li>Run the binary to extract it into RPM form: <code>$ ./jdk-6u18-linux-x64-rpm.bin</code></li>
<li>Install it:
<ul class="listcodeblock">
<li>
<pre>
$ sudo rpm -Uvh jdk-6u18-linux-amd64.rpm
</pre>
</li>
</ul>
</li>
<li>Log out and in again to make the changes in the paths take effect</li>
<li>Check the install
<ul class="listcodeblock">
<li>
<pre>
$ java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
</pre>
</li>
</ul>
</li>
<li>Java is now installed on <code>/usr/bin/java</code></li>
</ol>
<h2  class="related_post_title">Related journal entries</h2><ul class="related_post"><li><a href="http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls" title="Using CAcert.org signed certificates for TLS">Using CAcert.org signed certificates for TLS</a></li><li><a href="http://ruleoftech.com/journal/wordpress-mod_rewrite-rules-taking-over-mod_status-and-mod_info" title="WordPress mod_rewrite rules taking over mod_status and mod_info">WordPress mod_rewrite rules taking over mod_status and mod_info</a></li><li><a href="http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos" title="Installing Apache Tomcat 6 on CentOS">Installing Apache Tomcat 6 on CentOS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Redirect HTTP and HTTPS traffic to Tomcat&#8217;s ports</title>
		<link>http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports</link>
		<comments>http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports#comments</comments>
		<pubDate>Thu, 11 Jun 2009 18:47:17 +0000</pubDate>
		<dc:creator>Marko</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://ruleoftech.wordpress.com/?p=38</guid>
		<description><![CDATA[<p>Apache Tomcat likes with default settings to listen to requests on 8080 and 8443 ports but it is more enjoyable to use the more common 80 and 443 ports for HTTP and HTTPS traffic. This way the user don&#8217;t have to put those pesky port numbers after the address. Of course you could just tell Tomcat to listen to those ports but it has some negative sides: hassle with the startup and running Tomcat as root.&#8230; <a href="http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports" class="read_more">Continue reading <span class=\\\"meta-nav\\\">&#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<p>Apache Tomcat likes with default settings to listen to requests on 8080 and 8443 ports but it is more enjoyable to use the more common 80 and 443 ports for HTTP and HTTPS traffic. This way the user don&#8217;t have to put those pesky port numbers after the address. Of course you could just tell Tomcat to listen to those ports but it has some negative sides: hassle with the startup and running Tomcat as root.</p>
<p>Luckily it is easy to tell the system to redirect the traffic from some port to other. Just define some new xinetd services in <em>/etc/xinetd.d/tomcat</em>.</p>
<pre>
# vim /etc/xinetd.d/tomcat

# Redirects any requests on port 80 to port 8080 (where Tomcat is listening)
service tomcat-http
{
        disable                 = no
        flags                   = REUSE
        wait                    = no
        user                    = root
        socket_type         = stream
        protocol                = tcp
        port                    = 80
        redirect                = localhost 8080
        log_on_success  -= PID HOST DURATION EXIT

        #per_source = UNLIMITED
        #instances = UNLIMITED
}

# Redirects any requests on port 443 to port 8443 (where Tomcat is listening)
service tomcat-https
{
        disable                 = no
        flags                   = REUSE
        wait                    = no
        user                    = root
        socket_type         = stream
        protocol                = tcp
        port                    = 443
        redirect                = localhost 8443
        log_on_success  -= PID HOST DURATION EXIT

        #per_source = UNLIMITED
        #instances = UNLIMITED
}
</pre>
<p>(via <a href="http://www.ibm.com/developerworks/java/library/l-secjav.html#h5">Securing Linux for Java services: The port dilemma</a>)</p>
<p>Xinetd puts a connection limit per source IP, by default and this causes the service to become unresponsive when there are dozens of queries a second. You see the following kind of line in your messages log file: &#8220;xinetd[2049]: FAIL: tomcat-https per_source_limit from=123.456.789.123&#8243;. To correct this, uncomment the per_source and instances lines in your xinet.d file and restart it.</p>
<p>Also add those xinetd services to <em>/etc/services</em>.</p>
<pre>
# vim /etc/services
http        80/tcp     www www-http tomcat-http # WorldWideWeb http
http        80/udp     www www-http tomcat-http # WorldWideWeb HTTP
http        443/tcp    tomcat-https # WorldWideWeb HTTPS
http        443/udp    tomcat-https # WorldWideWeb HTTPS
</pre>
<p>And now just restart the xinetd and admire how your traffic is redirected to Tomcat&#8217;s ports.</p>
<pre>
# service xinetd restart
</pre>
<p><strong>Force everything to transmit through HTTPS</strong><br />
If you also want to redirect all HTTP traffic to HTTPS you can add the following section to you Tomcat <em>web.xml</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-resource-collection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-resource-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Protected Context<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-resource-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-resource-collection<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #808080; font-style: italic;">&lt;!-- auth-constraint goes here if you requre authentication --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;user-data-constraint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;transport-guarantee<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>CONFIDENTIAL<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/transport-guarantee<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/user-data-constraint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>If you are using this redirection of all traffic to HTTPS with JIRA and want to attachments working also with Internet Explorer then you must add the following to your <em>jira.xml</em> (f. ex. /opt/tomcat/conf/Catalina/localhost/jira.xml). This is a Internet Explorer bug, for more information see <a href="http://jira.atlassian.com/browse/JRA-8179">http://jira.atlassian.com/browse/JRA-8179</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Context</span> ...<span style="color: #000000; font-weight: bold;">&gt;</span></span>
...
<span style="color: #808080; font-style: italic;">&lt;!-- for IE bug, see http://jira.atlassian.com/browse/JRA-8179--&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Valve</span> <span style="color: #000066;">className</span>=<span style="color: #ff0000;">&quot;org.apache.catalina.authenticator.NonLoginAuthenticator&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">disableProxyCaching</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Context<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h2  class="related_post_title">Related journal entries</h2><ul class="related_post"><li><a href="http://ruleoftech.com/journal/installing-apache-tomcat-6-on-centos" title="Installing Apache Tomcat 6 on CentOS">Installing Apache Tomcat 6 on CentOS</a></li><li><a href="http://ruleoftech.com/journal/using-cacert-org-signed-certificates-for-tls" title="Using CAcert.org signed certificates for TLS">Using CAcert.org signed certificates for TLS</a></li><li><a href="http://ruleoftech.com/journal/installing-sun-jdk-1-6-on-centos" title="Installing Sun JDK 1.6 on CentOS">Installing Sun JDK 1.6 on CentOS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://ruleoftech.com/journal/redirecting-http-and-https-traffic-to-tomcats-ports/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Keeping up with the time in Xen</title>
		<link>http://ruleoftech.com/journal/keeping-up-with-the-time-in-xen</link>
		<comments>http://ruleoftech.com/journal/keeping-up-with-the-time-in-xen#comments</comments>
		<pubDate>Mon, 21 Jan 2008 18:16:16 +0000</pubDate>
		<dc:creator>Marko</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://ruleoftech.wordpress.com/2008/01/21/keeping-up-with-the-time-in-xen-domu/</guid>
		<description><![CDATA[<p>A simple tip for keeping up with the time in Xen when your domU isn&#8217;t syncing the clock frequently enough and your clock is whatever. Of course you can sync your clock with <em>ntpdate</em> but first you need to set the domain (domU) to run its wallclock independently from Xen.</p>
<p>Simply say in the command line of domU:<br />
<code>echo 1 &#62; /proc/sys/xen/independent_wallclock</code></p>
<p>Or if you have noclobber on:<br />
<code>echo 1 &#62;!</code>&#8230; <a href="http://ruleoftech.com/journal/keeping-up-with-the-time-in-xen" class="read_more">Continue reading <span class=\\\"meta-nav\\\">&#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<p>A simple tip for keeping up with the time in Xen when your domU isn&#8217;t syncing the clock frequently enough and your clock is whatever. Of course you can sync your clock with <em>ntpdate</em> but first you need to set the domain (domU) to run its wallclock independently from Xen.</p>
<p>Simply say in the command line of domU:<br />
<code>echo 1 &gt; /proc/sys/xen/independent_wallclock</code></p>
<p>Or if you have noclobber on:<br />
<code>echo 1 &gt;! /proc/sys/xen/independent_wallclock</code></p>
<p>To reenable tracking of Xen wallclock:<br />
<code>echo 0 &gt; /proc/sys/xen/independent_wallclock</code></p>
<p>And to keep the setting between reboots, just add it to the <em>/etc/sysctl.conf</em>:<br />
<code>xen.independent_wallclock = 1</code></p>
<p>Although, it is better if the Xen dom0 syncs the clock frequently so all the domains (domU) don&#8217;t need to do it by themselves and thus wasting resources. Why do things multiple times when it could be done just once.</p>
<h2  class="related_post_title">Related journal entries</h2><ul class="related_post"><li>No Related Post</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ruleoftech.com/journal/keeping-up-with-the-time-in-xen/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Samba performance problem after kernel update</title>
		<link>http://ruleoftech.com/journal/samba-performance-problem-after-kernel-update</link>
		<comments>http://ruleoftech.com/journal/samba-performance-problem-after-kernel-update#comments</comments>
		<pubDate>Tue, 25 Dec 2007 21:58:23 +0000</pubDate>
		<dc:creator>Marko</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://ruleoftech.wordpress.com/2007/12/25/samba-performance-problem-after-kernel-update/</guid>
		<description><![CDATA[<p>Samba is a nice service to provide storage space through networks and it is relatively easy to set up. It&#8217;s not as fast as using NFS between Linux hosts but sometimes you don&#8217;t have that possibility. Sometimes there also might be quite confusing problems like I happened to notice.</p>
<p>My Samba service had worked fine for a long time but after a kernel update and a reboot, the performance was horrible.&#8230; <a href="http://ruleoftech.com/journal/samba-performance-problem-after-kernel-update" class="read_more">Continue reading <span class=\\\"meta-nav\\\">&#8594;</span></a></p>]]></description>
			<content:encoded><![CDATA[<p>Samba is a nice service to provide storage space through networks and it is relatively easy to set up. It&#8217;s not as fast as using NFS between Linux hosts but sometimes you don&#8217;t have that possibility. Sometimes there also might be quite confusing problems like I happened to notice.</p>
<p>My Samba service had worked fine for a long time but after a kernel update and a reboot, the performance was horrible. It was really slow to do anything. Fortunately I wasn&#8217;t the only one to come by with this problem and there was a topic <em><a href="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/speed.html#id445762">Samba Performance Problem Due to Changing Linux Kernel</a></em> in Samba Performance Tuning -guide which provided a solution to my problem. Just restarted the network interface and the performance was as good as before.</p>
<p>Earlier this month <a href="http://news.samba.org/announcements/pfif/">Samba Team Received Microsoft Protocol Docs</a> so maybe in the near future we will get better and faster software.</p>
<blockquote><p>
The Protocol Freedom Information Foundation (PFIF), signed an agreement with Microsoft to receive the protocol documentation needed to fully interoperate with the Microsoft Windows workgroup server products and to make them available to Free Software projects such as Samba.</p>
<p>Microsoft was required to make this information available to competitors as part of the European Commission March 24th 2004 Decision in the antitrust lawsuit, after losing their appeal against that decision on September 17th 2007.<br />
- <a href="http://news.samba.org/announcements/pfif/">Samba Team</a>
</p></blockquote>
<h2  class="related_post_title">Related journal entries</h2><ul class="related_post"><li><a href="http://ruleoftech.com/journal/eclipse-class-file-name-must-end-with-class-exception-in-search" title="Eclipse: Class file name must end with .class exception in search">Eclipse: Class file name must end with .class exception in search</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://ruleoftech.com/journal/samba-performance-problem-after-kernel-update/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

