You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Murad Nayal <mn...@columbia.edu> on 2005/07/18 03:04:46 UTC

question about deployment (including executables in war)


Hi Everybody,

I need to include executable programs as part of my web application. in
development I created a directory WEB-INF/bin where I kept copies of the
programs I need. problem is when I create a war file for my application,
jar strips the execute file permissions from my programs. is there any
way around this at all where I would still have my application packaged
as a single war file with the necessary executables (with the correct
permissions).

many thanks
Murad Nayal

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: question about deployment (including executables in war)

Posted by Murad Nayal <mn...@columbia.edu>.
Hi Alon,

Thanks for reply.

I am new to tomcat development. but I'll try my best to be more
specific.

it seems that there are a couple of ways to 'deploy' web applications.
the deploy task has a localWar attribute that points to the local build
directory. Or you can use the war attribute that points to a single war
file containing the application.

my web application presents results that are at the moment computed by a
number of stand-alone programs on the server. for maximum reliability I
decided to keep copies of these executables in the application
distribution directory structure, at this point WEB-INF/bin. 

to create the war file for distribution I use the ant dist command. the
dist target includes the task:

    <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
         basedir="${build.home}"/>

the jar task is able to create a single war file from the contents of
the build.home directory hierarchy (that includes WEB-INF/bin). but in
the process it changes the permissions of the executable files to
read-only (i.e. strips the execute bit). as a result my application is
unable to run these executables after installation.

if I manually make these programs executable at the installation
directory (webapp) the application runs fine. so apparently the
SecurityManager has no problem with that (I can obtain a Runtime, and
run a process from within the web application with no problem). I
suppose that's something to look a bit more into to make sure the
application is secure.

At this point I do the installation like this

  <target name="install" depends="compile"
   description="Install application to servlet container">
    <delete dir="${catalina.home}/webapps/${app.name}"/>
    <mkdir    dir="${catalina.home}/webapps/${app.name}"/>
    <copy  todir="${catalina.home}/webapps/${app.name}">
      <fileset dir="${build.home}"/>
    </copy>
    <chmod perm="oug+x">
      <fileset dir="${catalina.home}/webapps/${app.name}/WEB-INF/bin">
      </fileset>
    </chmod>
  </target>

I run 
ant stop
ant install
ant start

but this does not seem to be terribly reliable. I get messages at
catalina.out saying things like " application has not been started" and
"application has already been started" and sometimes I need to do start
and stop a couple of times before the application is actually running.

using the localWar deploy method runs into similar problems in terms of
stripping the execute bit off the executables when installed.

any ideas / comments / suggestions ?

thanks
Murad Nayal


Alon Belman wrote:
> 
> Murad,
> 
> I'm not 100% sure what you're asking -- like what do you mean by "jar
> strips the execute file permissions from my programs"? -- but i'm
> assuming you cant do it.   In fact, I will be more than a little
> alarmed if a packaged web app can include and run arbitrary
> executables unless specifically allowed to so by its server's
> SecurityManager, or if the server is running without a
> SecurityManager.  That is, you cannot do it unless you configure it
> OUTSIDE your web application.
> 
> Hope this helps,
> Alon
> 
> On 7/17/05, Murad Nayal <mn...@columbia.edu> wrote:
> >
> >
> > Hi Everybody,
> >
> > I need to include executable programs as part of my web application. in
> > development I created a directory WEB-INF/bin where I kept copies of the
> > programs I need. problem is when I create a war file for my application,
> > jar strips the execute file permissions from my programs. is there any
> > way around this at all where I would still have my application packaged
> > as a single war file with the necessary executables (with the correct
> > permissions).
> >
> > many thanks
> > Murad Nayal
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: question about deployment (including executables in war)

Posted by "Richard Mixon (qwest)" <rn...@qwest.net>.
Murad,

I would not copy the files - but just change the permissions. No restart
should be necessary that way - unless I'm missing something.

However to answer your question, using the build.xml in
jakarta-tomcat-5.5.9-deployer, I usually use the following command to
restart the application:
  ant stop start

It works for me. That said, I have seen cases where after I deploy and
app and then do a start I get complaints ... Doing something like:
  Ant stop undeploy deploy start
I finally figured that the deploy was issuing an implicit start, so I
changed it to:
  ant stop undeploy deploy
 
Hope this helps. - Richard

-----Original Message-----
From: murad@columbia.edu [mailto:murad@columbia.edu] On Behalf Of Murad
Nayal
Sent: Wednesday, July 20, 2005 12:32 PM
To: Tomcat Users List; Richard Mixon (qwest)
Subject: Re: question about deployment (including executables in war)



Many thanks Richard, I suppose that answers my question, albeit I was
hoping there was something more elegant that can be done other than
changing file permissions after installation.

what is the correct way to reload applications after copying files into
the installation directory? ant stop; ant start seem not to be designed
for that judging from the complaints from tomcat I get in catalina.out!!

thanks again
Murad Nayal

"Richard Mixon (qwest)" wrote:
> 
> Murad/Alon,
> 
> This has nothing to do with a SecurityManager. Murad is trying to run 
> the executables on the server - from one of his servlets I assume.
> 
> The problem is the fact that a war files is basically just a zip file.
> It does not maintain the file attributes that are specific to a 
> particular operating system (e.g. execute, read-only, write, etc.).
> Other archive formats do this (e.g. tar and Windows backup archives).
> 
> I believe the user's "umask" setting is probably used to set the 
> permissions - but Tomcat might do something different. Regardless, 
> even if Tomcat honors the umask setting, you would not want to change 
> this such that all files were marked executable when the jar was 
> uncompressed.
> 
> I am not sure you have much option other than to have a custom ant 
> script that alters the permissions after the files are deployed from 
> the war file. The jakarta-tomcat-5.5.x-deployer has a deployment 
> script
> (build.xml) that should be a good starting point.
> 
> Hope this helps - Richard
> 
> -----Original Message-----
> From: Alon Belman [mailto:alon.belman@gmail.com]
> Sent: Tuesday, July 19, 2005 4:44 PM
> To: Tomcat Users List; mn216@columbia.edu
> Subject: Re: question about deployment (including executables in war)
> 
> Murad,
> 
> I'm not 100% sure what you're asking -- like what do you mean by "jar 
> strips the execute file permissions from my programs"? -- but i'm
> assuming you cant do it.   In fact, I will be more than a little
> alarmed if a packaged web app can include and run arbitrary 
> executables unless specifically allowed to so by its server's 
> SecurityManager, or if the server is running without a 
> SecurityManager.  That is, you cannot do it unless you configure it
OUTSIDE your web application.
> 
> Hope this helps,
> Alon
> 
> On 7/17/05, Murad Nayal <mn...@columbia.edu> wrote:
> >
> >
> > Hi Everybody,
> >
> > I need to include executable programs as part of my web application.
> > in development I created a directory WEB-INF/bin where I kept copies

> > of the programs I need. problem is when I create a war file for my 
> > application, jar strips the execute file permissions from my
programs.
> 
> > is there any way around this at all where I would still have my 
> > application packaged as a single war file with the necessary 
> > executables (with the correct permissions).
> >
> > many thanks
> > Murad Nayal
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: question about deployment (including executables in war)

Posted by Murad Nayal <mn...@columbia.edu>.

Many thanks Richard, I suppose that answers my question, albeit I was
hoping there was something more elegant that can be done other than
changing file permissions after installation.

what is the correct way to reload applications after copying files into
the installation directory? ant stop; ant start seem not to be designed
for that judging from the complaints from tomcat I get in catalina.out!!

thanks again
Murad Nayal

"Richard Mixon (qwest)" wrote:
> 
> Murad/Alon,
> 
> This has nothing to do with a SecurityManager. Murad is trying to run
> the executables on the server - from one of his servlets I assume.
> 
> The problem is the fact that a war files is basically just a zip file.
> It does not maintain the file attributes that are specific to a
> particular operating system (e.g. execute, read-only, write, etc.).
> Other archive formats do this (e.g. tar and Windows backup archives).
> 
> I believe the user's "umask" setting is probably used to set the
> permissions - but Tomcat might do something different. Regardless, even
> if Tomcat honors the umask setting, you would not want to change this
> such that all files were marked executable when the jar was
> uncompressed.
> 
> I am not sure you have much option other than to have a custom ant
> script that alters the permissions after the files are deployed from the
> war file. The jakarta-tomcat-5.5.x-deployer has a deployment script
> (build.xml) that should be a good starting point.
> 
> Hope this helps - Richard
> 
> -----Original Message-----
> From: Alon Belman [mailto:alon.belman@gmail.com]
> Sent: Tuesday, July 19, 2005 4:44 PM
> To: Tomcat Users List; mn216@columbia.edu
> Subject: Re: question about deployment (including executables in war)
> 
> Murad,
> 
> I'm not 100% sure what you're asking -- like what do you mean by "jar
> strips the execute file permissions from my programs"? -- but i'm
> assuming you cant do it.   In fact, I will be more than a little
> alarmed if a packaged web app can include and run arbitrary executables
> unless specifically allowed to so by its server's SecurityManager, or if
> the server is running without a SecurityManager.  That is, you cannot do
> it unless you configure it OUTSIDE your web application.
> 
> Hope this helps,
> Alon
> 
> On 7/17/05, Murad Nayal <mn...@columbia.edu> wrote:
> >
> >
> > Hi Everybody,
> >
> > I need to include executable programs as part of my web application.
> > in development I created a directory WEB-INF/bin where I kept copies
> > of the programs I need. problem is when I create a war file for my
> > application, jar strips the execute file permissions from my programs.
> 
> > is there any way around this at all where I would still have my
> > application packaged as a single war file with the necessary
> > executables (with the correct permissions).
> >
> > many thanks
> > Murad Nayal
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: question about deployment (including executables in war)

Posted by "Richard Mixon (qwest)" <rn...@qwest.net>.
Murad/Alon,

This has nothing to do with a SecurityManager. Murad is trying to run
the executables on the server - from one of his servlets I assume.

The problem is the fact that a war files is basically just a zip file.
It does not maintain the file attributes that are specific to a
particular operating system (e.g. execute, read-only, write, etc.).
Other archive formats do this (e.g. tar and Windows backup archives).

I believe the user's "umask" setting is probably used to set the
permissions - but Tomcat might do something different. Regardless, even
if Tomcat honors the umask setting, you would not want to change this
such that all files were marked executable when the jar was
uncompressed.

I am not sure you have much option other than to have a custom ant
script that alters the permissions after the files are deployed from the
war file. The jakarta-tomcat-5.5.x-deployer has a deployment script
(build.xml) that should be a good starting point.

Hope this helps - Richard 

-----Original Message-----
From: Alon Belman [mailto:alon.belman@gmail.com] 
Sent: Tuesday, July 19, 2005 4:44 PM
To: Tomcat Users List; mn216@columbia.edu
Subject: Re: question about deployment (including executables in war)

Murad,

I'm not 100% sure what you're asking -- like what do you mean by "jar
strips the execute file permissions from my programs"? -- but i'm
assuming you cant do it.   In fact, I will be more than a little
alarmed if a packaged web app can include and run arbitrary executables
unless specifically allowed to so by its server's SecurityManager, or if
the server is running without a SecurityManager.  That is, you cannot do
it unless you configure it OUTSIDE your web application.

Hope this helps,
Alon



On 7/17/05, Murad Nayal <mn...@columbia.edu> wrote:
> 
> 
> Hi Everybody,
> 
> I need to include executable programs as part of my web application. 
> in development I created a directory WEB-INF/bin where I kept copies 
> of the programs I need. problem is when I create a war file for my 
> application, jar strips the execute file permissions from my programs.

> is there any way around this at all where I would still have my 
> application packaged as a single war file with the necessary 
> executables (with the correct permissions).
> 
> many thanks
> Murad Nayal
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: question about deployment (including executables in war)

Posted by Alon Belman <al...@gmail.com>.
Murad,

I'm not 100% sure what you're asking -- like what do you mean by "jar
strips the execute file permissions from my programs"? -- but i'm
assuming you cant do it.   In fact, I will be more than a little
alarmed if a packaged web app can include and run arbitrary
executables unless specifically allowed to so by its server's
SecurityManager, or if the server is running without a
SecurityManager.  That is, you cannot do it unless you configure it
OUTSIDE your web application.

Hope this helps,
Alon



On 7/17/05, Murad Nayal <mn...@columbia.edu> wrote:
> 
> 
> Hi Everybody,
> 
> I need to include executable programs as part of my web application. in
> development I created a directory WEB-INF/bin where I kept copies of the
> programs I need. problem is when I create a war file for my application,
> jar strips the execute file permissions from my programs. is there any
> way around this at all where I would still have my application packaged
> as a single war file with the necessary executables (with the correct
> permissions).
> 
> many thanks
> Murad Nayal
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org