diff --git a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java index cf354d6820..026fa1895e 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java @@ -440,7 +440,7 @@ public class PluginStarter implements Runnable { } // start console webapps in console/webapps - ContextHandlerCollection server = WebAppStarter.getConsoleServer(); + ContextHandlerCollection server = WebAppStarter.getConsoleServer(ctx); if (server != null) { File consoleDir = new File(pluginDir, "console"); Properties wprops = RouterConsoleRunner.webAppProperties(consoleDir.getAbsolutePath()); @@ -951,7 +951,7 @@ public class PluginStarter implements Runnable { Iterator it = pluginWars.get(pluginName).iterator(); while(it.hasNext() && !isWarRunning) { String warName = it.next(); - if(WebAppStarter.isWebAppRunning(warName)) { + if(WebAppStarter.isWebAppRunning(ctx, warName)) { isWarRunning = true; } } diff --git a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java index 46da0de60b..7410e7140d 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/RouterConsoleRunner.java @@ -24,6 +24,7 @@ import java.util.StringTokenizer; import java.util.concurrent.LinkedBlockingQueue; import net.i2p.I2PAppContext; +import net.i2p.app.ClientApp; import net.i2p.app.ClientAppManager; import net.i2p.app.ClientAppState; import static net.i2p.app.ClientAppState.*; @@ -100,7 +101,7 @@ public class RouterConsoleRunner implements RouterApp { private final RouterContext _context; private final ClientAppManager _mgr; private volatile ClientAppState _state = UNINITIALIZED; - private static Server _server; + private Server _server; private static ScheduledExecutorScheduler _jettyTimer; private String _listenPort; private String _listenHost; @@ -116,6 +117,7 @@ public class RouterConsoleRunner implements RouterApp { // default changed from 0 (forever) in Jetty 6 to 60*1000 ms in Jetty 7 authenticator.setMaxNonceAge(7*24*60*60*1000L); } + private static final String NAME = "console"; public static final String JETTY_REALM = "i2prouter"; private static final String JETTY_ROLE = "routerAdmin"; public static final String PROP_CONSOLE_PW = "routerconsole.auth." + JETTY_REALM; @@ -264,7 +266,7 @@ public class RouterConsoleRunner implements RouterApp { /** @since 0.9.4 */ public String getName() { - return "console"; + return NAME; } /** @since 0.9.4 */ @@ -281,14 +283,25 @@ public class RouterConsoleRunner implements RouterApp { } /** - * SInce _server is now static + * To get to Jetty * @return may be null or stopped perhaps * @since Jetty 6 since it doesn't have Server.getServers() */ - static Server getConsoleServer() { + synchronized Server getConsoleServer() { return _server; } + /** + * To get to Jetty + * @return may be null or stopped perhaps + * @since 0.9.38 + */ + static Server getConsoleServer(I2PAppContext ctx) { + ClientApp app = ctx.clientAppManager().getRegisteredApp(NAME); + return (app != null) ? ((RouterConsoleRunner)app).getConsoleServer() : null; + } + + /** @since 0.8.13, moved from LogsHelper in 0.9.33 */ public static String jettyVersion() { return Server.getVersion(); @@ -1113,7 +1126,7 @@ public class RouterConsoleRunner implements RouterApp { String app = name.substring(PREFIX.length(), name.lastIndexOf(ENABLED)); if (ROUTERCONSOLE.equals(app)) continue; - if (WebAppStarter.isWebAppRunning(app)) { + if (WebAppStarter.isWebAppRunning(_context, app)) { try { WebAppStarter.stopWebApp(_context, app); } catch (Throwable t) { t.printStackTrace(); } diff --git a/apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java b/apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java index bfaf9495f4..94ac58d97d 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/WebAppStarter.java @@ -6,6 +6,7 @@ import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import net.i2p.I2PAppContext; import net.i2p.router.RouterContext; import net.i2p.util.FileUtil; import net.i2p.util.PortMapper; @@ -150,7 +151,7 @@ public class WebAppStarter { * @since public since 0.9.33, was package private */ public static void stopWebApp(RouterContext ctx, String appName) { - ContextHandler wac = getWebApp(appName); + ContextHandler wac = getWebApp(ctx, appName); if (wac == null) return; ctx.portMapper().unregister(appName); @@ -158,7 +159,7 @@ public class WebAppStarter { // not graceful is default in Jetty 6? wac.stop(); } catch (Exception ie) {} - ContextHandlerCollection server = getConsoleServer(); + ContextHandlerCollection server = getConsoleServer(ctx); if (server == null) return; try { @@ -173,16 +174,16 @@ public class WebAppStarter { * * @since public since 0.9.33; was package private */ - public static boolean isWebAppRunning(String appName) { - ContextHandler wac = getWebApp(appName); + public static boolean isWebAppRunning(I2PAppContext ctx, String appName) { + ContextHandler wac = getWebApp(ctx, appName); if (wac == null) return false; return wac.isStarted(); } /** @since Jetty 6 */ - static ContextHandler getWebApp(String appName) { - ContextHandlerCollection server = getConsoleServer(); + static ContextHandler getWebApp(I2PAppContext ctx, String appName) { + ContextHandlerCollection server = getConsoleServer(ctx); if (server == null) return null; Handler handlers[] = server.getHandlers(); @@ -203,8 +204,8 @@ public class WebAppStarter { * See comments in ConfigClientsHandler * @since public since 0.9.33, was package private */ - public static ContextHandlerCollection getConsoleServer() { - Server s = RouterConsoleRunner.getConsoleServer(); + public static ContextHandlerCollection getConsoleServer(I2PAppContext ctx) { + Server s = RouterConsoleRunner.getConsoleServer(ctx); if (s == null) return null; Handler h = s.getChildHandlerByClass(ContextHandlerCollection.class); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHandler.java index 798c96066d..35cbc9ec4e 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHandler.java @@ -387,7 +387,7 @@ public class ConfigClientsHandler extends FormHandler { * requested and add the .war to that one */ private void startWebApp(String app) { - ContextHandlerCollection s = WebAppStarter.getConsoleServer(); + ContextHandlerCollection s = WebAppStarter.getConsoleServer(_context); if (s != null) { try { File path = new File(_context.getBaseDir(), "webapps"); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHelper.java index 7be834986f..0b44f55e0b 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigClientsHelper.java @@ -215,7 +215,7 @@ public class ConfigClientsHelper extends HelperBase { if (name.startsWith(RouterConsoleRunner.PREFIX) && name.endsWith(RouterConsoleRunner.ENABLED)) { String app = name.substring(RouterConsoleRunner.PREFIX.length(), name.lastIndexOf(RouterConsoleRunner.ENABLED)); String val = props.getProperty(name); - boolean isRunning = WebAppStarter.isWebAppRunning(app); + boolean isRunning = WebAppStarter.isWebAppRunning(_context, app); String desc; // use descriptions already tagged elsewhere if (app.equals("routerconsole")) diff --git a/debian-alt/doc/dependencies.txt b/debian-alt/doc/dependencies.txt index 92cb8f9c91..0dedd97694 100644 --- a/debian-alt/doc/dependencies.txt +++ b/debian-alt/doc/dependencies.txt @@ -8,7 +8,7 @@ improve our official packages and support other packagers. Our packages are available at https://deb.i2p2.de/ and instructions are at https://geti2p.net/debian -This document is current as of release 0.9.33, scheduled 2018-01 +This document is current as of release 0.9.37, 2018-10-04. Build-only Dependencies @@ -17,13 +17,22 @@ Build-only Dependencies * ant This is the standard java build system. +* Java JDK + We require openjdk-7-java or higher to build. For 8, set bootclasspath to + java 7 jars if available. + For 9 or higher, require the same or higher runtime, since bootclasspath + isn't possible. + +* libgmp-dev + Current Runtime Dependencies ---------------------------- -* Java JDK/JRE - We require openjdk-7-java to build, and any Java 7, 8, or 9 runtime to run. - Java 9 may still have some issues; see https://trac.i2p2.de/ticket/1870 for status +* Java JRE + We require Java 7 or higher runtime, if built with Java 7 or bootclasspath was set + in the build. If built with 8 or higher and bootclasspath was not set, + then require the same JRE or higher. * geoip-database In non-Debian builds we bundle our own geoip data; @@ -40,12 +49,16 @@ Current Runtime Dependencies * libjetty9-java For /usr/share/java/jetty9-*.jar. In non-Debian builds we bundle the jars; it's removed in the Debian source package. + This is for Jetty 9.2.x, which is what's in Debian. + We are not compatible with Jetty 9.4.x, which is what's in RedHat. * libtomcat8-java For /usr/share/java/tomcat8-*.jar. In non-Debian builds we bundle the jars as packaged in the Jetty 9.2 binary release, which are different than the way they are packaged for Debian. They are removed in the Debian source package. + This is for Tomcat 8.5.x, which is what's in recent Debian/Ubuntu. + Tomcat 8.0.x in older Debian/Ubuntu may or may not work. * libtaglibs-standard-*-java (stretch and later, artful and later only) Provides JSTL 1.2, solves the glassfish-javaee problem described below. @@ -70,11 +83,9 @@ Current Runtime Dependencies For some Debian and Ubuntu releases, these seem to be much older than what we're bundling, but there's no particular version that we need. -* libgmp-dev +* libgmp10 In non-Debian builds we bundle compiled C code; in the Debian packages we have a small C shim that links to the libgmp .so file. - We depend on libgmp-dev for both the build and the runtime, but perhaps only the - libgmp10 package is required for runtime? To be researched. * famfamfam-flag-png Country flags (all except precise) @@ -185,3 +196,6 @@ Other Issues and TODO We don't have a strategy for building, installing, or finding packages for 3rd-party plugins using our plugin system. If we do that, then we can have packages for popular plugins such as i2p-bote. + +* AppArmor + Needs work. In complain-only mode now. diff --git a/debian-alt/doc/maven.txt b/debian-alt/doc/maven.txt new file mode 100644 index 0000000000..47f3c76ad6 --- /dev/null +++ b/debian-alt/doc/maven.txt @@ -0,0 +1,13 @@ +Whoever wants privileges needs to follow the process documented by Sonatype (which was annoying for me the first time around). +It involves creating a ticket in their JIRA instance, which I assume we can use as a means to add additional access +(probably by me confirming on said ticket, again once the process has been started). + +As for the actual process: +Run "ant distclean mavenCentral". It tells you what to do - +namely, specify a GPG signing key if you haven't already, +and then upload the resulting mavencentral-*.jar files to Maven Central, +which happens via the Sonatype repository and is well-documented there. + +If someone eventually gets the Gradle build scripts to be byte-for-byte compatible with Ant for those libraries, +then the process will be even simpler: just configure your Sonatype password, +and then run a single command which will do everything.