Ask Your Question
0

Puppet module to update a file content in jar

asked 2017-04-25 09:10:17 -0500

CBR gravatar image

Hi,

Is there a module to update file content in jars using puppet module ? I'm hardening tomcat binaries based on owasp and would like to know if I have to use exec or some other module available ?

Thank you.

edit retag flag offensive close merge delete

Comments

As far as I know, There isn't any 'jar manipulation' modules on the forge. Depending on the file you want to update... Do you have the full file that you want to replace in your module, or are you expecting to 'extract file from jar' -> 'update content in file' -> 'update jar with modified file'?

DarylW gravatar imageDarylW ( 2017-04-25 22:14:58 -0500 )edit

yes. I need to extract -> update content -> update jar.

CBR gravatar imageCBR ( 2017-04-26 05:56:11 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-04-28 03:31:24 -0500

John Ericson gravatar image

updated 2017-05-02 07:48:34 -0500

DarylW gravatar image

Hi CBR!

I have the same need as you. I solved it by doing a ruby function generate_java_jar that I could use in a file resource. So my final code in Puppet manifest looks like this:

            file { "$install_dir_app_java/lib/properties.jar":
                    ensure => file,
                    content => generate_java_jar(template('my_java_app/jboss-ejb-client.properties.erb'),template('my_java_app/mysettings.properties.erb')),
            }

In this ruby function I use shell functions to use the jar command shipped with Java for updating and packaging the jar-file.

edit flag offensive delete link more

Comments

I think this holds true if the properties is directly within the first level of jar path. If I want to update ServerInfo.properties in org/apache/catalina/util... I would probably need a custom type and provider. The exec function I'm using is always generating jar even after using onlyif/unless.

CBR gravatar imageCBR ( 2017-05-03 10:33:39 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-04-25 09:10:17 -0500

Seen: 43 times

Last updated: May 02