Package org.eclipse.jetty.setuid
Class SetUIDListener
- java.lang.Object
-
- org.eclipse.jetty.setuid.SetUIDListener
-
- All Implemented Interfaces:
java.util.EventListener,org.eclipse.jetty.util.component.LifeCycle.Listener
public class SetUIDListener extends java.lang.Object implements org.eclipse.jetty.util.component.LifeCycle.ListenerThis LifeCycleListener may be added to a
Serverto make a JNI call to set the unix UID.This can be used to start the server as root so that privileged ports may be accessed and then switch to a non-root user for security. Depending on the value of
setStartServerAsPrivileged(boolean), either the server will be started and then the UID set; or theServer.getConnectors()will be opened, the UID set and then the server is started. The latter is the default and avoids any web application code being run as a privileged user, but will not work if the application code also needs to open privileged ports.The configured umask is set before the server is started and the configured gid/uid is set after the server is started.
-
-
Constructor Summary
Constructors Constructor Description SetUIDListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetGid()java.lang.StringgetGroupname()RLimitgetRLimitNoFiles()intgetUid()intgetUmask()java.lang.StringgetUmaskOctal()java.lang.StringgetUsername()booleanisClearSupplementalGroups()booleanisStartServerAsPrivileged()voidlifeCycleFailure(org.eclipse.jetty.util.component.LifeCycle server, java.lang.Throwable cause)voidlifeCycleStarted(org.eclipse.jetty.util.component.LifeCycle server)voidlifeCycleStarting(org.eclipse.jetty.util.component.LifeCycle lifecycle)voidlifeCycleStopped(org.eclipse.jetty.util.component.LifeCycle arg0)voidlifeCycleStopping(org.eclipse.jetty.util.component.LifeCycle arg0)voidsetClearSupplementalGroups(boolean clearSupplementalGroups)voidsetGid(int gid)protected voidsetGidUid()voidsetGroupname(java.lang.String groupname)voidsetRLimitNoFiles(RLimit rlimit)voidsetStartServerAsPrivileged(boolean startContextsAsPrivileged)voidsetUid(int uid)voidsetUmask(int umask)voidsetUmaskOctal(java.lang.String umask)voidsetUsername(java.lang.String username)
-
-
-
Method Detail
-
setUsername
public void setUsername(java.lang.String username)
-
getUsername
public java.lang.String getUsername()
-
setGroupname
public void setGroupname(java.lang.String groupname)
-
getGroupname
public java.lang.String getGroupname()
-
getUmask
public int getUmask()
-
getUmaskOctal
public java.lang.String getUmaskOctal()
-
setUmask
public void setUmask(int umask)
-
setUmaskOctal
public void setUmaskOctal(java.lang.String umask)
-
getUid
public int getUid()
-
setUid
public void setUid(int uid)
-
setGid
public void setGid(int gid)
-
getGid
public int getGid()
-
setRLimitNoFiles
public void setRLimitNoFiles(RLimit rlimit)
-
getRLimitNoFiles
public RLimit getRLimitNoFiles()
-
isClearSupplementalGroups
public boolean isClearSupplementalGroups()
-
setClearSupplementalGroups
public void setClearSupplementalGroups(boolean clearSupplementalGroups)
-
setGidUid
protected void setGidUid()
-
lifeCycleFailure
public void lifeCycleFailure(org.eclipse.jetty.util.component.LifeCycle server, java.lang.Throwable cause)- Specified by:
lifeCycleFailurein interfaceorg.eclipse.jetty.util.component.LifeCycle.Listener
-
lifeCycleStarted
public void lifeCycleStarted(org.eclipse.jetty.util.component.LifeCycle server)
- Specified by:
lifeCycleStartedin interfaceorg.eclipse.jetty.util.component.LifeCycle.Listener
-
lifeCycleStarting
public void lifeCycleStarting(org.eclipse.jetty.util.component.LifeCycle lifecycle)
- Specified by:
lifeCycleStartingin interfaceorg.eclipse.jetty.util.component.LifeCycle.Listener
-
lifeCycleStopped
public void lifeCycleStopped(org.eclipse.jetty.util.component.LifeCycle arg0)
- Specified by:
lifeCycleStoppedin interfaceorg.eclipse.jetty.util.component.LifeCycle.Listener
-
lifeCycleStopping
public void lifeCycleStopping(org.eclipse.jetty.util.component.LifeCycle arg0)
- Specified by:
lifeCycleStoppingin interfaceorg.eclipse.jetty.util.component.LifeCycle.Listener
-
isStartServerAsPrivileged
public boolean isStartServerAsPrivileged()
- Returns:
- the startServerAsPrivileged
-
setStartServerAsPrivileged
public void setStartServerAsPrivileged(boolean startContextsAsPrivileged)
- Parameters:
startContextsAsPrivileged- if true, the server is started and then the process UID is switched. If false, the connectors are opened, the UID is switched and then the server is started.
-
-