Scrambling credentials in ldap-config.properties file

I am new to Teamcity and I am trying to scramble the password  in the ldap config. When I try to run this I get an error below. Any idea what might be causing this. I am running it from <TeamCity installation directory>/webapps/ROOT/WEB-INF/lib directory.

java -cp serviceMessages.jar;common-api.jar;commons-codec.jar;commons-codec-1.3.jar;log4j-1.2.12.jar jetbrains.buildServer.serverSide.crypt.ScrambleMain "<text to scramble>"
 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at jetbrains.buildServer.serverSide.crypt.EncryptUtil.<clinit>(EncryptUtil.java:43)
        at jetbrains.buildServer.serverSide.crypt.ScrambleMain.main(ScrambleMain.java:26)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      ... 2 more
0
3 comments

Sorry about this, it looks like we need to update our documentation. The log4j-1.2.12.jar file is no longer included in TeamCity since TW-74861. As noted on the YouTrack issue, we have replaced it with our own fork of log4j 1.2, but it looks like it was left out in TeamCity 2022.04. The source code for the JetBrains fork of log4j 1.2 is available at: https://github.com/JetBrains/teamcity-log4j. You can download the replacement artifacts from the maven repository at: https://download.jetbrains.com/teamcity-repository/org/jetbrains/teamcity/tc-log4j/. 

You'll need to place the tc-log4j-1.2.17.1.jar file in the <TeamCity installation directory>/webapps/ROOT/WEB-INF/lib directory. Then, you can run this command:

java -cp serviceMessages.jar;common-api.jar;commons-codec.jar;commons-codec-1.3.jar;tc-log4j-1.2.17.1.jar jetbrains.buildServer.serverSide.crypt.ScrambleMain "<text to scramble>"

I've created a bug report for this on our YouTrack site here: https://youtrack.jetbrains.com/issue/TW-76335/LDAP-ScramleMain-no-longer-works-after-removal-of-log4j-1-2-12-j

0

Great. Thank you. That worked.

0

Glad to hear you were able to make it work! I learned this morning that we have added the scrambling feature to our REST API. For future reference, you can use the following request to scramble text:

GET {teamcity_url}/app/rest/debug/values/password/scrambled?value=<text to scramble>
0

Please sign in to leave a comment.