Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] SetUID - Jetty 9


Hi, Jan

Unfortunately, the link for the toolchain is broken
Even though I would like to see the most recent version of the code. I found a solution to my problem based on the codehaus' version. I've posted it at http://stackoverflow.com/questions/30738510/unsatisfiedlinkerror-when-running-jetty9s-setuid-feature



----------------------------------------------------------------------

Message: 1
Date: Tue, 9 Jun 2015 12:48:29 -0400
From: Vinicius Dantas <vinicius.gppcom@xxxxxxxxx>
To: jetty-users@xxxxxxxxxxx
Subject: [jetty-users] SetUID - Jetty 9
Message-ID:
        <CACb0x=ahEfGd5eVchf_o5iLH1nqDeJvCZo32GNSi64qgV8MYQA@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset="utf-8"

Hi,
I just tried to run Jetty 9 as non root users, using setuid feature
without success for binding low port numbers.
I enabled the module setuid in the start.ini and added
-Djava.library.path=/opt/jetty/lib/setuid
But I have the following stack trace when starting Jetty:
2015-06-09 16:27:27.211:WARN:oejx.XmlConfiguration:main: Config error
at <Call name="addLifeCycleListener"><Arg>|      <New
class="org.eclipse.jetty.setuid.SetUIDListener"><Set
name="startServerAsPrivileged"><Property
name="jetty.startServerAsPrivileged" default="false"/></Set><Set
name="umaskOctal"><Property name="jetty.umask"
default="002"/></Set><Set name="username"><Property
name="jetty.username" default="jetty"/></Set><Set
name="groupname"><Property name="jetty.groupname"
default="jetty"/></Set></New>|    </Arg></Call>
java.lang.reflect.InvocationTargetException in
file:/opt/jetty/etc/jetty-setuid.xml
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:321)
        at org.eclipse.jetty.start.Main.start(Main.java:817)
        at org.eclipse.jetty.start.Main.main(Main.java:112)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:479)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:815)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1125)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:721)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:417)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:354)
        at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1243)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
        ... 7 more
Caused by: java.lang.UnsatisfiedLinkError:
org.eclipse.jetty.setuid.SetUID.getpwnam(Ljava/lang/String;)Lorg/eclipse/jetty/setuid/Passwd;
        at org.eclipse.jetty.setuid.SetUID.getpwnam(Native Method)
        at org.eclipse.jetty.setuid.SetUIDListener.setUsername(SetUIDListener.java:53)
        ... 23 more

 Those are the only references to this
error:http://jira.codehaus.org/browse/JETTY-1197

http://dev.eclipse.org/mhonarc/lists/jetty-users/msg01657.html

https://groups.google.com/forum/#!topic/dropwizard-user/aap2B_U_QPo

But they are either stopped or do not show the solution.

The source code I found for the setuid package is:

https://github.com/jetty-project/codehaus-jetty-project/blob/master/jetty-setuid/modules/java/src/main/java/org/mortbay/setuid/SetUID.java

Even though I cannot be sure this is the version I am using, given
this one is from a org.mortbay package, while the one Jetty 9 uses is
an Eclipse one.

I tried setting -Djetty.libsetuid.path in the java args (first
try-catch block), either adding the path to the $PATH variable or
setting -Djava.library.path (second try-catch block) and leaving it as
it is (third try-catch block). I got the same exception stack in all
the cases.

I cannot be sure if Jetty is either not finding the so file or not
being able to load it, given that, if I remove all the references to
the path (the cases I described latter), I still get the same error
message.

I use Java7 to run Jetty.


--
Vin?cius Dantas de Lima Melo
Graduando em Ci?ncias e Tecnologia
Universidade Federal do Rio Grande do Norte (UFRN)
Escola de Ci?ncias e Tecnologia (ECT)
Natal, Rio Grande do Norte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dev.eclipse.org/mailman/private/jetty-users/attachments/20150609/0fd2b91b/attachment.html>

------------------------------

Message: 2
Date: Wed, 10 Jun 2015 08:05:58 +1000
From: Jan Bartel <janb@xxxxxxxxxxx>
To: JETTY user mailing list <jetty-users@xxxxxxxxxxx>
Subject: Re: [jetty-users] SetUID - Jetty 9
Message-ID:
        <CALg=VpiEtJqpNeWdJ3Trdg2oELaBjxMTZpFehu4v-OiCUD3BXQ@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=UTF-8

Hi Vinicius,

The codehaus project is dead. The correct setuid native lib code is
hosted at Eclipse in the jetty-toolchain project. The documentation
page on the setuid feature has a link to it:
https://www.eclipse.org/jetty/documentation/current/setting-port80-access.html#configuring-jetty-setuid-feature

cheers
Jan

On 10 June 2015 at 02:48, Vinicius Dantas <vinicius.gppcom@xxxxxxxxx> wrote:
> Hi,
> I just tried to run Jetty 9 as non root users, using setuid feature without
> success for binding low port numbers.
> I enabled the module setuid in the start.ini and added
> -Djava.library.path=/opt/jetty/lib/setuid
> But I have the following stack trace when starting Jetty:
> 2015-06-09 16:27:27.211:WARN:oejx.XmlConfiguration:main: Config error at
> <Call name="addLifeCycleListener"><Arg>|      <New
> class="org.eclipse.jetty.setuid.SetUIDListener"><Set
> name="startServerAsPrivileged"><Property
> name="jetty.startServerAsPrivileged" default="false"/></Set><Set
> name="umaskOctal"><Property name="jetty.umask" default="002"/></Set><Set
> name="username"><Property name="jetty.username" default="jetty"/></Set><Set
> name="groupname"><Property name="jetty.groupname"
> default="jetty"/></Set></New>|    </Arg></Call>
> java.lang.reflect.InvocationTargetException in
> file:/opt/jetty/etc/jetty-setuid.xml
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at org.eclipse.jetty.start.Main.invokeMain(Main.java:321)
>         at org.eclipse.jetty.start.Main.start(Main.java:817)
>         at org.eclipse.jetty.start.Main.main(Main.java:112)
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:479)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.newObj(XmlConfiguration.java:815)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.itemValue(XmlConfiguration.java:1125)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.value(XmlConfiguration.java:1030)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.call(XmlConfiguration.java:721)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:417)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:354)
>         at
> org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:262)
>         at
> org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1243)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
> org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1174)
>         ... 7 more
> Caused by: java.lang.UnsatisfiedLinkError:
> org.eclipse.jetty.setuid.SetUID.getpwnam(Ljava/lang/String;)Lorg/eclipse/jetty/setuid/Passwd;
>         at org.eclipse.jetty.setuid.SetUID.getpwnam(Native Method)
>         at
> org.eclipse.jetty.setuid.SetUIDListener.setUsername(SetUIDListener.java:53)
>         ... 23 more
>
>  Those are the only references to this error:
> http://jira.codehaus.org/browse/JETTY-1197
>
> http://dev.eclipse.org/mhonarc/lists/jetty-users/msg01657.html
>
> https://groups.google.com/forum/#!topic/dropwizard-user/aap2B_U_QPo
>
> But they are either stopped or do not show the solution.
>
> The source code I found for the setuid package is:
>
> https://github.com/jetty-project/codehaus-jetty-project/blob/master/jetty-setuid/modules/java/src/main/java/org/mortbay/setuid/SetUID.java
>
> Even though I cannot be sure this is the version I am using, given this one
> is from a org.mortbay package, while the one Jetty 9 uses is an Eclipse one.
>
> I tried setting -Djetty.libsetuid.path in the java args (first try-catch
> block), either adding the path to the $PATH variable or setting
> -Djava.library.path (second try-catch block) and leaving it as it is (third
> try-catch block). I got the same exception stack in all the cases.
>
> I cannot be sure if Jetty is either not finding the so file or not being
> able to load it, given that, if I remove all the references to the path (the
> cases I described latter), I still get the same error message.
>
> I use Java7 to run Jetty.
>
>
> --
> Vin?cius Dantas de Lima Melo
> Graduando em Ci?ncias e Tecnologia
> Universidade Federal do Rio Grande do Norte (UFRN)
> Escola de Ci?ncias e Tecnologia (ECT)
> Natal, Rio Grande do Norte
>
> _______________________________________________
> jetty-users mailing list
> jetty-users@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from
> this list, visit
> https://dev.eclipse.org/mailman/listinfo/jetty-users



--
Jan Bartel <janb@xxxxxxxxxxx>
www.webtide.com
'Expert assistance from the creators of Jetty and CometD'
 -- 
Vinícius Dantas de Lima Melo
Graduando em Ciências e Tecnologia 
Universidade Federal do Rio Grande do Norte (UFRN)
Escola de Ciências e Tecnologia (ECT)
Natal, Rio Grande do Norte

Back to the top