Archiv für die Kategorie ‘Security’

dollar signs ($) in tomcat’s server.xml configuration file

Mai 25, 2006

tomcat.jpg The problem has begun with a new security policy in the company. Beside other conditions how a password must look like (length, numeric-alphanumeric, upper-lower-case) it was said that it is necessary to include a special character in each of the passwords. My favorite one was the dollar sign ($)…

For accesing a databases with tomcat (i used version 5.0.28) I need to configure a jndi data source via jdbc as it is described here. I typed my password like (this is not the real one) with the $-sign:

iGet$4work

Result: The jdbc-driver said that the password was wrong.

After different tries of rechecking and checking some encoding stuff I used ethereal to see what my tomcat was actually sending:

iGet4work

What do I get 4 work? No dollars – Nothing – Huh – maybe next time I stay at home. Not the right solution.

How it worked?

You need even more dollars, just use

iGet$$4work

and the right password is send over the network. Tomcat got the DB-Connect and I was happy.

What I have learned?

  • Internally in most tomcat confguration files the dollar sign is used for variables
  • sometimes it is better to double the dollars

Next time: Maybe I cover the topic how to specify a password with #-signs in unix-scripts or java.propertie-files;-)