Archive for the ‘ Howto ’ Category

How to install webpasswordsafe 1.3 WAR on Centos 6

Here’s a quick howto on installing web password safe on CentOS 6 with tomcat.

Prerequiste:

You’ll need to have JAVA setup correctly with JCE installed and I assume that Tomcat is already installed. You can consult both documentation I wrote :

Howto install JDK 7 with JCE

Howto install Tomcat 7 on centos 6

I will describe the steps I took, feel free to tell me if there’s something to fix, it’s possible your setup is slightly different..

  • Install your CentOS with at least those package/group @Base, mysql-server2 and mysql-connector-java.noarch
    • Don’t forget to run mysql_secure_installation and change the root password..

 

  • Not sure on this one, because my system is kickstarted and automatically added to the repo, but you’ll probably need the EPEL repository ( rpm -Uhv http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm )

 

 

Now we’ll copy the MySQL JDBC driver to our Tomcat Install if it’s not already done:

# ls -lah /opt/apache-tomcat-7.0.53/lib/*mysql*

If you see a file there, skip the copy, you already have the JDBC driver installed.

# cp /usr/share/java/mysql-connector-java.jar /opt/apache-tomcat-7.0.53/lib/

Now we will create the database needed by passwordsafe and the user it will use to connect, plus the permission.

# mysql -u root -p
 mysql> create database webpasswordsafe;
 mysql> create user wps@localhost identified by 'PUT_A_SAFE_PASSWORD_HERE';
 mysql> grant all privileges on webpasswordsafe.* to wps@localhost;
 mysql> grant usage on webpasswordsafe.* to wps@localhost;
 mysql> flush privileges;
 mysql> exit

Now we will deploy the WAR for the first time, and configure some settings:

Stop tomcat if it run:

# /etc/init.d/tomcat-webpasswordsafe stop

Copy the WAR in the webapp directory of your tomcat install and we will rename it:

# cp -ar webpasswordsafe-sample-1.3.war /opt/webpasswordsafe/catalina_base/webapps/
# mv webpasswordsafe-sample-1.3.war webpasswordsafe-1.3.war

Start Tomcat:

# /etc/init.d/tomcat-webpasswordsafe start

Now let’s configure few basics settings:

Set a new secret key at encryptor.jasypt.password

# cd /opt/webpasswordsafe/catalina_base/webapps/webpasswordsafe-1.3
# vim WEB-INF/encryption.properties

Edit the config to access the database:

# vim WEB-INF/jdbc.properties
 set db user key
 jdbc.username=wps
 jdbc.password=HERE_YOU_PASTE_THE_NOT_SO_SAFE_PASSWORD_YOU_PROBABLY_CHOOSE

 uncomment mysql config:
 # MySQL/MariaDB settings
 hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
 jdbc.driverClassName=com.mysql.jdbc.Driver
 jdbc.url=jdbc:mysql://localhost:3306/webpasswordsafe
 jdbc.validationQuery=select 1

Now restart Tomcat and we’ll see if everything work:

# /etc/init.d/tomcat-webpasswordsafe restart

Normally at this point you should be able to access the web interface via http://your-hostname-or-ip:8080/webpasswordsafe-1.3/

If you are using the default LocalAuthenticator the user/pass are: admin/admin

That’s it for the install, check the Admin Guide for more informations regarding all the different options available in the config files.. I will probably add another post to cinfigure the LDAP connector and other features.

 

Be sure to setup a SSL connection if you want to use this in production… You don’t want to access your password manager via http… You are gonna store all your password there, doublecheck EVERYTHING, root password, MySQL, SSL, ensure that you have the minimum service running on this host, iptables and SELinux enabled could be a great idea.

 

Note:

Howto install java JDK 7 on CentOS 6 with Java Cryptography Extension (JCE) enabled ready for Tomcat

This installation of java is for people who want to install java and use it with tomcat or any other app that don’t require the java bin to be in the $PATH…

 

Download the latest JDK 7 release: http://java.sun.com/javase/downloads/index.jsp

If you need to install the JCE, download it: Other Downloads -> Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files. If you don’t know what JCE is, the chance are you won’t need it..

Untar the archive and move it to /opt

# tar -xzvf jdk-7u51-linux-x64.gz
# mv jdk-7u51-linux-x64 /opt/

If you downloaded the JCE, unzip it. We’ll need to overwrite the default file. We’ll backup the file before..

# mv /opt/jdk1.7.0_51/jre/lib/security/local_policy.jar /opt/jdk1.7.0_51/jre/lib/security/local_policy.jar.orig
# mv /opt/jdk1.7.0_51/jre/lib/security/US_export_policy.jar /opt/jdk1.7.0_51/jre/lib/security/US_export_policy.jar.orig
# unzip UnlimitedJCEPolicyJDK7.zip
# cp UnlimitedJCEPolicy/*.jar /opt/jdk1.7.0_51/jre/lib/security/

 

And voila!

 

 

Howto Install Tomcat 7 clean on Centos 6

Prerequisite: you need to have a working copy of Java installed. See my post about installing Java on CentOS 6 Here.

You’ll see that Tomcat is installed in /opt and every single application will use it’s own catalina_home, this is in place to separate different install and simplify the update process, same thing for java, if a single war don’t support a new version of tomcat, you can upgrade by application, changing only the symbolic link..

 

The user will use uid 5007, it’s a standard uid of the tomcat user where I work.

useradd -u 5007 -s /sbin/nologin -c "Tomcat" _tomcat

Download the latest tarball and extract it to /opt

tar xzvf apache-tomcat-7.0.53.tar.gz -C /opt
ln -s /opt/apache-tomcat-7.0.53 /opt/tomcat-webpasswordsafe

We will now create the catalina_home base config

cd /opt
mkdir -p webpasswordsafe/catalina_base
cd webpasswordsafe/catalina_base
mkdir bin conf logs webapps work temp
chown _tomcat logs webapps work temp

Now we’ll create setenv.sh where the java_home will be set:

vim /opt/webpasswordsafe/catalina_base/bin/setenv.sh

Point the JAVA_HOME variable to your java home, if you have followed my howto on java it should look like this…

JAVA_HOME=/opt/java-webpasswordsafe

Copy the server.xml and web.xml to our catalina_base, the default should be ok:

cp /opt/apache-tomcat-7.0.53/conf/server.xml /opt/webpasswordsafe/catalina_base/conf/
cp /opt/apache-tomcat-7.0.53/conf/web.xml /opt/webpasswordsafe/catalina_base/conf/

We will now give the files the right ownership:

chmod -R 644 /opt/webpasswordsafe/catalina_base/conf/*
chown -R _tomcat._tomcat /opt/webpasswordsafe/catalina_base/

Create the init script used to start tomcat.

You’ll have to adjust the variable CATALINA_BASE, CATALINA_HOME and SVC_SCRIPT to reflect your installation if it’s not the same as mine.

vim /etc/init.d/tomcat-webpasswordsafe
#!/bin/bash
#
# Init file for buildserver tomcat
#
# chkconfig: 35 99 10
# description: BuildServer Tomcat
#

# source function library
. /etc/rc.d/init.d/functions

RETVAL=0
prog="tomcat pour le gestionnaire de password"

SVC_SCRIPT=/opt/tomcat-webpasswordsafe/bin/catalina.sh
SVC_START_ARGS="start"
SVC_STOP_ARGS="stop"
SVC_USER="_tomcat"

ECHO=/bin/echo
SUDO=/usr/bin/sudo
RUNUSER=/sbin/runuser

# Toute la config et les apps sont deployees dans ce repertoire
export CATALINA_BASE=/opt/webpasswordsafe/catalina_base
# Le repertoire ou tomcat est vraiment installe
export CATALINA_HOME=/opt/tomcat-webpasswordsafe


start()
{
 $ECHO -n $"Starting $prog: "
 # On utilise runuser au lieu de daemon() car daemon clear l'environnement... need CATALINA_*
 $RUNUSER -s /bin/bash -m -c "$SVC_SCRIPT $SVC_START_ARGS" "$SVC_USER" && success || failure
 RETVAL=$?
}

stop()
{
 $ECHO -n $"Stopping $prog: "
 $SVC_SCRIPT $SVC_STOP_ARGS && success || failure
 RETVAL=$?
}


case "$1" in
 start)
 start
 ;;
 stop)
 stop
 ;;
 restart)
 stop
 start
 ;;
 *)
 echo $"Usage: $0 {start|stop|restart}"
 RETVAL=1
esac
exit $RETVAL

Give the right permissions to the files:

chmod +x /etc/init.d/tomcat-webpasswordsafe

Enable the service to start at boot:

chkconfig tomcat-webpasswordsafe on

Let’s try this!

Start tomcat with the init script we’ve just created:

/etc/init.d/tomcat-passwordsafe start

You can take a look at the log to see if everything is ok.

tail -f /opt/webpasswordsafe/catalina_base/logs/catalina.out

If you see something similar to INFO: Server startup in 33397 ms, your installation is fine you can go ahead and put your war file in the webapp directory in catalina_home.

 

Let me know what you think and if you have problem I’ll be glad to help you, but this is pretty straight forward!

Fedora 15 problem with Empathy and you are unable to connect to msn ?

LAST UPDATE #2: An update as been pushed in the Fedora Testing repo and correct this problem. If you want to install this update you just have to use the enablerepo feature just like that:

#yum install papyon --enablerepo=updates-testing

The repository is enabled only for this update!


UPDATE #1: This has worked for me yesterday, but it’s not working anymore.. I haven’t been able to fix the issue… Please report your test and problems in the bug report at: https://bugzilla.redhat.com/show_bug.cgi?id=750884



Papyon : Can't login in Windows live : accountab.py:202:_HandleABFindAllResponse:AttributeError: 'NoneType' object has no attribute 'find'

If you get this erorr reported by ABRT on Fedora 15 and you are unable to connect to msn with empathy, here’s a workaround.

Here’s the bug report if you want to share your problem regarding this issue:

https://bugzilla.redhat.com/show_bug.cgi?id=750884

The workaround consist of a upstram patch that has been released. It will probably work it’s way to fedora soon but for now you need to do some work by hand.

Here you can get the code to update: http://cgit.collabora.com/git/user/maiku/papyon.git/commit/?h=bug-42689&id=011201e47004538e732f247bfeb21634c6e1d97f

As you can see you have to edit three files. The path I will give you is the exact path under Fedora 15 but can change with other distrib. The line with “-” need to be commented with a “#” at the beginning of the line, and the line with a + need to be added..

1 – /usr/lib/python2.7/site-packages/papyon/service/description/SingleSignOn/RequestMultipleSecurityTokens.py

- CONTACTS = ("contacts.msn.com", "MBI")
+ CONTACTS = ("local-bay.contacts.msn.com", "MBI")
2 – /usr/lib/python2.7/site-packages/papyon/service/description/AB/__init__.py
-url = "http://contacts.msn.com/abservice/abservice.asmx"
+url = "http://local-bay.contacts.msn.com/abservice/abservice.asmx"
3 – /usr/lib/python2.7/site-packages/papyon/service/description/Sharing/__init__.py
-url = "http://contacts.msn.com/abservice/SharingService.asmx"
+url = "http://local-bay.contacts.msn.com/abservice/SharingService.asmx"

That’s it!

MythTV and MythWEB on Fedora 14

I finally get everything working correctly… I don’t have a lot of time for this post, but I want to share how I corrected few problems I had.

1 – Sound problem. This one is cause by MythTV having problem dealing with PulseAudio. The solution was simple, and it was to set the MythTV FrontEnd audio device to ALSA:pulse … There’s no auto discovery for this.

The second problem was with MythWeb. I was unable to load the web interface.

Here’s the errors I got:

Apache logs:
PHP Fatal error:  Failed to open translation file:  modules_path/_shared/lang/English.lang in /usr/share/mythweb/classes/Translate.php on line 172
MythTV Backend:
MainServer, Warning: Unknown socket closing MythSocket

So I don’t think this is the best fix ever. But if you’re like me and totally pissed off do this:

# vim /usr/share/mythweb/classes/Translate.php

Modify this section (original) :

    // Load the primary language file, or English if the other doesn't exist.
        if (file_exists(modules_path.'/_shared/lang/'.$language.'.lang'))
            $path = modules_path.'/_shared/lang/'.$language.'.lang';
        else
            $path = modules_path.'/_shared/lang/English.lang';

After modification it should look like this:

       //if (file_exists(modules_path.'/_shared/lang/'.$language.'.lang'))
        if (file_exists('/usr/share/mythweb/modules/_shared/lang/English.lang'))
            $path = '/usr/share/mythweb/modules/_shared/lang/English.lang';
        else
            $path = '/usr/share/mythweb/modules/_shared/lang/English.lang';

And voila… everything is working now. Feel free to ask question I know there’s not a lot of detail in this post but I’ve run into a lot of problem with this setup, so I can probably help!

++

Howto fix IRobot Roomba left or right wheel

My Roomba 530 started to spin around his right wheel few week ago. It happened few times and then more often and after that it was doing only this… So I tried all the iRobot suggested “repair” method, but there’s not a lot to do on iRobot  website regarding problem with your right or left wheel. So I was faced with the reality, I will have to buy a new right wheel module. It’s not that expensive you can find it on ebay for around 20$ shipped but I’m the kind of guy who don’t like to buy replacement part when I can fix it!

After few test and diagnostic, I confirmed that the problem was the right wheel. It was unable to spin, but if I just pushed a little bit the roomba, it start working. So I put the roomba on it’s back and tried to move both wheels and found out that the resistance on both wheel wasn’t the same and after a closer look I was pretty sure there was hairs stuck in the wheel module. Then I opened the roomba and I took few pics of my adventure in case that my idea will work, it can always help someone else! If your problem look like mine, you can follow those steps, maybe you will be able to fix it! If anyone found a way to open the wheel contained in the wheel module let us know I was unable to find anything on the net regarding this..

This is a “Try at your own risk” repair. This had fixed my wheel but I don’t know yet if it will last for weeks or months.. do this only if you’re desperate and you tried all other option suggested by iRobot support.

Ok so here’s the first step I tried before doing the main repair, you should probably try every step before, in case your problem is not the same as mine!

Try the iRobot suggested fix method

If you roomba say “Please Inspect and Clean Roomba’s left (or right) Wheel” or if, like me, your roomba spin around a wheel and if you push it a little bit it started to go straight and then restart to spin.

Try those url from iRobot support website :

http://homesupport.irobot.com/app/answers/detail/a_id/498

http://homesupport.irobot.com/app/answers/detail/a_id/805

Fixing hair stuck in the wheel module

If those steps fail for you, and you contacted iRobot support and they told you you’ll need a new wheel module or you feel a different resistance when you spin the wheel, maybe you’re like me and there’s hair or anything stuck in the wheel module. You can try those steps, again, at your own risk.

The idea I had was to used a hair removal mousse, to “soften” the hair stuck in the wheel mechanism. Here’s how to open your roomba 500 and insert the veet foam into the wheel and add oil for lubrication after that.

  • Put your roomba on it’s back. You can put a towel or something smooth under it if you don’t want to scratch the top. Unscrew the side brush and remove it with a flat screwdriver. On the main plate you can see 4 screw with arrow pointing, unscrew them.

  • Remove the plate, and you’ll see the battery. Pull out the battery carefully.

  • Now you should have removed battery and you should be able to locate both side wheels.

  • Remove those three screw.

 

  • Pull out the wheel module gently. Now you should have the wheel module in your hand. I took a picture to show you how to “open” the module but I didn’t remove it on this picture. you can do it like this but it’s hard to keep everything clean…
  • As you can see on the picture, take a thin knife and you have to insert the knife horizontally in the small crack between the inner plastic piece and the rubber wheel. You’ll feel the plastic moving.. be careful to don’t cut or damage the wheel or the plastic.. When your knife is between both parts, lift the knife as it is on the picture so you’ll see a small crack. this is where you’ll need to spray the hair removal mousse… I didn’t show it on the picture because it was already done, and I don’t want do this again.. it’s not easy as it could seem, you may need another hand to keep everything in place and put the hair removal foam… Put a decent amount of foam, you want it to reach the center of the wheel where the air are stuck.

  • After you put the foam into the wheel let it “work” for almost 10 minutes.
  • Roll the wheel and see if you still feel a resistance if you don’t it look good!
  • I wiped the extra foam and I added oil or something to lubricate the center of the wheel. Be careful don’t put too much oil or lubricant because hair and dust will stick to this!

That’s it, put everything back in place. and try your roomba. Mine took almost 5 minutes of “under supervision” first run. After that the wheel was fine!

Let me know if this helped you or if you have another trick to fix the wheels! This is certainly not the best way to do it, but maybe my wheel will survive 1-2 months more!

@+

Howto: Sar and Ksar ( Part two )

This is the part two of my test with sar and ksar. I tested the remote feature in ksar. In short, you use ksar to execute the same command that got executed just before midnight in the second post, in other words, the daily summary.

Having spare time tonight, here’s few screenshot..

Ksar remote connection

Click on: Data => “Launch SSH Command”

Enter the login information: user@ip-address, and click on yes.

You can click on yes here.

After you are asked to enter the SAR command. The default will be good. Click on Yes.

After that you can see the classic view, the same on we’ve got when we loaded text files.

I’d like to show you another sweet things with ksar. You can open few windows within ksar and arrange them, so you can compare your server stats. Open more than one window ( click on file => New window  ) and then click on Window => Tile

That’s it! It not harder than loading a local text file.. I’ll post a third post on Sar and kSar this week for people who would like to get a multiple day report.

Thanks for reading!

++