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

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
vinicius.gppcom@xxxxxxxxx viniciusdantas@xxxxxxxxxxxxxxxÂvinicius.dantasdelimamelo@xxxxxxxxxxxxxxxxÂ| Celular/Mobile Phone: +1 647 447 5737
Skype:Âviniciusdantas01