<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<rss version="2.0">
<channel>
<title>Serensoft FAQ - Most recent:</title>
<description>Here Serensoft answers your frequently-asked questions</description>
<link>http://faq.serensoft.com</link>	<item>
		<title><![CDATA[Configuring Sakai/Tomcat for secure SSL over HTTPS]]></title>
		<description><![CDATA[
<div class="faq">
<blockquote style="border: 1px dotted silver; padding: 1em;">
<p>Previously this article had talked about getting Tomcat itself secured via a Keystore, and having Tomcat deal directly with the SSL traffic. Well, we've got a whole new paradigm now. :)</p>
</blockquote>

<p>So you've got Sakai up and running, and now you'd like to enable secure-sockets layer (SSL) so you can run it encrypted over HTTPS instead of plain-text HTTP...</p>

<p>No problem. First make sure you have Sakai <a href="index.php?action=artikel&cat=22&id=26&artlang=en">installed and configured</a>, and test it to make sure it works as expected via port 8080 in clear-text (http). Once that's confirmed to be working well, then you take the steps you'll need to secure it for https.</p><h3>Using APACHE to handle HTTPS traffic, with Tomcat backstage</h3>

<p>We've found that the most flexible way to do this is to <b>use Apache to handle the secure https:// traffic</b>, and have Mod_JK communicate with Tomcat (Using the "AJP13" protocol) behind the scenes. That is, Apache will handle all of the actual encrypted user interaction on port 443 -- Tomcat will only talk to Apache via AJP, and your users can't even get directly to Tomcat, only through Apache.</p>

<p>Here's what you will need, certificate-wise:</p>

<ul><li>A private key (certificate)</li>
<li>A certificate-signing request (CSR)</li>
<li>A certificate authority (CA) to sign the public key</li>
<li>A public key signed by the CA</li></ul>

<p>Note that you can be your own CA -- but your users' browsers will alert them to the fact that the certificate-authority that signed the certificate isn't a recognized one, and they should "proceed at their own risk, with extreme caution", and "don't complain if something odd happens because we're not responsible for you trespassing in these dangerous, murky waters"... warnings like that. If you pay a recognized CA to sign your certificate instead, they won't see any warnings at all and your users will have a nice, seamless experience as they browse securely.</p><p>You will also need the following components -- and if you use Debian or a Debian derivative such as Ubuntu, we've included the commands used to install them:</p>

<ul><li>Apache (<b>apt-get install apache2</b>)</li>
<li>Apache's Mod_SSL (<b>dpkg -S mod_ssl</b> indicates that 'apache2.2-common' supplies it, meaning that it comes with apache2)</li>
<li>Apache's Mod_JK (<b>apt-get install libapache2-mod-jk</b>, this is where the AJP protocol setup comes from)</li>
<li>OpenSSL (<b>apt-get install openssl</b>)</li></ul>

<h3>Creating your private and public keys/certificates:</h3>

<p>Ready? First set up your fully-qualified-domain-name and server-name:</p>

<pre style="color: rgb(0, 102, 102);">HOSTNAME=`hostname`<br />SERVER=`hostname | cut -f1 -d.`<br />mkdir sakai-cert<br />cd sakai-cert/</pre>

<p>So here $HOSTNAME should be something like "sakaisys.university.edu" and $SERVER is "sakaisys". Set yours according to your context! (Note that we will be using $HOSTNAME and $SERVER below instead of fixed strings, even when it's not possible to use the variable in a particular context.)</p>

<p>Next, generate your private key:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl genrsa -des3 -out $SERVER.private.key 1024</b><br />Generating RSA private key, 1024 bit long modulus<br />.........................................++++++<br />....................................++++++<br />e is 65537 (0x10001)<br />Enter pass phrase for $SERVER.private.key: <b style="background-color: rgb(255, 255, 153);">pazwrd-goeth-here</b><br />Verifying - Enter pass phrase for $SERVER.private.key: <b style="background-color: rgb(255, 255, 153);">pazwrd-goeth-here</b></pre>

<p>If you want to remove the password on your private key, try this:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl rsa -in $SERVER.private.key -out $SERVER.private.nopassword.key</b></pre>

<p>Now we do the hard part, creating a certificate-signing request (CSR). Here you give your geographical and structural information, and note in particular that <i>you must have your server's FQDN as the COMMON NAME!</i></p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl req -new -key $SERVER.private.key -out $SERVER.csr</b><br />Enter pass phrase for sakaibb.private.key: <b style="background-color: rgb(255, 255, 153);">pazwrd-goeth-here</b><br />You are about to be asked to enter information that will be <br />incorporated into your certificate request.<br />What you are about to enter is what is called a Distinguished <br />Name or a DN.<br />There are quite a few fields but you can leave some blank<br />For some fields there will be a default value,<br />If you enter '.', the field will be left blank.<br />-----<br />Country Name (2 letter code) [AU]: <b style="background-color: rgb(255, 255, 153);">US</b><br />State or Province Name (full name) [Some-State]: <b style="background-color: rgb(255, 255, 153);">New Hampshire</b><br />Locality Name (eg, city) []: <b style="background-color: rgb(255, 255, 153);">Portsmouth</b><br />Organization Name (eg, company) [Internet Widgits Pty Ltd]: <b style="background-color: rgb(255, 255, 153);">Serensoft University</b><br />Organizational Unit Name (eg, section) []: <b style="background-color: rgb(255, 255, 153);">Information Technology</b><br />Common Name (eg, YOUR name) []: <b style="background-color: rgb(255, 153, 153);">sakaisys.university.edu</b><br />Email Address []: <b style="background-color: rgb(255, 255, 153);">helpdesk@university.edu</b><br /><br />Please enter the following 'extra' attributes<br />to be sent with your certificate request<br />A challenge password []:<br />An optional company name []:</pre>

<p>Again, just to be certain you're aware -- the COMMON NAME must be the fully-qualified domain name (FQDN) of your server. That's the value that was originally put into $HOSTNAME when we got started.</p>At this point you have a private key (<b>$SERVER.private.nopassword.key</b>) and a certificate-signing request (<b>$SERVER.csr</b>) to get signed. You can try <a href="http://www.google.com/search?q=self-signed+ssl+certificate+key+openssl" target="_blank" title="Google Self-Signed Certificate">signing it yourself</a>, or ship it off to a known/trusted certificate authority (CA) to get it signed officially. There's nothing wrong with creating your own CA and self-signing your certificates, but your users will get a warning saying that the certificate was signed by an unrecognized CA.<p>Once you get a signed public certificate (<b>$SERVER.public.key</b>) you might want to have a look and see what's in it. Here's how:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">openssl x509 -in $SERVER.public.key -text -noout</b></pre>

<p>Post your public and private keys where Apache can use them:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">cp $SERVER.public.key /etc/apache2/ssl/certs/</b><br /># <b style="background-color: rgb(255, 255, 153);">cp $SERVER.private.nopassword.key /etc/apache2/ssl/private/</b></pre>

<h3>Configure Apache, Mod_SSL and Mod_JK</h3>

<p>Apache will be handling all our web traffic, mod_ssl will encrypt it all for us, and mod_jk will pass off appropriate requests to Tomcat for handling by Sakai code.</p>

<p><b>1. Create a directory /var/www/$SERVER and put an empty "index.html" there.</b></p>

<p>You might also have a minimal "splash" page there instead, with a link to the https:// version of your Sakai instance.</p>

<p><b>2. Edit /etc/apache2/sites-available/$SERVER thus:</b></p><p>Note that this example shows a bare-bones setup. You can enhance your configuration to do what you please, but it's a good idea to start with a simple setup first, test it, and once you are confident that all is well, you can start adding tweaks later.</p><pre style="color: rgb(0, 102, 102);">&lt;VirtualHost *:80&gt;<br />        ServerName  <b>$HOSTNAME</b><br />        ServerAlias 192.168.123.234<br />        ServerAlias <b>$SERVER</b><br />        ServerAlias 127.0.0.1<br /><br />        #ServerAdmin webmaster@localhost<br /><br />        RedirectMatch ^/$         https://<b>$HOSTNAME</b>/portal<br />        RedirectMatch ^/(.+)      https://<b>$HOSTNAME</b>/$1<br />&lt;/VirtualHost&gt;</pre>

<p>So, for all HTTP requests, we redirect all traffic to the HTTPS secure port. (Instead of $HOSTNAME above you'll have your actual FQDN, and instead of $SERVER you'll have the node-name of your server, of course.) </p>

<p>Now for the SSL and JK (aka AJP) portions of our program:</p><pre style="color: rgb(0, 102, 102);">&lt;IfModule mod_ssl.c&gt;<br />JkWorkersFile <b>/etc/apache2/workers.properties</b><br />&lt;VirtualHost *:443&gt;<br />        ServerName  <b>$HOSTNAME</b>:443<br />        # ServerAlias -- not for HTTPS! wouldn't match the certificate<br /><br />        # Just in case:<br />        DocumentRoot /var/www/<b>$SERVER</b><br /><br />        # Servlet for context to worker named sakai, see workers.properties<br />        JkMount /* sakai<br />        JkUnmount /library/skin/* sakai<br />        JkUnmount /library/content/* sakai<br /><br />        Alias /library/skin    <b>/path/to/tomcat</b>/webapps/library/skin<br />        Alias /library/content <b>/path/to/tomcat</b>/webapps/library/content<br /><br />        #   SSL Engine Switch:<br />        #   Enable/Disable SSL for this virtual host.<br />        SSLEngine on<br />        SSLCertificateFile    /etc/ssl/certs/<b>$SERVER</b>.public.key<br />        SSLCertificateKeyFile /etc/ssl/private/<b>$SERVER</b>.private.nopassword.key<br /><br />&lt;/VirtualHost&gt;<br />&lt;/IfModule&gt;</pre>

<p>Both of the above &lt;VirtualHost&gt; snippets should be in the same /etc/apache2/sites-available/$SERVER config file.</p><p>Here if we don't have SSL (IfModule mod_ssl.c) we don't need to worry about mod_jk, and if we do have mod_ssl but we don't have mod_jk we'd rather have Apache break anyway, so we can fix it. You'll need to replace the BOLD items above with the items that make sense for your server, of course ("$SERVER" isn't valid inside Apache config files, for example -- you'll need to replace that with the real value for your server).</p>

<p>Note that we will have Tomcat handle most requests (<b>JkMount /* sakai</b>) but not the static items in /library/skin or /library/content (<b>JkUnmount ...</b>).</p><p><b>3. Edit /etc/apache2/workers.properties. </b></p><p>The above Apache configuration refers to /etc/apache2/workers.properties. That's what configures the core of the Tomcat AJP connector -- here is the <b>workers.properties</b> file in its entirety:</p>

<pre style="color: rgb(0, 102, 102);"># mod_jk config to connect apache to tomcat<br />workers.tomcat_home=/home/sakai/tomcat<br />workers.java_home=/usr/local/java<br />ps=/<br />worker.list=sakai<br /><br />worker.sakai.port=8009<br />worker.sakai.host=localhost<br />worker.sakai.type=ajp13<br />worker.sakai.lbfactor=1</pre><p>The first # line is just a comment in the file, not a command-line entry! What this does is tell Apache to connect to Tomcat using port 8009 on localhost.</p><p><b>4. Enable your virtual website</b></p><pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">a2ensite $SERVER</b></pre><p><b>5. Restart Apache:</b></p><pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">/etc/init.d/apache2 restart</b></pre>

<blockquote style="border: 1px dotted silver; padding: 1em;">
<p>Note that Apache can be restarted just about any old time -- it's just a conduit for traffic bound for Tomcat. Tomcat is where all the session information is stored. Restarting Apache might get a few of your users a quick "server not found" message, but a quick refresh will resume their session as if nothing happened.</p>

<p>Restarting Tomcat, on the other hand, <b>is</b> a big deal. Your users will be booted off and their sessions closed completely. Careful!</p>
</blockquote>

<h3>Configure Tomcat</h3>

<p>Finally, you must edit <tt>$CATALINA_HOME/conf/server.xml</tt> to make sure that the AJP connection is enabled on port 8009, and to turn off clear-text traffic on port 8080. The AJP connector should NOT be commented out:</p>

<pre style="color: rgb(0, 102, 102);">&lt;!-- Define an AJP 1.3 Connector on port 8009 --&gt; <br /><span style="background-color: rgb(255, 255, 153);">&lt;Connector port="8009" <br />       address="127.0.0.1"<br />       enableLookups="false" redirectPort="8443" protocol="AJP/1.3" /&gt;</span></pre>

<p>As shown above, you might also want to make sure you're asking Tomcat to look for connection on localhost (127.0.0.1) only, meaning it'll ignore your public-facing traffic, for even tighter security.</p>

<p>And the HTTP connector on port 8080 <u>should</u> be commented out:</p>

<pre style="color: rgb(0, 102, 102);">&lt;!-- Define a non-SSL HTTP/1.1 Connector on port 8080 --&gt;<br /><span style="background-color: rgb(255, 255, 153);">&lt;!--</span> &lt;Connector port="8080" maxHttpHeaderSize="8192"<br />...<br />/&gt; <span style="background-color: rgb(255, 255, 153);">--&gt;</span></pre>

<p>If you leave the port-8080 traffic open, folks might still keep on using it, and any network packet sniffer would be able to cull passwords and everything else! Better to lock it down.</p>

<p>Finally, restart Tomcat (after checking either A: to see that your users are off, or B: you're willing to suffer the consequences from those who aren't):</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">$CATALINA_HOME/bin/shutdown.sh</b><br /># <b style="background-color: rgb(255, 255, 153);">tail -f $CATALINA_HOME/logs/catalina.out</b></pre>

<p>Once your Tomcat logs show "INFO main org.apache.coyote.http11.Http11BaseProtocol - Stopping Coyote HTTP/1.1 on http-8080" you can ^C to get out of "tail -f" and then start Sakai back up again:</p>

<pre style="color: rgb(0, 102, 102);"># <b style="background-color: rgb(255, 255, 153);">$CATALINA_HOME/bin/startup.sh</b><br /># <b style="background-color: rgb(255, 255, 153);">tail -f $CATALINA_HOME/logs/catalina.out</b></pre>

<p>
Watch for "INFO main org.apache.catalina.startup.Catalina - Server startup in #### ms" and then you're ready!

</p><p>You could easily configure Apache to listen on port 8080 and forward all requests to http://$HOSTNAME/portal as well.</p><p>Easy!</p></div>]]></description>
		<link>http://faq.serensoft.com/index.php?action=artikel&amp;cat=19&amp;id=62&amp;artlang=en</link>
		<pubDate>Thu, 01 Oct 2009 20:26:08 GMT</pubDate>
	</item>
	<item>
		<title><![CDATA[Administrative Users in Sakai]]></title>
		<description><![CDATA[<h3 class="faq">How do you make an ordinary user into a sakai superuser? </h3><p class="faq">Add them to the <strong><font color="#006666">/site/!admin</font></strong> realm, of course:</p><p class="faq">To make any user an !admin user:<br />- open <strong><font color="#006666">Administrator</font></strong> worksite<br />- visit the <strong><font color="#006666">Realms</font></strong> page<br />- search for '<strong><font color="#006666">admin</font></strong>'<br />- open "<strong><font color="#006666">/site/!admin</font></strong>" realm<br />- click "<strong><font color="#006666">Grant Ability</font></strong>"<br />- enter their network-username and choose the only role: "<strong><font color="#006666">admin</font></strong>"<br />- don't forget to click "<strong><font color="#006666">SAVE</font></strong>" or nothing really changes</p><h3 class="faq">How do you revoke superuser privileges from a user?</h3><p class="faq">To make an Administrator user back into an ordinary mortal:</p><p class="faq">- open <strong><font color="#006666">Administrator</font></strong> worksite<br />- visit the <strong><font color="#006666">Realms</font></strong> page<br />- search for '<strong><font color="#006666">admin</font></strong>'<br />- open "<strong><font color="#006666">/site/!admin</font></strong>" realm<br />- click user-name in question<br />- click "<strong><font color="#006666">Remove All</font></strong>"<br />- click "<strong><font color="#006666">SAVE</font></strong>" &lt;= if you skip this part nothing really happens :)</p><h3 class="faq">Why not just use Sakai's original "admin" user?</h3><p class="faq">When you look at the catalina.out logs, you can see which username logs in, from where, and all that. If everyone in your IT department uses the "admin" username, how do you know who to go ask questions to?</p><p class="faq">Instead, if you have separate logins, each with <strong><font color="#006666">/site/!admin</font></strong> privileges, you'll see who is really logging in. Lots more sanity this way.</p><p class="faq">So after you add <strong><font color="#006666">/site/!admin</font></strong> privileges to some other users, change the "admin" password to something obscure and unusable, and you'll have lots less trouble tracking who's been doing what.</p>]]></description>
		<link>http://faq.serensoft.com/index.php?action=artikel&amp;cat=19&amp;id=69&amp;artlang=en</link>
		<pubDate>Fri, 14 Aug 2009 14:22:59 GMT</pubDate>
	</item>
	<item>
		<title><![CDATA[Sakai install -- errors]]></title>
		<description><![CDATA[<div class="faq">
<h2>Errors during "<font face="courier new, courier, monospace" color="#006666">mvn install</font>" when building Sakai</h2>

<h3 >
<p>What's supposed to happen, is, maven's test is supposed to try to connect to port 8080 and -- since you're building Tomcat webapps, nothing is actually supposed to be running there at the moment -- when it can't connect, it skips on to the next test.</p>
<p>But apparently there is a process waiting for connections on port 8080. It's probably a half-lit Tomcat, limping along, doing just barely enough to wreak havoc with your maven builds.</p>
<p>Do a "<font face="courier new, courier, monospace" color="#006666">ps axf</font>" or "<font face="courier new, courier, monospace" color="#006666">lsof -i</font>" to see if there's a Java process listening on port 80. If so, that's likely to be the culprit. Make sure you don't need it then "<font face="courier new, courier, monospace" color="#006666">kill</font>" it -- and try "<font face="courier new, courier, monospace" color="#006666">mvn install</font>" again.</p><hr width="100%" size="2" />These are for Sakai 2.6.x and later.<br /><p></p></div>]]></description>
		<link>http://faq.serensoft.com/index.php?action=artikel&amp;cat=20&amp;id=68&amp;artlang=en</link>
		<pubDate>Wed, 15 Jul 2009 04:27:27 GMT</pubDate>
	</item>
</channel>
</rss>