Have you ever wanted to recursively view a path? Forget ls or find. Try the tree command instead.
If you have the LS_COLORS environmental variable set and use the -C switch then the tree command will print the output to the terminal with colors. But wait, it get's better. Using the -d option will print only directories. You can also filter the output with regular expressions, print file permissions and size.
Thursday, January 15, 2009
Tuesday, January 13, 2009
Deploying the Shibboleth Web App
First thing to note is that the web application does not follow maven standards. So, you'll have to move the java source files into src/main/java. Then next thing you'll have to do is modify sys.properties. You'll need to modify everything in that file. Then you'll be able to deploy it.
James Gathings
James Gathings
One Line Unix Scripts
There are many positive aspects of one line unix scripts. One line unix scripts are quite similar to good, witty conversation. They tease your brain a bit because one liner's are similar to a puzzle. You also get great satisfaction when you solve the puzzle. Unix offers a plethora of one-line tools to play. You have AWK, SED, Bash, etc. at your fingertips. What follows are a few of my favorite scripts.
Jar Finder:
Have you ever had to look for a class in your classpath? Here's a script, my favorite script of all, that accomplishes that task.
#!/bin/sh
for JAR_FILE in `find $1 -name \*.jar`
do
echo $JAR_FILE
jar tvf $JAR_FILE | grep $2
done
To execute this script execute:
jgrep /home/jgathings/ String
What this does is search for the class "String" in all jars in /home/jgathings/ path.
This is not a one-liner, but it is a useful script. Here's the one-liner
find . -name \*.jar | awk '{print "echo "$1"; jar tvf "$1"| grep ApacheConf.class"}' | sh
A bit confusing? Well, let's break it down. First, note that the one-liner is composed of several tokens delimeted by the unix pipe. The first token uses 'find' to find all jars. The second token uses awk to construct a dynamic command. This token is semicolon delimeted. First AWK prints the name of the jar including it's path. The second AWK token uses jar to list the items in the jar. The output of this token is piped to grep which checks to see if the specified class is in the jar. This example searches for ApacheConf.class. Next the AWK command is closed with the }. Finally the entire command is piped to the shell with 'sh' and the output is printed to the screen. The output could be appended to a file with the > operator. Here's an output snippet:
./server/lib/tomcat-util.jar
./server/lib/catalina-storeconfig.jar
./server/lib/servlets-invoker.jar
./server/lib/tomcat-ajp.jar
12497 Mon Jan 28 13:36:16 GMT-05:00 2008 org/apache/jk/config/ApacheConfig.class
./server/lib/catalina-ant-jmx.jar
./server/lib/tomcat-coyote.jar
./server/lib/catalina-cluster.jar
./server/lib/tomcat-apr.jar
./bin/bootstrap.jar
James Gathings
Monday, January 12, 2009
Creating a Shibboleth Environment
1) Download and install shibboleth 1.3. Shibboleth can be downloaded here: http://shibboleth.internet2.edu/v1.3.html. The best instructions I found are here: https://spaces.internet2.edu/display/SHIB/JKIdPInstall. There is a README that will guide you through the install process. Be sure that tomcat and shibboleth have the same write privileges. There doesn't appear to be a way to test the installation. Going to /shibboleth-ip returned a 404 to me. However, I was able to go to any jsp in the webapp (/shibboleth-ip/sample.jsp).
Please note that if you are running this on a linux system then it is easiest to install all components (shibboleth-idp,tomcat, etc) as the same user. I found some permissions problems when having apache run as root and tomcat as a different user.
2) Download the tomcat apache connector (mod_jk). CD to native. Type ./configure --with-apxs=/usr/local/apache/bin/apxs --with-java-home=/usr/java/jdk1.5.0_14/ --enable-EAPI. Then type make. mod_jk.so should be in tomcat-connectors-1.2.27-src/apache-1.3/.
Create an ajp13 workers.properties file:
# Define 1 real worker using ajp13
worker.list=ajp13
# Set properties for the ajp13 worker
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
Add the following to httpd.conf:
LoadModule jk_module libexec/mod_jk.so
JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties
JkLogFile /usr/local/tomcat/logs/mod_jk.log
JkLogLevel debug
JkMount /shibboleth-idp/* ajp13
JkMount /jsp-examples/* ajp13
3) At this point apache and tomcat should be able to communicate to each other.
4) Go to shibboleth web application. For example, http://sorcerer.internal.emeta.com/shibboleth-idp/SSO.
5) You'll receive a Shibboleth error page (Shibboleth Identity Error Page to be specific). This is an expected sign. It means that shibboleth is now ready to be configured for the federation.
6) The next step is to use openssl to generate a key and a certificate:
8) In the IDP server directory copy etc/example-metadata.xml to etc/partner-metadata.xml.
Please note that if you are running this on a linux system then it is easiest to install all components (shibboleth-idp,tomcat, etc) as the same user. I found some permissions problems when having apache run as root and tomcat as a different user.
2) Download the tomcat apache connector (mod_jk). CD to native. Type ./configure --with-apxs=/usr/local/apache/bin/apxs --with-java-home=/usr/java/jdk1.5.0_14/ --enable-EAPI. Then type make. mod_jk.so should be in tomcat-connectors-1.2.27-src/apache-1.3/.
Create an ajp13 workers.properties file:
# Define 1 real worker using ajp13
worker.list=ajp13
# Set properties for the ajp13 worker
worker.ajp13.type=ajp13
worker.ajp13.host=localhost
worker.ajp13.port=8009
Add the following to httpd.conf:
LoadModule jk_module libexec/mod_jk.so
JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties
JkLogFile /usr/local/tomcat/logs/mod_jk.log
JkLogLevel debug
JkMount /shibboleth-idp/* ajp13
JkMount /jsp-examples/* ajp13
3) At this point apache and tomcat should be able to communicate to each other.
4) Go to shibboleth web application. For example, http://sorcerer.internal.emeta.com/shibboleth-idp/SSO.
5) You'll receive a Shibboleth error page (Shibboleth Identity Error Page to be specific). This is an expected sign. It means that shibboleth is now ready to be configured for the federation.
6) The next step is to use openssl to generate a key and a certificate:
- openssl genrsa -out idp.key 2048
- openssl req -new -key idp.key -x509 -days 365 -out idp.crt
8) In the IDP server directory copy etc/example-metadata.xml to etc/partner-metadata.xml.
Subscribe to:
Posts (Atom)