This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch TOMEE-4701 in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 5424de465cd5498e6d609f3f43c5d3566fe3b420 Author: Richard Zowalla <[email protected]> AuthorDate: Mon Sep 7 20:56:50 2026 +0200 TOMEE-4701 - Drop openejb-ssh --- docs/ssh.adoc | 63 ------- pom.xml | 5 - rat.xml | 1 - server/openejb-ssh/README.adoc | 10 - server/openejb-ssh/pom.xml | 100 ---------- server/openejb-ssh/src/main/assembly/ssh.xml | 48 ----- .../apache/openejb/server/ssh/OpenEJBCommands.java | 112 ------------ .../ssh/OpenEJBJaasPasswordAuthenticator.java | 67 ------- .../openejb/server/ssh/OpenEJBShellFactory.java | 36 ---- .../org/apache/openejb/server/ssh/SSHServer.java | 123 ------------- .../src/main/resources/META-INF/LICENSE | 202 --------------------- .../openejb-ssh/src/main/resources/META-INF/NOTICE | 10 - .../org.apache.openejb.server.ServerService/ssh | 5 - .../java/org/apache/openejb/server/ssh/Foo.java | 29 --- .../apache/openejb/server/ssh/SSHServerTest.java | 117 ------------ server/openejb-ssh/src/test/key/ssh-key.ser | Bin 1834 -> 0 bytes .../src/test/resources/META-INF/beans.xml | 19 -- server/pom.xml | 1 - 18 files changed, 948 deletions(-) diff --git a/docs/ssh.adoc b/docs/ssh.adoc deleted file mode 100644 index fcad99b2e4..0000000000 --- a/docs/ssh.adoc +++ /dev/null @@ -1,63 +0,0 @@ -= SSH -:index-group: Unrevised -:jbake-date: 2018-12-05 -:jbake-type: page -:jbake-status: published - - -== Connecting To OpenEJB or TomEE Through SSH - -=== Description - -It can be very useful to connect to the server to get some information. - -=== Solution - -For such a case OpenEJB/TomEE proposes to start with the Jakarta EE server -an SSH server. Currently, the security is based on JAAS (see how to -configure JAAS for TomEE for more information about it). - -=== Installation - -Simply extract the openejb-ssh jar in the lib of tomee -(webapps/tomee/lib) or openejb libs (lib folder). Then simply connect -using your JAAS credential. - -Note: you can use the provisioning features of openejb to do this job! - -Then simply activate the service manage: it is done setting the system -property openejb.servicemanager.enabled to true. - -Note: it can be done through the conf/system.properties file. Note2: -please take care to not add space after true (not 'true ' for instance). - -=== OpenEJB SSH Shell - -Once you are connected you get some commands: - -* deploy : deploy an application -* undeploy : undeploy an application -* list: list deployed EJBs -* classloader : print the classloader tree of the app specified by the -id -* jmx : interact with JMX ** jmx list: list mbeans ** jmx get ** jmx set -** jmx invoke ([, ...) -* properties: print server configuration as properties -* script -+ -+ -: execute the following script code using the following language with -the JSR 223 -* script file -+ -+ -: execute the following script using the language (from the extension of -the file) with the JSR 223 -* ls []: list the file in path is specified or in the base of the server -if not -* cat : print a file -* part - : print the part of a file - -Note1: JSR 223 can need to add some jar to openejb/tomee lib folder -(groovy-all for instance to use groovy) Note2: ls, part, cat commands -have to use $home and $base properties to specify the path diff --git a/pom.xml b/pom.xml index 6f57ba1cf8..117d16ed01 100644 --- a/pom.xml +++ b/pom.xml @@ -1583,11 +1583,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.apache.sshd</groupId> - <artifactId>sshd-core</artifactId> - <version>2.19.0</version> - </dependency> <dependency> <groupId>jline</groupId> <artifactId>jline</artifactId> diff --git a/rat.xml b/rat.xml index 1b5a6bcafa..3b76be3511 100644 --- a/rat.xml +++ b/rat.xml @@ -87,7 +87,6 @@ <exclude name="osgi/openejb-core-osgi/src/main/resources/META-INF/services/jakarta.enterprise.inject.spi.Extension"/> <exclude name="server/openejb-cxf/src/main/resources/META-INF/cxf.extension"/> <exclude name="server/openejb-cxf-rs/src/main/resources/META-INF/services/jakarta.ws.rs.ext.RuntimeDelegate"/> - <exclude name="server/openejb-ssh/src/test/key/ssh-key.ser"/> <exclude name="server/openejb-ejbd/activemq-data/**"/> <exclude name="server/openejb-http/activemq-data/**"/> <exclude name="examples/datasource-ciphered-password/src/test/resources/META-INF/beans.xml"/> diff --git a/server/openejb-ssh/README.adoc b/server/openejb-ssh/README.adoc deleted file mode 100644 index 4c64cb6b45..0000000000 --- a/server/openejb-ssh/README.adoc +++ /dev/null @@ -1,10 +0,0 @@ -* copy jar included in openejb-ssh zip in openejb libs -(/webapps/openejb/lib for instance) -* for TomEE add a file system.properties in conf containing -+ -openejb.servicemanager.enabled = true -* start the server -* ssh can be configured in conf/ssh.properties - -Note: it uses JAAS for authentication, further details on -http://tomee.apache.org/tomee-jaas.html diff --git a/server/openejb-ssh/pom.xml b/server/openejb-ssh/pom.xml deleted file mode 100644 index 99a48ab963..0000000000 --- a/server/openejb-ssh/pom.xml +++ /dev/null @@ -1,100 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>server</artifactId> - <groupId>org.apache.tomee</groupId> - <version>11.0.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>openejb-ssh</artifactId> - <name>TomEE :: Server :: SSH</name> - - <properties> - <tomee.build.name>${project.groupId}.server.ssh</tomee.build.name> - </properties> - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>openejb-common-cli</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.sshd</groupId> - <artifactId>sshd-core</artifactId> - </dependency> - <dependency> - <groupId>jline</groupId> - <artifactId>jline</artifactId> - </dependency> - - <!-- dependencies we don't want to include in the zip --> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>openejb-core</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>openejb-server</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>org.bouncycastle</groupId> - <artifactId>bcpkix-jdk18on</artifactId> - <version>1.84</version> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <executions> - <execution> - <id>bin</id> - <phase>package</phase> - <goals> - <goal>single</goal> - </goals> - <configuration> - <descriptors> - <descriptor>src/main/assembly/ssh.xml</descriptor> - </descriptors> - <appendAssemblyId>false</appendAssemblyId> - <tarLongFileMode>gnu</tarLongFileMode> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> -</project> diff --git a/server/openejb-ssh/src/main/assembly/ssh.xml b/server/openejb-ssh/src/main/assembly/ssh.xml deleted file mode 100644 index 3197062673..0000000000 --- a/server/openejb-ssh/src/main/assembly/ssh.xml +++ /dev/null @@ -1,48 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<assembly> - <id>ssh</id> - <formats> - <format>tar.gz</format> - <format>zip</format> - </formats> - <fileSets> - <fileSet> - <directory>${project.basedir}/target</directory> - <includes> - <include>${project.artifactId}-${project.version}.${project.packaging}</include> - </includes> - <outputDirectory>/</outputDirectory> - </fileSet> - <fileSet> - <directory>${project.basedir}/target/classes/META-INF</directory> - <includes> - <include>LICENSE</include> - <include>NOTICE</include> - </includes> - <outputDirectory>/</outputDirectory> - </fileSet> - </fileSets> - <dependencySets> - <dependencySet> - <outputDirectory>/</outputDirectory> - <scope>runtime</scope> - </dependencySet> - </dependencySets> -</assembly> diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java deleted file mode 100644 index 3a55d446b9..0000000000 --- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBCommands.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.server.ssh; - -import org.apache.openejb.server.cli.CliRunnable; -import org.apache.sshd.server.Environment; -import org.apache.sshd.server.ExitCallback; -import org.apache.sshd.server.channel.ChannelSession; -import org.apache.sshd.server.command.Command; -import org.apache.sshd.server.session.ServerSession; -import org.apache.sshd.server.session.ServerSessionAware; - -import javax.security.auth.Subject; -import javax.security.auth.login.LoginContext; -import javax.security.auth.login.LoginException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.security.PrivilegedAction; - -public class OpenEJBCommands extends CliRunnable implements Command, Runnable, ServerSessionAware { - private ExitCallback cbk; - private LoginContext loginContext; - - public OpenEJBCommands(String bind, int port) { - super(bind, port, null, "\r\n"); - } - - @Override - public void setInputStream(InputStream in) { - super.setInputStream(in); - } - - @Override - public void setOutputStream(OutputStream out) { - super.setOutputStream(out); - } - - @Override - public void setErrorStream(OutputStream err) { - super.setErrorStream(err); - } - - @Override - public void destroy() { - super.destroy(); - } - - @Override - public void setExitCallback(ExitCallback callback) { - cbk = callback; - } - - @Override - public void run() { - if (loginContext == null) { - throw new IllegalStateException("No user logged"); - } - try { - Subject.doAs(loginContext.getSubject(), new PrivilegedAction<Object>() { - @Override - public Object run() { - OpenEJBCommands.super.run(); - return null; - } - }); - } finally { - try { - loginContext.logout(); - } catch (LoginException e) { - // ignored - } - cbk.onExit(0); - } - } - - @Override - public void setSession(final ServerSession session) { - final String username = session.getAttribute(OpenEJBJaasPasswordAuthenticator.USERNAME_KEY); - if (username == null) { - throw new IllegalStateException("No username in the session"); - } - - setUsername(username); - loginContext = session.getAttribute(OpenEJBJaasPasswordAuthenticator.LOGIN_CONTEXT_KEY); - } - - @Override - public void start(ChannelSession channelSession, Environment environment) throws IOException { - start(); - } - - @Override - public void destroy(ChannelSession channelSession) throws Exception { - destroy(); - } -} - diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java deleted file mode 100644 index 662b9ddfc8..0000000000 --- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBJaasPasswordAuthenticator.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.server.ssh; - -import org.apache.openejb.util.LogCategory; -import org.apache.openejb.util.Logger; -import org.apache.sshd.common.session.Session; -import org.apache.sshd.server.jaas.JaasPasswordAuthenticator; -import org.apache.sshd.server.session.ServerSession; - -import javax.security.auth.Subject; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; -import javax.security.auth.login.LoginContext; -import java.io.IOException; - -public class OpenEJBJaasPasswordAuthenticator extends JaasPasswordAuthenticator { - private static final Logger LOGGER = Logger.getInstance(LogCategory.OPENEJB_SERVER, OpenEJBJaasPasswordAuthenticator.class); - - public static final Session.AttributeKey<String> USERNAME_KEY = new Session.AttributeKey<>(); - public static final Session.AttributeKey<LoginContext> LOGIN_CONTEXT_KEY = new Session.AttributeKey<>(); - - @Override - public boolean authenticate(final String username, final String password, final ServerSession session) { - try { - final Subject subject = new Subject(); - final LoginContext loginContext = new LoginContext(getDomain(), subject, new CallbackHandler() { - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - for (final Callback callback : callbacks) { - if (callback instanceof NameCallback) { - ((NameCallback) callback).setName(username); - } else if (callback instanceof PasswordCallback) { - ((PasswordCallback) callback).setPassword(password.toCharArray()); - } else { - throw new UnsupportedCallbackException(callback); - } - } - } - }); - loginContext.login(); - - session.setAttribute(USERNAME_KEY, username); - session.setAttribute(LOGIN_CONTEXT_KEY, loginContext); - return true; - } catch (Exception e) { - LOGGER.debug("can't log using username '" + username + "'", e); - return false; - } - } -} diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java deleted file mode 100644 index 9971e80f7b..0000000000 --- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/OpenEJBShellFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.server.ssh; - -import org.apache.sshd.server.channel.ChannelSession; -import org.apache.sshd.server.command.Command; -import org.apache.sshd.server.shell.ShellFactory; - -public class OpenEJBShellFactory implements ShellFactory { - private final String bind; - private final int port; - - public OpenEJBShellFactory(String bind, int port) { - this.bind = bind; - this.port = port; - } - - @Override - public Command createShell(ChannelSession channelSession) { - return new OpenEJBCommands(bind, port); - } -} diff --git a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java b/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java deleted file mode 100644 index 1f2c33a094..0000000000 --- a/server/openejb-ssh/src/main/java/org/apache/openejb/server/ssh/SSHServer.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.server.ssh; - -import org.apache.openejb.loader.SystemInstance; -import org.apache.openejb.server.SelfManaging; -import org.apache.openejb.server.ServerService; -import org.apache.openejb.server.ServiceException; -import org.apache.sshd.common.util.security.SecurityUtils; -import org.apache.sshd.common.util.security.bouncycastle.BouncyCastleGeneratorHostKeyProvider; -import org.apache.sshd.server.SshServer; -import org.apache.sshd.server.jaas.JaasPasswordAuthenticator; -import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.Socket; -import java.util.Properties; - -public class SSHServer implements ServerService, SelfManaging { - private static final String KEY_NAME = SystemInstance.get().getOptions().get("openejb.server.ssh.key", "ssh-key"); - - private int port; - private String bind; - private String domain; - private SshServer sshServer; - - @Override - public void start() throws ServiceException { - sshServer = SshServer.setUpDefaultServer(); - sshServer.setPort(port); - sshServer.setHost(bind); - - final String basePath = SystemInstance.get().getBase().getDirectory().getAbsolutePath(); - if (SecurityUtils.isBouncyCastleRegistered()) { - sshServer.setKeyPairProvider(new BouncyCastleGeneratorHostKeyProvider(new File(basePath, KEY_NAME + ".pem").toPath())); - } else { - sshServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File(basePath, KEY_NAME + ".ser").toPath())); - } - - final OpenEJBShellFactory sf = new OpenEJBShellFactory(bind, port); - sshServer.setShellFactory(sf); - - final JaasPasswordAuthenticator authenticator = new OpenEJBJaasPasswordAuthenticator(); - authenticator.setDomain(domain); - sshServer.setPasswordAuthenticator(authenticator); - - try { - sshServer.start(); - } catch (IOException e) { - // no-op - } - } - - @Override - public void stop() throws ServiceException { - try { - sshServer.stop(); - } catch (Exception e) { - // no-op - } - } - - @Override - public void service(InputStream in, OutputStream out) throws ServiceException, IOException { - // no-op - } - - @Override - public void service(Socket socket) throws ServiceException, IOException { - // no-op - } - - @Override - public String getName() { - return "ssh"; - } - - @Override - public String getIP() { - return bind; - } - - @Override - public int getPort() { - return port; - } - - @Override - public void init(Properties props) throws Exception { - bind = props.getProperty("bind"); - domain = props.getProperty("domain"); - port = Integer.parseInt(props.getProperty("port")); - } - - public void setPort(int port) { - this.port = port; - } - - public void setDomain(String domain) { - this.domain = domain; - } - - public void setBind(String bind) { - this.bind = bind; - } -} diff --git a/server/openejb-ssh/src/main/resources/META-INF/LICENSE b/server/openejb-ssh/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 7a4a3ea242..0000000000 --- a/server/openejb-ssh/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/server/openejb-ssh/src/main/resources/META-INF/NOTICE b/server/openejb-ssh/src/main/resources/META-INF/NOTICE deleted file mode 100644 index bcfa76a9e4..0000000000 --- a/server/openejb-ssh/src/main/resources/META-INF/NOTICE +++ /dev/null @@ -1,10 +0,0 @@ -Apache OpenEJB -Copyright 1999-2026 The Apache Software Foundation - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). - -========================================================================= -Gson (https://code.google.com/p/google-gson/) - A Java library that can be used to convert Java Objects into their JSON representation -License: Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0.txt) -========================================================================= \ No newline at end of file diff --git a/server/openejb-ssh/src/main/resources/META-INF/org.apache.openejb.server.ServerService/ssh b/server/openejb-ssh/src/main/resources/META-INF/org.apache.openejb.server.ServerService/ssh deleted file mode 100644 index ad194677b7..0000000000 --- a/server/openejb-ssh/src/main/resources/META-INF/org.apache.openejb.server.ServerService/ssh +++ /dev/null @@ -1,5 +0,0 @@ -server = org.apache.openejb.server.ssh.SSHServer -bind = 127.0.0.1 -port = 4222 -domain = PropertiesLogin -disabled = ${openejb.profile.custom} diff --git a/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/Foo.java b/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/Foo.java deleted file mode 100644 index b48105587f..0000000000 --- a/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/Foo.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.server.ssh; - -import jakarta.ejb.Lock; -import jakarta.ejb.LockType; -import jakarta.ejb.Singleton; - -@Singleton -@Lock(LockType.READ) -public class Foo { - public String foo() { - return "foo"; - } -} diff --git a/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java b/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java deleted file mode 100644 index 661775b3d0..0000000000 --- a/server/openejb-ssh/src/test/java/org/apache/openejb/server/ssh/SSHServerTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.openejb.server.ssh; - -import org.apache.openejb.OpenEjbContainer; -import org.apache.openejb.config.DeploymentFilterable; -import org.apache.sshd.client.SshClient; -import org.apache.sshd.client.channel.ClientChannel; -import org.apache.sshd.client.channel.ClientChannelEvent; -import org.apache.sshd.client.session.ClientSession; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import jakarta.ejb.embeddable.EJBContainer; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.util.Collections; -import java.util.HashMap; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -public class SSHServerTest { - private static EJBContainer container; - - @BeforeClass - public static void start() { - System.setProperty("openejb.server.ssh.key", "src/test/key/ssh-key"); - System.setProperty("openejb.logger.external", "true"); - container = EJBContainer.createEJBContainer(new HashMap<Object, Object>() {{ - put(OpenEjbContainer.OPENEJB_EMBEDDED_REMOTABLE, "true"); - put(DeploymentFilterable.CLASSPATH_FILTER_SYSTEMAPPS, "false"); - }}); - } - - @AfterClass - public static void close() { - container.close(); - System.getProperties().remove("openejb.logger.external"); - System.getProperties().remove("openejb.server.ssh.key"); - } - - @Test(timeout = 10000L) - public void call() throws Exception { - final SshClient client = SshClient.setUpDefaultClient(); - client.start(); - try { - final ClientSession session = client.connect("jonathan", "localhost", 4222).verify().getSession(); - session.addPasswordIdentity("secret"); - session.auth().verify(); - - final ClientChannel channel = session.createChannel("shell"); - ByteArrayOutputStream sent = new ByteArrayOutputStream(); - PipedOutputStream pipedIn = new TeePipedOutputStream(sent); - channel.setIn(new PipedInputStream(pipedIn)); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - ByteArrayOutputStream err = new ByteArrayOutputStream(); - channel.setOut(out); - channel.setErr(err); - channel.open(); - - pipedIn.write("properties\r\n".getBytes()); - pipedIn.flush(); - - pipedIn.write("exit\r\n".getBytes()); - pipedIn.flush(); - - channel.waitFor(Collections.singleton(ClientChannelEvent.CLOSED), 0); - channel.close(false); - client.stop(); - - assertTrue(new String(sent.toByteArray()).contains("properties\r\nexit\r\n")); - assertTrue(new String(out.toByteArray()).contains("ServerService(id=ssh)")); - } catch (Exception e) { - e.printStackTrace(); - fail(); - } - } - - public static class TeePipedOutputStream extends PipedOutputStream { - private OutputStream tee; - - public TeePipedOutputStream(OutputStream tee) { - this.tee = tee; - } - - @Override - public void write(int b) throws IOException { - super.write(b); - tee.write(b); - } - - @Override - public void write(byte[] b, int off, int len) throws IOException { - super.write(b, off, len); - tee.write(b, off, len); - } - } -} diff --git a/server/openejb-ssh/src/test/key/ssh-key.ser b/server/openejb-ssh/src/test/key/ssh-key.ser deleted file mode 100644 index 768af8b606..0000000000 Binary files a/server/openejb-ssh/src/test/key/ssh-key.ser and /dev/null differ diff --git a/server/openejb-ssh/src/test/resources/META-INF/beans.xml b/server/openejb-ssh/src/test/resources/META-INF/beans.xml deleted file mode 100644 index 9126ae7927..0000000000 --- a/server/openejb-ssh/src/test/resources/META-INF/beans.xml +++ /dev/null @@ -1,19 +0,0 @@ -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<beans /> - diff --git a/server/pom.xml b/server/pom.xml index a70be79df9..fdf6729f85 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -45,7 +45,6 @@ <module>openejb-cxf-rs</module> <module>openejb-cxf-transport</module> <module>openejb-rest</module> - <module>openejb-ssh</module> <module>openejb-common-cli</module> <module>openejb-bonecp</module> <module>openejb-hessian</module>
