Secure Alfresco with https

August 9th, 2008

It is simple to setup TomCat to use HTTPS – see the file tomcat/conf/server.xml –

Change redirectPort=”8443″ to “443”

<!– Define a non-SSL HTTP/1.1 Connector on port 8080 –>
<Connector port=”80″ URIEncoding=”UTF-8″ maxHttpHeaderSize=”8192″
maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”false” redirectPort=”443″ acceptCount=”100″
connectionTimeout=”20000″ disableUploadTimeout=”true” />

unremark the SSL HTTP/1.1 Connector and change port to 443

<!– Define a SSL HTTP/1.1 Connector on port 8443 –>
<Connector port=”443″ maxHttpHeaderSize=”8192″
maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”false” disableUploadTimeout=”true”
acceptCount=”100″ scheme=”https” secure=”true”
clientAuth=”false” sslProtocol=”TLS” />

Generate Keystore
* Execute:

%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)

with a password value of “changeit” for both the certificate and
the keystore itself.

Fix Apache – No space left on device: Couldn’t create accept lock or Cannot create SSLMutex

July 28th, 2008

When dealing with mem-leaks in my mod_perl-apps I ran into a curious apache-problem. After a while apache could not be started but failed with strange errors like:
[emerg] (28)No space left on device: Couldn’t create accept lock
or
[crit] (28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed
or
[Wed Dec 07 00:00:09 2005] [error] (28)No space left on device: Cannot create SSLMutex
There was definitely enough space on the device where the locks are stored (default /usr/local/apache2/logs/). I tried to explicetely different Lockfiles using the LockFile-directive but this did not help. I also tried a non-default AcceptMutex (flock) which then solved the acceptlock-issue and ended in the rewrite_log_lock-issue.
Only reboot of the system helped out of my crisis.
Solution: There were myriads of semaphore-arrays left, owned by my apache-user.
ipcs -s | grep apache
Removing this semaphores immediately solved the problem.
ipcs -s | grep apache | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'

Indexing Word / Powerpoint / Excel / PDF

May 6th, 2008

I am working on a project to allow full-text indexing of common file types such as word, powerpoint, excel and pdf. After searching for a few days, I have a hard time finding a perfect solution.

PDF

http://www.foolabs.com/xpdf/

Word

http://ftp.wagner.pp.ru/~vitus/software/catdoc/

Excel

http://ftp.wagner.pp.ru/~vitus/software/catdoc/

PowerPoint

Google Custom Search for Joomla

April 6th, 2008

To enable your joomla site with Google Custom Search is easy – but it requires some details that described in this document.

1. Create a Google Custom Search account

* http://www.google.com/coop/cse/

2. Create a static content page to display the search result.

Copy the search result code from Google Custom Search Engine Page.

<!– Google Search Result Snippet Begins –>
<div id=”cse-search-results”></div>
<script type=”text/javascript”>
var googleSearchIframeName = “cse-search-results”;
var googleSearchFormName = “cse-search-box”;
var googleSearchFrameWidth = 580;
var googleSearchFrameborder = 0;
var googleSearchDomain = “www.google.com“;
var googleSearchPath = “/cse”;
</script>
<script type=”text/javascript” src=”http://www.google.com/afsonline/show_afs_search.js”></script>
<!– Google Search Result Snippet Ends –>

3. Create the Google Custom Search box on your site. There are many ways to put the search box code to your site. I have choosen the jumi module to create my search box.

Pay attention to the action url, and the hidden fields

<!– Google CSE Search Box Begins –>
<form action=”http://www.rosterchan.com/cms/index.php” id=”cse-search-box”>
<input type=”hidden” name=”cx” value=”017670683912109064910:9y-xh1dpj3k” />
<input type=”hidden” name=”option” value=”com_content”>
<input type=”hidden” name=”task” value=”view”>
<input type=”hidden” name=”id” value=”3″>
<input type=”hidden” name=”Itemid” value=””>
<input type=”hidden” name=”cof” value=”FORID:11″ />
<input type=”text” name=”q” size=”25″ />
<input type=”submit” name=”sa” value=”Search” />
</form>
<script type=”text/javascript” src=”http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en”></script>
<!– Google CSE Search Box Ends –>

Replacing a string inline using Perl CLI

February 24th, 2008

This is a technique to replace a string in a file or a number of files using Perl.

perl -pi -e ‘s/old_string/new_string/g’ file_pattern

Can’t locate Net/SNMP.pm in @INC ….

February 16th, 2008

If you are getting this error, you will need to install NET::SNMP Perl CPAN module.

The easiest way to install the NET::SNMP module is to by the CPAN CLI interface.

# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell — CPAN exploration and modules installation (v1.7602)
ReadLine support available (try ‘install Bundle::CPAN’)

cpan> install Net::SNMP

RDP is very slow in Vista

February 8th, 2008

If you experienced this problem, it is related to Vista’s AutoTuning Feature.

To disable the Auto Tuning Feature, type the following command under Administrator

netsh interface tcp set global autotuninglevel=disabled

To re-enable Auto Tuning, type the following command

netsh interface tcp set global autotuninglevel=normal

Page Break for HTML

January 17th, 2008

This is a little trick to allow pagebreak in HTML code.

HR {
page-break-after: always;
}

Floating Ad Banner at Bottom of Screen

January 16th, 2008

This is the code for Floating Bottom Banner

floating-banner.htm

sudo: sorry, you must have a tty to run sudo

December 30th, 2007

if you are trying to run a command via sudo and encounter the following error:

sudo: sorry, you must have a tty to run sudo

then you can comment out the following parameter in the /etc/sudoers

#Defaults requiretty