├── .gitignore ├── .travis.yml ├── LICENSE ├── NOTES ├── README.md ├── TODO ├── checkstyle-suppressions.xml ├── create_config.sh ├── pom.xml ├── src ├── main │ ├── filtered-resources │ │ └── VERSION.properties │ ├── java │ │ ├── com │ │ │ └── yahoo │ │ │ │ └── sshd │ │ │ │ ├── authentication │ │ │ │ ├── MultiUserPKAuthenticator.java │ │ │ │ └── file │ │ │ │ │ ├── AuthorizedKeysFileScanner.java │ │ │ │ │ ├── FileTreeWalkerInterface.java │ │ │ │ │ ├── HomeDirectoryScanningPKAuthenticator.java │ │ │ │ │ ├── HomeDirectoryScanningPKEventHandler.java │ │ │ │ │ ├── HomeDirectoryTreeWalker.java │ │ │ │ │ ├── LocalUserPKAuthenticator.java │ │ │ │ │ └── MultiUserAuthorizedKeysMap.java │ │ │ │ ├── authorization │ │ │ │ ├── ArtifactoryAuthorizer.java │ │ │ │ ├── ArtifactoryAuthorizerProviderFactory.java │ │ │ │ ├── ArtifactoryPermTargetType.java │ │ │ │ ├── WideOpenGatesAuthrorizer.java │ │ │ │ └── file │ │ │ │ │ ├── ArtifactoryAuthFileEventHandler.java │ │ │ │ │ ├── ArtifactoryAuthFileWalker.java │ │ │ │ │ ├── ArtifactoryAuthorizerFileScanner.java │ │ │ │ │ ├── AuthFileParser.java │ │ │ │ │ ├── AuthUser.java │ │ │ │ │ ├── DefaultArtifactoryAuthorizerProviderFactory.java │ │ │ │ │ ├── FileBasedArtifactoryAuthorizer.java │ │ │ │ │ └── PermTarget.java │ │ │ │ ├── common │ │ │ │ └── forward │ │ │ │ │ ├── DenyingTcpipForwarder.java │ │ │ │ │ └── DenyingTcpipForwarderFactory.java │ │ │ │ ├── server │ │ │ │ ├── SshServerWrapper.java │ │ │ │ ├── Sshd.java │ │ │ │ ├── TestCiphers.java │ │ │ │ ├── command │ │ │ │ │ ├── AbstractScpCommand.java │ │ │ │ │ ├── DefaultScpCommandFactory.java │ │ │ │ │ ├── DelegatingCommandFactory.java │ │ │ │ │ ├── MkdirCommand.java │ │ │ │ │ ├── NewScpCommand.java │ │ │ │ │ ├── NewScpHelper.java │ │ │ │ │ ├── NullScpCommand.java │ │ │ │ │ ├── NullScpCommandFactory.java │ │ │ │ │ └── ScpCommandSessionListener.java │ │ │ │ ├── filesystem │ │ │ │ │ ├── AFClientCache.java │ │ │ │ │ ├── ArtifactoryFileSystemFactory.java │ │ │ │ │ ├── ArtifactoryFileSystemView.java │ │ │ │ │ ├── ArtifactorySshFile.java │ │ │ │ │ ├── DevNullSshFile.java │ │ │ │ │ ├── GuiceFsFactory.java │ │ │ │ │ ├── InjectableArtifactoryFileSystemFactory.java │ │ │ │ │ └── NameLengthTuple.java │ │ │ │ ├── filters │ │ │ │ │ ├── DenyingForwardingFilter.java │ │ │ │ │ └── LocalForwardingFilter.java │ │ │ │ ├── jetty │ │ │ │ │ ├── JettyRunnableComponent.java │ │ │ │ │ ├── JettyServer.java │ │ │ │ │ └── JettyServiceSetting.java │ │ │ │ ├── logging │ │ │ │ │ ├── AbstractNCSARequestLog.java │ │ │ │ │ ├── ConfigurableRolloverOuputStream.java │ │ │ │ │ ├── DefaultRequestLogFactory.java │ │ │ │ │ ├── LoggingHelper.java │ │ │ │ │ ├── NCSARequestLog.java │ │ │ │ │ ├── RequestLogFactory.java │ │ │ │ │ ├── SshRequestHandler.java │ │ │ │ │ ├── SshRequestInfo.java │ │ │ │ │ ├── SshRequestLog.java │ │ │ │ │ ├── SshRequestLogListener.java │ │ │ │ │ └── SshRequestStatus.java │ │ │ │ ├── settings │ │ │ │ │ ├── SshdConfigurationException.java │ │ │ │ │ ├── SshdProxySettings.java │ │ │ │ │ ├── SshdProxySettingsFactory.java │ │ │ │ │ ├── SshdSettingsBuilder.java │ │ │ │ │ ├── SshdSettingsFactory.java │ │ │ │ │ ├── SshdSettingsInterface.java │ │ │ │ │ └── SshdSettingsModule.java │ │ │ │ └── shell │ │ │ │ │ ├── ForwardingShellFactory.java │ │ │ │ │ ├── ForwardingShellWrapper.java │ │ │ │ │ ├── GroovyShellFactory.java │ │ │ │ │ ├── GroovyShellWrapper.java │ │ │ │ │ ├── MessageShellFactory.java │ │ │ │ │ ├── SshProxyMessage.java │ │ │ │ │ └── groovy │ │ │ │ │ ├── GroovyPrompt.java │ │ │ │ │ └── OutputStreamErrorHandler.java │ │ │ │ ├── tools │ │ │ │ └── artifactory │ │ │ │ │ ├── ArtifactMetaData.java │ │ │ │ │ ├── ArtifactMetaDataBuilder.java │ │ │ │ │ ├── ArtifactMetaDataParseFailureException.java │ │ │ │ │ ├── ArtifactNotFoundException.java │ │ │ │ │ ├── ArtifactoryBadRequestException.java │ │ │ │ │ ├── ArtifactoryClientFactory.java │ │ │ │ │ ├── ArtifactoryExceptionInformation.java │ │ │ │ │ ├── ArtifactoryFileNotFoundException.java │ │ │ │ │ ├── ArtifactoryIOException.java │ │ │ │ │ ├── ArtifactoryInformation.java │ │ │ │ │ ├── ArtifactoryNoReadPermissionException.java │ │ │ │ │ ├── ArtifactoryNoWritePermissionException.java │ │ │ │ │ ├── Checksum.java │ │ │ │ │ ├── ChildArtifact.java │ │ │ │ │ ├── JFrogArtifactoryClientHelper.java │ │ │ │ │ ├── JFrogArtifactoryClientHelperFactoryImpl.java │ │ │ │ │ └── RepositoryAndPath.java │ │ │ │ └── utils │ │ │ │ ├── AuthUserData.java │ │ │ │ ├── DirectoryWatchService.java │ │ │ │ ├── DirectoryWatchServiceEventHandler.java │ │ │ │ ├── RunnableComponent.java │ │ │ │ ├── ThreadSafeSimpleDateFormat.java │ │ │ │ ├── ThreadUtils.java │ │ │ │ └── streams │ │ │ │ ├── AsyncHandler.java │ │ │ │ ├── AsyncHandlerImpl.java │ │ │ │ ├── AsyncPipedOutputStream.java │ │ │ │ ├── EmptyInputStream.java │ │ │ │ ├── EmptyOutputStream.java │ │ │ │ ├── InputStreamWithLength.java │ │ │ │ ├── InputStreamWithLengthInterface.java │ │ │ │ ├── LengthBasedInputStream.java │ │ │ │ └── MessageOutputStream.java │ │ └── org │ │ │ └── apache │ │ │ ├── karaf │ │ │ └── shell │ │ │ │ └── ssh │ │ │ │ └── KarafPublickeyAuthenticator.java │ │ │ └── sshd │ │ │ └── server │ │ │ ├── keyprovider │ │ │ ├── PEMHostKeyProvider.java │ │ │ ├── PEMHostKeyProviderFactory.java │ │ │ └── SshdPEMHostKeyProviderFactory.java │ │ │ └── shell │ │ │ ├── Shell.java │ │ │ ├── TtyFilterInputStream.java │ │ │ └── TtyFilterOutputStream.java │ └── resources │ │ ├── asynchttpclient.properties │ │ ├── logback.xml │ │ └── sshd_proxy.properties └── test │ ├── java │ ├── com │ │ └── yahoo │ │ │ └── sshd │ │ │ ├── authentication │ │ │ └── file │ │ │ │ ├── TestFileTreeWalker.java │ │ │ │ ├── TestLoader.java │ │ │ │ ├── TestLocalUserPKAuthenticator.java │ │ │ │ ├── TestPKAuth.java │ │ │ │ └── TestPKUpdating.java │ │ │ ├── authorization │ │ │ └── file │ │ │ │ ├── TestArtifactoryAuthorization.java │ │ │ │ ├── TestAuthFileParser.java │ │ │ │ └── TestAuthFileScanner.java │ │ │ ├── server │ │ │ ├── TestHostKey.java │ │ │ ├── command │ │ │ │ ├── TestNewScpCommand.java │ │ │ │ ├── TestNewScpHelper.java │ │ │ │ └── TestScpCommandSessionListener.java │ │ │ ├── filesystem │ │ │ │ ├── TestArtifactorySshFile.java │ │ │ │ └── TestNameLengthTuple.java │ │ │ ├── filters │ │ │ │ └── TestForwardingFilters.java │ │ │ ├── jetty │ │ │ │ └── TestJettyRunnable.java │ │ │ ├── logging │ │ │ │ ├── TestSshRequestInfoBuilder.java │ │ │ │ └── TestSshRequestLogListener.java │ │ │ ├── settings │ │ │ │ ├── TestChainedFactories.java │ │ │ │ ├── TestCipherFactories.java │ │ │ │ ├── TestOptions.java │ │ │ │ └── Utils.java │ │ │ └── shell │ │ │ │ └── TestMessageShellFactory.java │ │ │ ├── tools │ │ │ └── artifactory │ │ │ │ ├── TestArtifactoryMetaData.java │ │ │ │ ├── TestExceptions.java │ │ │ │ ├── TestFormat.java │ │ │ │ ├── TestJFrogArtifactoryClientHelper.java │ │ │ │ ├── TestRepoStripping.java │ │ │ │ └── TestRepositoryAndPath.java │ │ │ └── utils │ │ │ └── streams │ │ │ ├── StreamsUtils.java │ │ │ ├── TestEmptyStream.java │ │ │ ├── TestInputStreamWithLength.java │ │ │ ├── TestLengthBasedInputStream.java │ │ │ └── TestMessageOutputStream.java │ └── org │ │ └── apache │ │ ├── karaf │ │ └── shell │ │ │ └── ssh │ │ │ └── TestKarafPublickeyAuthenticator.java │ │ └── sshd │ │ └── common │ │ └── kex │ │ └── TestDH.java │ └── resources │ ├── MultiUserPKAuthenticator │ ├── dir_test │ │ └── home │ │ │ └── dir_test │ │ │ └── .ssh │ │ │ └── authorized_keys │ │ │ └── empty_dir │ ├── empty_home │ │ └── empty_dir │ └── home │ │ ├── areese │ │ ├── .ssh │ │ │ ├── authorized_keys │ │ │ └── bar │ │ ├── bar │ │ └── foo_dir │ │ │ └── bar │ │ ├── bob │ │ └── .ssh │ │ │ └── authorized_keys │ │ └── sam │ │ └── .ssh │ │ └── authorized_keys │ ├── alwaysempty │ └── empty │ ├── auth │ └── auth.txt │ ├── conf │ ├── debug.properties │ └── sshd_proxy │ │ ├── .gitkeep │ │ ├── sshd_proxy.properties │ │ └── test_env_mapping.properties │ ├── developer_config │ └── sshd_proxy.properties │ ├── hostkey.pem │ ├── invalid_keys │ ├── test_ssh_key-0 │ ├── test_ssh_key-0.pub │ ├── test_ssh_key-1 │ ├── test_ssh_key-1.pub │ ├── test_ssh_key-2 │ ├── test_ssh_key-2.pub │ ├── test_ssh_key-3 │ ├── test_ssh_key-3.pub │ ├── test_ssh_key-4 │ ├── test_ssh_key-4.pub │ ├── test_ssh_key-5 │ ├── test_ssh_key-5.pub │ ├── test_ssh_key-6 │ ├── test_ssh_key-6.pub │ ├── test_ssh_key-7 │ ├── test_ssh_key-7.pub │ ├── test_ssh_key-8 │ ├── test_ssh_key-8.pub │ ├── test_ssh_key-9 │ └── test_ssh_key-9.pub │ ├── json │ ├── directory.json │ ├── empty.json │ ├── file.json │ └── parent_directory.json │ ├── keys │ ├── test_ssh_key-0 │ ├── test_ssh_key-0.pub │ ├── test_ssh_key-1 │ ├── test_ssh_key-1.pub │ ├── test_ssh_key-10 │ ├── test_ssh_key-10.pub │ ├── test_ssh_key-11 │ ├── test_ssh_key-11.pub │ ├── test_ssh_key-12 │ ├── test_ssh_key-12.pub │ ├── test_ssh_key-13 │ ├── test_ssh_key-13.pub │ ├── test_ssh_key-14 │ ├── test_ssh_key-14.pub │ ├── test_ssh_key-15 │ ├── test_ssh_key-15.pub │ ├── test_ssh_key-16 │ ├── test_ssh_key-16.pub │ ├── test_ssh_key-17 │ ├── test_ssh_key-17.pub │ ├── test_ssh_key-18 │ ├── test_ssh_key-18.pub │ ├── test_ssh_key-19 │ ├── test_ssh_key-19.pub │ ├── test_ssh_key-2 │ ├── test_ssh_key-2.pub │ ├── test_ssh_key-3 │ ├── test_ssh_key-3.pub │ ├── test_ssh_key-4 │ ├── test_ssh_key-4.pub │ ├── test_ssh_key-5 │ ├── test_ssh_key-5.pub │ ├── test_ssh_key-6 │ ├── test_ssh_key-6.pub │ ├── test_ssh_key-7 │ ├── test_ssh_key-7.pub │ ├── test_ssh_key-8 │ ├── test_ssh_key-8.pub │ ├── test_ssh_key-9 │ └── test_ssh_key-9.pub │ └── nested │ └── home │ └── areese │ ├── .ssh │ └── authorized_keys │ └── nested │ └── home │ └── areese │ └── .ssh │ └── authorized_keys └── travis └── publish_to_bintray.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | .settings 3 | .classpath 4 | .project 5 | target 6 | .gradle 7 | *.swp 8 | 9 | # Package Files # 10 | *.jar 11 | *.war 12 | *.ear 13 | *.tgz 14 | .clover 15 | test-output 16 | 17 | 18 | dependency-reduced-pom.xml 19 | 20 | # config for running developers 21 | developer_config 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - oraclejdk8 5 | 6 | after_success: 7 | - test "${TRAVIS_JDK_VERSION}" == "oraclejdk8" && mvn javadoc:jar 8 | - test "${TRAVIS_PULL_REQUEST}" == "false" && test "${TRAVIS_TAG}" != "" && ./travis/publish_to_bintray.sh 9 | 10 | branches: 11 | only: 12 | - master 13 | - /^(?i:sshd_proxy)-.*$/ 14 | 15 | env: 16 | global: 17 | - secure: KVFZIMNqNr6IgGQFfUItvEwLoKoDiMLZPWrHs3DNWGgXXYTCNQdeETQmcZ6H6dy8fypPk2YKJnyNc5Vwnt9m8F19A6aR3cQL0d86zrGGyrayUvVVlYcpdKpVRgHqpOj6L+fi8amZhNIKG7Nnn5MqfjkBx89I8yo5HLuMNh4XM7A= 18 | - secure: Lf4CIwsDhltD9d48c/qMt8UHB7UrA2x7RatyD99t6LgfQKyBtHz2V2+DbbB7RewnJDV8C4hUNK21qIj6MOrDJM0cW9iUXlSJypdV8TjN0/NHHURkFVhpxK2cFghArVysmbWq05lRgkTjwniCI+hlLdpNdx6D/KfRgegvWI8mBNs= 19 | -------------------------------------------------------------------------------- /NOTES: -------------------------------------------------------------------------------- 1 | To eat the auth. 2 | 3 | 4 | Need to set the channelFactories: 5 | 6 | ssh.setChannelFactories(channelFactories); 7 | 8 | 9 | if (channelFactories == null) { 10 | channelFactories = Arrays.asList( 11 | new ChannelSession.Factory(), 12 | new TcpipServerChannel.DirectTcpipFactory()); 13 | } 14 | 15 | 16 | Need to override TcpipServerChannel.DirectTcpipFactory and friends. 17 | 18 | Need to override the IOServiceFactory: 19 | org.apache.sshd.common.forward.TcpipServerChannel 20 | 21 | connector = getSession().getFactoryManager().getIoServiceFactory() 22 | .createConnector(handler); 23 | 24 | Which returns org.apache.sshd.common.io.nio2.Nio2ServiceFactory, which we need to override 25 | To override org.apache.sshd.common.io.nio2.Nio2Connector, which returns an org.apache.sshd.common.io.nio2.Nio2Session 26 | 27 | Which is where we can finally start eating bytes 28 | and worse. 29 | 30 | The bytes we need to eat may come across multiple writes, so we'll have to set a start eating and stop eating flag across peeks. 31 | 32 | This will get really Ugly because if Authorization comes as multiple packets, we'll have to buffer that bit somewhere. 33 | 34 | Basically we need to buffer at least the Authorization header: 35 | WWW-Authenticate: Basic realm="nmrs_m7VKmomQ2YM3:" 36 | 37 | So we need at a minimum a buffer of WWW-Authenticate: size, and if we read WWW-AuthFoo, then we can write that buffer, and the rest of the following bits, while the previous writes would have been no-ops causing latency. 38 | 39 | Worse, yet we need a secondary buffer which is looking for the \r\n\r\n ala cheap-alive, and we need to eat that and write out our auth bits, then write the \r\n\r\n 40 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 2 | For auth override the following are required: 3 | 4 | 1. tcp port forwarding of port X to artifactory host:port. 5 | 2. Stream sniffing, we need to read the byte from the stream stripping out any Authorization headers. 6 | 3. Add the authorization header where it's: ssh_user:encrypted password. 7 | 4. encrypted password comes from encrypting a salt and the username. 8 | Another option is to just pass a token, and then have an artifactory plugin verify the token 9 | by connecting back to the ssh server, but that adds an extra RT. 10 | 5. if in the same jvm 4 may change to be more secure. 11 | 6. write a plugin to validate the password. -------------------------------------------------------------------------------- /checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /create_config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script is used to one time create the config directory for development setup. 3 | ROOT=developer_config 4 | 5 | # gack die ROOT die. 6 | mkdir -p $ROOT/conf/sshd_proxy/ 7 | mkdir -p $ROOT/logs/sshd_proxy 8 | 9 | # put the artifactory war here. 10 | mkdir -p $ROOT/webapps/ 11 | 12 | # create the hostkey 13 | ssh-keygen -t dsa -f $ROOT/conf/sshd_proxy/ssh_host_dsa_key -C '' -N '' 14 | 15 | # copy the properties file 16 | cp src/test/resources/developer_config/sshd_proxy.properties $ROOT/conf/sshd_proxy/sshd_proxy.properties 17 | 18 | # fix ROOT to be our root. 19 | sed -i '' -e s/\$ROOT/$ROOT/g $ROOT/conf/sshd_proxy/sshd_proxy.properties 20 | -------------------------------------------------------------------------------- /src/main/filtered-resources/VERSION.properties: -------------------------------------------------------------------------------- 1 | version=${pom.version} 2 | build.date=${timestamp} 3 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authentication/MultiUserPKAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authentication; 14 | 15 | import java.io.IOException; 16 | import java.security.PublicKey; 17 | import java.util.Collection; 18 | 19 | import org.apache.sshd.server.PublickeyAuthenticator; 20 | import org.apache.sshd.server.session.ServerSession; 21 | 22 | import com.yahoo.sshd.utils.DirectoryWatchService; 23 | 24 | public interface MultiUserPKAuthenticator extends PublickeyAuthenticator { 25 | 26 | /** 27 | * Called on initial load to start any tasks that will keep the authenticator up to date. Most implementations use 28 | * this to start a {@link DirectoryWatchService} which watches for changes. 29 | * 30 | * @throws IOException 31 | */ 32 | void start() throws IOException; 33 | 34 | /** 35 | * Authenticate a user in the map 36 | * 37 | * @param username 38 | * @param publicKey 39 | * @param session 40 | * @return 41 | */ 42 | @Override 43 | boolean authenticate(String username, PublicKey publicKey, ServerSession session); 44 | 45 | /** 46 | * If this returns <1, the loading code assumes and error and fails startup. 47 | * 48 | * @return the number of keys loaded. 49 | */ 50 | int getNumberOfKeysLoads(); 51 | 52 | /** 53 | * List all of the users this map contains 54 | */ 55 | Collection getUsers(); 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authentication/file/FileTreeWalkerInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authentication.file; 14 | 15 | import java.io.IOException; 16 | import java.nio.file.Path; 17 | 18 | import com.yahoo.sshd.utils.DirectoryWatchService; 19 | 20 | /** 21 | * This interface is for listening for events from {@link DirectoryWatchService}. 22 | * {@link FileTreeWalkerInterface#registerAll(Path)} is used to register a direcotry 23 | * @author areese 24 | * 25 | */ 26 | public interface FileTreeWalkerInterface { 27 | void registerAll(final Path start) throws IOException; 28 | 29 | void register(Path dir) throws IOException; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/ArtifactoryAuthorizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization; 14 | 15 | 16 | public interface ArtifactoryAuthorizer { 17 | 18 | public boolean authorized(String repositoryName, String userName, ArtifactoryPermTargetType permissionTarget); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/ArtifactoryAuthorizerProviderFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization; 14 | 15 | import com.yahoo.sshd.server.settings.SshdSettingsInterface; 16 | 17 | public interface ArtifactoryAuthorizerProviderFactory { 18 | 19 | ArtifactoryAuthorizer artifactoryAuthorizerProvider(SshdSettingsInterface settings); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/ArtifactoryPermTargetType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization; 14 | 15 | public enum ArtifactoryPermTargetType { 16 | READ("read"), // 17 | WRITE("write"); // 18 | 19 | public String name; 20 | 21 | private ArtifactoryPermTargetType(String name) { 22 | this.name = name; 23 | } 24 | 25 | public static ArtifactoryPermTargetType parseType(String type) { 26 | if (READ.name.equalsIgnoreCase(type)) { 27 | return READ; 28 | } 29 | 30 | if (WRITE.name.equalsIgnoreCase(type)) { 31 | return WRITE; 32 | } 33 | 34 | throw new IllegalArgumentException("Unknown ArtifactoryPermTargetType: " + type); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/WideOpenGatesAuthrorizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization; 14 | 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | 18 | import com.yahoo.sshd.authorization.file.FileBasedArtifactoryAuthorizer; 19 | import com.yahoo.sshd.server.settings.SshdSettingsInterface; 20 | 21 | /** 22 | * Added this to make doing dev work a lot less painful. I don't want to setup an auth.txt for doing local development, 23 | * so add a flag. The problem is, we probably should flag this separately, because later we might create a developer 24 | * version that hosts more bits. When that is done, we'll have to rethink this. 25 | * 26 | * @author areese 27 | * 28 | */ 29 | public class WideOpenGatesAuthrorizer implements ArtifactoryAuthorizer { 30 | private static final Logger LOG = LoggerFactory.getLogger(FileBasedArtifactoryAuthorizer.class); 31 | 32 | public WideOpenGatesAuthrorizer(SshdSettingsInterface settings) { 33 | 34 | } 35 | 36 | @Override 37 | public boolean authorized(String repositoryName, String userName, ArtifactoryPermTargetType permissionTarget) { 38 | LOG.info("Development mode, blindly allowing user: '{}' access to repo: '{}' with target '{}", userName, 39 | repositoryName, permissionTarget); 40 | return true; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/file/ArtifactoryAuthFileWalker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization.file; 14 | 15 | import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; 16 | import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; 17 | import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; 18 | 19 | import java.io.File; 20 | import java.io.IOException; 21 | import java.nio.file.Path; 22 | import java.nio.file.WatchKey; 23 | import java.nio.file.WatchService; 24 | import java.util.Map; 25 | import java.util.concurrent.ConcurrentHashMap; 26 | 27 | import org.slf4j.Logger; 28 | import org.slf4j.LoggerFactory; 29 | 30 | import com.yahoo.sshd.authentication.file.FileTreeWalkerInterface; 31 | 32 | public class ArtifactoryAuthFileWalker implements FileTreeWalkerInterface { 33 | private static final Logger LOGGER = LoggerFactory.getLogger(ArtifactoryAuthFileWalker.class); 34 | 35 | private final WatchService watchService; 36 | private final Map watchKeys; 37 | private final File watchedDirectory; 38 | private final ConcurrentHashMap authorizationHashMap; 39 | 40 | public ArtifactoryAuthFileWalker(final WatchService watchService, final Map watchKeys, 41 | final File watchedDirectory, ConcurrentHashMap authorizationHashMap) { 42 | this.watchService = watchService; 43 | this.watchKeys = watchKeys; 44 | this.watchedDirectory = watchedDirectory; 45 | this.authorizationHashMap = authorizationHashMap; 46 | } 47 | 48 | @Override 49 | public void registerAll(Path dir) throws IOException { 50 | WatchKey key = dir.register(watchService, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY); 51 | if (LOGGER.isDebugEnabled()) { 52 | Path prev = watchKeys.get(key); 53 | if (prev == null) { 54 | LOGGER.debug("register: {} ", dir); 55 | } else { 56 | if (!dir.equals(prev)) { 57 | LOGGER.debug("update: {} -> {}", prev, dir); 58 | } 59 | } 60 | } 61 | 62 | watchKeys.put(key, dir); 63 | AuthFileParser.parse(watchedDirectory.getAbsolutePath(), authorizationHashMap); 64 | } 65 | 66 | @Override 67 | public void register(Path dir) throws IOException { 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/file/AuthUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization.file; 14 | 15 | public class AuthUser { 16 | 17 | private final String userName; 18 | private boolean read = true; 19 | private boolean write = false; 20 | private boolean all = false; 21 | 22 | public AuthUser(final String userName) { 23 | this.userName = userName; 24 | if ("*".equals(userName)) { 25 | this.all = true; 26 | } 27 | } 28 | 29 | public boolean isRead() { 30 | return read; 31 | } 32 | 33 | public void setRead(boolean read) { 34 | this.read = read; 35 | } 36 | 37 | public boolean isWrite() { 38 | return write; 39 | } 40 | 41 | public void setWrite(boolean write) { 42 | this.write = write; 43 | } 44 | 45 | /** 46 | * 47 | * @return true if this is a wildcard user. 48 | */ 49 | public boolean isAll() { 50 | return all; 51 | } 52 | 53 | public void setAll(boolean all) { 54 | this.all = all; 55 | } 56 | 57 | public String getUserName() { 58 | return userName; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/file/DefaultArtifactoryAuthorizerProviderFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization.file; 14 | 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | 18 | import com.yahoo.sshd.authorization.ArtifactoryAuthorizer; 19 | import com.yahoo.sshd.authorization.ArtifactoryAuthorizerProviderFactory; 20 | import com.yahoo.sshd.authorization.WideOpenGatesAuthrorizer; 21 | import com.yahoo.sshd.server.settings.SshdSettingsInterface; 22 | 23 | public class DefaultArtifactoryAuthorizerProviderFactory implements ArtifactoryAuthorizerProviderFactory { 24 | private static final Logger LOG = LoggerFactory.getLogger(FileBasedArtifactoryAuthorizer.class); 25 | 26 | @Override 27 | public ArtifactoryAuthorizer artifactoryAuthorizerProvider(SshdSettingsInterface settings) { 28 | if (settings.isDevelopementMode()) { 29 | LOG.warn("Running in developement mode, many checks are disabled"); 30 | return new WideOpenGatesAuthrorizer(settings); 31 | } 32 | 33 | return new FileBasedArtifactoryAuthorizer(settings); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/authorization/file/PermTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization.file; 14 | 15 | import java.util.concurrent.ConcurrentHashMap; 16 | 17 | import org.slf4j.Logger; 18 | import org.slf4j.LoggerFactory; 19 | 20 | public class PermTarget { 21 | 22 | private static final Logger LOG = LoggerFactory.getLogger(PermTarget.class); 23 | 24 | private final ConcurrentHashMap authUsers = new ConcurrentHashMap(); 25 | 26 | public boolean userExists(String userName) { 27 | return authUsers.containsKey(userName); 28 | } 29 | 30 | public boolean canRead(String userName) { 31 | final AuthUser allUser = authUsers.get("*"); 32 | if (allUser != null && allUser.isAll() && allUser.isRead()) { 33 | // allowing read for all users 34 | if (LOG.isDebugEnabled()) { 35 | LOG.debug("Allowed to read for all users."); 36 | } 37 | return true; 38 | } 39 | final AuthUser user = authUsers.get(userName); 40 | if (user == null) { 41 | if (LOG.isDebugEnabled()) { 42 | LOG.debug("User name {} not found.", userName); 43 | } 44 | return false; 45 | } 46 | return user.isRead(); 47 | } 48 | 49 | public boolean canWrite(String userName) { 50 | final AuthUser allUser = authUsers.get("*"); 51 | if (allUser != null && allUser.isAll() && allUser.isWrite()) { 52 | // allowing write for all users 53 | if (LOG.isDebugEnabled()) { 54 | LOG.debug("Allowed to write for all users."); 55 | } 56 | return true; 57 | } 58 | final AuthUser user = authUsers.get(userName); 59 | if (user == null) { 60 | if (LOG.isDebugEnabled()) { 61 | LOG.debug("User name {} not found.", userName); 62 | } 63 | return false; 64 | } 65 | return user.isWrite(); 66 | } 67 | 68 | public void addUser(AuthUser authUser) { 69 | authUsers.put(authUser.getUserName(), authUser); 70 | } 71 | 72 | public AuthUser getUser(String userName) { 73 | return authUsers.get(userName); 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/common/forward/DenyingTcpipForwarderFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.common.forward; 14 | 15 | import org.apache.sshd.common.TcpipForwarder; 16 | import org.apache.sshd.common.TcpipForwarderFactory; 17 | import org.apache.sshd.common.session.ConnectionService; 18 | 19 | /** 20 | * A denying {@link TcpipForwarderFactory} implementation. 21 | * 22 | * @see DenyingTcpipForwarder 23 | */ 24 | public class DenyingTcpipForwarderFactory implements TcpipForwarderFactory { 25 | @Override 26 | public TcpipForwarder create(ConnectionService service) { 27 | return new DenyingTcpipForwarder(service); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/TestCiphers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server; 14 | 15 | import java.util.Collections; 16 | import java.util.List; 17 | 18 | import org.apache.sshd.common.Cipher; 19 | import org.apache.sshd.common.NamedFactory; 20 | 21 | import com.yahoo.sshd.server.settings.SshdProxySettings; 22 | 23 | public class TestCiphers { 24 | public static void main(String[] args) throws Exception { 25 | List> list = SshdProxySettings.createCipherFactoryList(Collections.emptyList()); 26 | System.err.println("length: " + list.size()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/command/DelegatingCommandFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.command; 14 | 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | import org.apache.sshd.server.CommandFactory; 19 | 20 | import com.yahoo.sshd.server.logging.SshRequestLog; 21 | 22 | public abstract class DelegatingCommandFactory implements CommandFactory { 23 | 24 | protected CommandFactory delegate; 25 | protected SshRequestLog requestLog; 26 | protected Map envToAfPropertyMapping = new HashMap<>(); 27 | 28 | 29 | public DelegatingCommandFactory() { 30 | this(null); 31 | } 32 | 33 | public DelegatingCommandFactory(CommandFactory delegate) { 34 | this.delegate = delegate; 35 | } 36 | 37 | public CommandFactory setDelegate(CommandFactory cf) { 38 | this.delegate = cf; 39 | return cf; 40 | } 41 | 42 | public CommandFactory getDelegate() { 43 | return delegate; 44 | } 45 | 46 | public SshRequestLog getRequestLog() { 47 | return requestLog; 48 | } 49 | 50 | public void setRequestLog(SshRequestLog requestLog) { 51 | this.requestLog = requestLog; 52 | } 53 | 54 | public Map getEnvToAfPropertyMapping() { 55 | return envToAfPropertyMapping; 56 | } 57 | 58 | public void setEnvToAfPropertyMapping(Map envToAfPropertyMapping) { 59 | this.envToAfPropertyMapping = new HashMap<>(envToAfPropertyMapping); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/command/NewScpCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | /* Some portions of this code are Copyright (c) 2014, Yahoo! Inc. All rights reserved. */ 14 | package com.yahoo.sshd.server.command; 15 | 16 | import java.io.IOException; 17 | import java.util.Map; 18 | 19 | import org.apache.sshd.server.Environment; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | import com.yahoo.sshd.server.logging.SshRequestLog; 24 | 25 | /** 26 | * This commands provide SCP support on both server and client side. Permissions and preservation of access / 27 | * modification times on files are not supported. 28 | * 29 | * @author Apache MINA SSHD Project 30 | */ 31 | /** 32 | * This was adapted from ScpCommand. It is an implementation of AbstractScpCommand, which contains the parts that were 33 | * removed from ScpCommand when making AbstractScpCommand 34 | * 35 | * @author areese 36 | * 37 | */ 38 | public class NewScpCommand extends AbstractScpCommand { 39 | protected static final Logger LOGGER = LoggerFactory.getLogger(NewScpCommand.class); 40 | private final SshRequestLog requestLog; 41 | 42 | public NewScpCommand(String args, SshRequestLog requestLog, Map envToAfPropertyMapping) { 43 | super(args, envToAfPropertyMapping); 44 | this.requestLog = requestLog; 45 | } 46 | 47 | @Override 48 | protected SshRequestLog getSshRequestLog() { 49 | return requestLog; 50 | } 51 | 52 | @Override 53 | public void start(Environment env) throws IOException { 54 | super.start(env); 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/command/NullScpCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.command; 14 | 15 | import java.util.HashMap; 16 | 17 | import org.slf4j.Logger; 18 | import org.slf4j.LoggerFactory; 19 | 20 | import com.yahoo.sshd.server.logging.SshRequestLog; 21 | 22 | /** 23 | * This class exists as a dummy test so we can test the speed of doing nothing. 24 | * 25 | * @author areese 26 | * 27 | */ 28 | public class NullScpCommand extends AbstractScpCommand { 29 | protected static final Logger LOGGER = LoggerFactory.getLogger(NullScpCommand.class); 30 | 31 | public NullScpCommand(String args) { 32 | super(args, new HashMap()); 33 | } 34 | 35 | @Override 36 | protected SshRequestLog getSshRequestLog() { 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/command/NullScpCommandFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.command; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import org.apache.sshd.server.Command; 19 | import org.apache.sshd.server.CommandFactory; 20 | 21 | @Deprecated 22 | public class NullScpCommandFactory extends DelegatingCommandFactory { 23 | 24 | public NullScpCommandFactory() { 25 | 26 | } 27 | 28 | public NullScpCommandFactory(CommandFactory delegate) { 29 | super(delegate); 30 | } 31 | 32 | /** 33 | * Parses a command string and verifies that the basic syntax is correct. If parsing fails the responsibility is 34 | * delegated to the configured {@link CommandFactory} instance; if one exist. 35 | * 36 | * @param command command to parse 37 | * @return configured {@link Command} instance 38 | * @throws IllegalArgumentException 39 | */ 40 | @Override 41 | public Command createCommand(String command) { 42 | try { 43 | return new NullScpCommand(command); 44 | } catch (IllegalArgumentException iae) { 45 | if (delegate != null) { 46 | return delegate.createCommand(command); 47 | } 48 | throw iae; 49 | } 50 | } 51 | 52 | public static String[] splitCommandString(String mustBe, String command) { 53 | if (!command.trim().startsWith(mustBe)) { 54 | throw new IllegalArgumentException("Unknown command, does not begin with '" + mustBe + "'"); 55 | } 56 | 57 | String[] args = command.split(" "); 58 | List parts = new ArrayList(); 59 | parts.add(args[0]); 60 | for (int i = 1; i < args.length; i++) { 61 | if (!args[i].trim().startsWith("-")) { 62 | parts.add(concatenateWithSpace(args, i)); 63 | break; 64 | } else { 65 | parts.add(args[i]); 66 | } 67 | } 68 | return parts.toArray(new String[parts.size()]); 69 | } 70 | 71 | public static String concatenateWithSpace(String[] args, int from) { 72 | StringBuilder sb = new StringBuilder(); 73 | 74 | for (int i = from; i < args.length; i++) { 75 | sb.append(args[i] + " "); 76 | } 77 | return sb.toString().trim(); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/command/ScpCommandSessionListener.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.sshd.server.command; 2 | 3 | import org.apache.sshd.common.Session; 4 | import org.apache.sshd.common.SessionListener; 5 | import org.apache.sshd.server.session.ServerSession; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | 9 | /** 10 | * This class is used to monitor the session close event for a ScpCommand Object so that it can clean up the ScpCommand 11 | * when the session is closed. 12 | * 13 | * @author adam701 on 9/29/15. 14 | */ 15 | public class ScpCommandSessionListener implements SessionListener { 16 | 17 | private static final Logger LOGGER = LoggerFactory.getLogger(ScpCommandSessionListener.class); 18 | private final Thread threadRunningScpCommand; 19 | 20 | public ScpCommandSessionListener(final Thread threadRunningScpCommand) { 21 | this.threadRunningScpCommand = threadRunningScpCommand; 22 | } 23 | 24 | public void registerSession(ServerSession session) { 25 | session.addListener(this); 26 | } 27 | 28 | @Override 29 | public void sessionCreated(Session session) { 30 | } 31 | 32 | @Override 33 | public void sessionEvent(Session session, Event event) { 34 | } 35 | 36 | @Override 37 | public void sessionClosed(Session session) { 38 | if (LOGGER.isDebugEnabled()) { 39 | LOGGER.debug("Session is closed. Try to interrupt the downloading thread if it is still blocked."); 40 | } 41 | 42 | if (null != this.threadRunningScpCommand) { 43 | this.threadRunningScpCommand.interrupt(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filesystem/AFClientCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filesystem; 14 | 15 | import org.slf4j.Logger; 16 | import org.slf4j.LoggerFactory; 17 | 18 | import com.google.common.cache.CacheBuilder; 19 | import com.google.common.cache.CacheLoader; 20 | import com.google.common.cache.LoadingCache; 21 | import com.yahoo.sshd.tools.artifactory.ArtifactoryClientFactory; 22 | import com.yahoo.sshd.tools.artifactory.ArtifactoryInformation; 23 | import com.yahoo.sshd.tools.artifactory.JFrogArtifactoryClientHelper; 24 | 25 | public class AFClientCache implements ArtifactoryClientFactory { 26 | private static final Logger LOGGER = LoggerFactory.getLogger(AFClientCache.class); 27 | private static final int CLIENT_CACHE_SIZE = 10; 28 | protected LoadingCache cache; 29 | protected ArtifactoryClientFactory clientFactory; 30 | protected ArtifactoryInformation afInfo; 31 | 32 | public AFClientCache(final ArtifactoryInformation inAfInfo, final ArtifactoryClientFactory inClientFactory) { 33 | this.clientFactory = inClientFactory; 34 | this.afInfo = inAfInfo; 35 | LOGGER.info("Setting up cache for Artifactory Client with max size " + CLIENT_CACHE_SIZE); 36 | this.cache = 37 | CacheBuilder.newBuilder().maximumSize(CLIENT_CACHE_SIZE) 38 | .build(new CacheLoader() { 39 | @Override 40 | public JFrogArtifactoryClientHelper load(final String repositoryName) { 41 | // no checked exception 42 | if (LOGGER.isDebugEnabled()) { 43 | LOGGER.debug("Creating new Artifactory Client for repository " 44 | + repositoryName); 45 | } 46 | return clientFactory.createJFrogClientHelper(afInfo, repositoryName); 47 | } 48 | }); 49 | } 50 | 51 | @Override 52 | public JFrogArtifactoryClientHelper createJFrogClientHelper(ArtifactoryInformation afInfo, String repositoryName) { 53 | return cache.getUnchecked(repositoryName); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filesystem/ArtifactoryFileSystemFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filesystem; 14 | 15 | import org.apache.sshd.common.Session; 16 | import org.apache.sshd.common.file.FileSystemView; 17 | import org.apache.sshd.common.file.nativefs.NativeFileSystemFactory; 18 | 19 | import com.yahoo.sshd.authorization.ArtifactoryAuthorizer; 20 | import com.yahoo.sshd.tools.artifactory.ArtifactoryInformation; 21 | 22 | public class ArtifactoryFileSystemFactory extends NativeFileSystemFactory implements 23 | InjectableArtifactoryFileSystemFactory { 24 | protected ArtifactoryInformation afInfo; 25 | protected ArtifactoryAuthorizer artifactoryAuthorizer; 26 | 27 | public ArtifactoryFileSystemFactory() { 28 | 29 | } 30 | 31 | @Override 32 | public void setAfInfo(final ArtifactoryInformation afInfo) { 33 | this.afInfo = afInfo; 34 | } 35 | 36 | @Override 37 | public void setArtifactoryAuthorizer(ArtifactoryAuthorizer artifactoryAuthorizer) { 38 | this.artifactoryAuthorizer = artifactoryAuthorizer; 39 | 40 | } 41 | 42 | /** 43 | * Create the appropriate user file system view. 44 | */ 45 | @Override 46 | public FileSystemView createFileSystemView(final Session session) { 47 | final String userName = session.getUsername(); 48 | return new ArtifactoryFileSystemView(afInfo, userName, isCaseInsensitive(), artifactoryAuthorizer); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filesystem/GuiceFsFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filesystem; 14 | 15 | import org.apache.sshd.common.file.FileSystemFactory; 16 | 17 | import com.yahoo.sshd.tools.artifactory.ArtifactoryInformation; 18 | 19 | public interface GuiceFsFactory { 20 | FileSystemFactory create(final ArtifactoryInformation afInfo); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filesystem/InjectableArtifactoryFileSystemFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filesystem; 14 | 15 | import org.apache.sshd.common.file.FileSystemFactory; 16 | 17 | import com.yahoo.sshd.authorization.ArtifactoryAuthorizer; 18 | import com.yahoo.sshd.tools.artifactory.ArtifactoryInformation; 19 | 20 | public interface InjectableArtifactoryFileSystemFactory extends FileSystemFactory { 21 | 22 | void setAfInfo(ArtifactoryInformation afInfo); 23 | 24 | void setArtifactoryAuthorizer(ArtifactoryAuthorizer artifactoryAuthorizerProvider); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filesystem/NameLengthTuple.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filesystem; 14 | 15 | /** 16 | * This is a simple class for keeping track of a name, length and perms tuple from an ssh based file. 17 | * 18 | * The ssh protocol sends these all together, and to easily delegate it's nice to hang onto them this way. 19 | * 20 | * @author areese 21 | * 22 | */ 23 | public class NameLengthTuple { 24 | private final long length; 25 | private final String name; 26 | private final String perms; 27 | 28 | /** 29 | * @param name 30 | * @param length 31 | */ 32 | public NameLengthTuple(String name, long length, String perms) { 33 | this.name = name; 34 | this.length = length; 35 | this.perms = perms; 36 | } 37 | 38 | public String getName() { 39 | return name; 40 | } 41 | 42 | public long getLength() { 43 | return length; 44 | } 45 | 46 | public String getPerms() { 47 | return perms; 48 | } 49 | 50 | @Override 51 | public int hashCode() { 52 | final int prime = 31; 53 | int result = 1; 54 | result = prime * result + (int) (length ^ (length >>> 32)); 55 | result = prime * result + ((name == null) ? 0 : name.hashCode()); 56 | result = prime * result + ((perms == null) ? 0 : perms.hashCode()); 57 | return result; 58 | } 59 | 60 | @Override 61 | public boolean equals(Object obj) { 62 | if (this == obj) { 63 | return true; 64 | } 65 | if (obj == null) { 66 | return false; 67 | } 68 | if (getClass() != obj.getClass()) { 69 | return false; 70 | } 71 | NameLengthTuple other = (NameLengthTuple) obj; 72 | if (length != other.length) { 73 | return false; 74 | } 75 | if (name == null) { 76 | if (other.name != null) { 77 | return false; 78 | } 79 | } else if (!name.equals(other.name)) { 80 | return false; 81 | } 82 | if (perms == null) { 83 | if (other.perms != null) { 84 | return false; 85 | } 86 | } else if (!perms.equals(other.perms)) { 87 | return false; 88 | } 89 | return true; 90 | } 91 | 92 | @Override 93 | public String toString() { 94 | return "NameLengthTuple [length=" + length + ", name=" + name + ", perms=" + perms + "]"; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filters/DenyingForwardingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filters; 14 | 15 | 16 | import org.apache.sshd.common.ForwardingFilter; 17 | import org.apache.sshd.common.Session; 18 | import org.apache.sshd.common.SshdSocketAddress; 19 | import org.apache.sshd.server.session.ServerSession; 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | /** 24 | * This class exists to deny all sorts of forwarding. 25 | * 26 | * we don't allow X11, agent, forwarding, or listening. 27 | * 28 | * @author areese 29 | * 30 | */ 31 | public class DenyingForwardingFilter implements ForwardingFilter { 32 | private static final Logger LOGGER = LoggerFactory.getLogger(DenyingForwardingFilter.class); 33 | 34 | public boolean canForwardAgent(ServerSession session) { 35 | if (LOGGER.isDebugEnabled()) { 36 | LOGGER.debug("Agent forwarding requested for {}", session); 37 | } 38 | 39 | return false; 40 | } 41 | 42 | @Override 43 | public boolean canForwardX11(Session session) { 44 | if (LOGGER.isDebugEnabled()) { 45 | LOGGER.debug("X11 forwarding requested for {}", session); 46 | } 47 | 48 | return false; 49 | } 50 | 51 | @Override 52 | public boolean canListen(SshdSocketAddress socketAddress, Session session) { 53 | if (LOGGER.isDebugEnabled()) { 54 | LOGGER.debug("Listen forwarding requested from {} for {}", socketAddress, session); 55 | } 56 | 57 | return false; 58 | } 59 | 60 | @Override 61 | public boolean canConnect(SshdSocketAddress socketAddress, Session session) { 62 | if (LOGGER.isDebugEnabled()) { 63 | LOGGER.debug("Connect forwarding requested from {} for {}", socketAddress, session); 64 | } 65 | 66 | return false; 67 | } 68 | 69 | @Override 70 | public boolean canForwardAgent(Session session) { 71 | if (LOGGER.isDebugEnabled()) { 72 | LOGGER.debug("Agent forwarding requested for {}", session); 73 | } 74 | 75 | return false; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/filters/LocalForwardingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.filters; 14 | 15 | 16 | import org.apache.sshd.common.Session; 17 | import org.apache.sshd.common.SshdSocketAddress; 18 | import org.slf4j.Logger; 19 | import org.slf4j.LoggerFactory; 20 | 21 | /** 22 | * This class exists to deny all sorts of forwarding. 23 | * 24 | * we don't allow X11, agent, forwarding, or listening. 25 | * 26 | * @author areese 27 | * 28 | */ 29 | public class LocalForwardingFilter extends DenyingForwardingFilter { 30 | private static final Logger LOGGER = LoggerFactory.getLogger(LocalForwardingFilter.class); 31 | private final String toHost; 32 | private final int toPort; 33 | 34 | public LocalForwardingFilter(String toHost, int toPort) { 35 | this.toHost = toHost.toLowerCase(); 36 | this.toPort = toPort; 37 | } 38 | 39 | @Override 40 | public boolean canConnect(SshdSocketAddress socketAddress, Session session) { 41 | if (LOGGER.isDebugEnabled()) { 42 | LOGGER.debug("Connect forwarding requested from {} for {}", socketAddress, session); 43 | } 44 | 45 | // we don't want to allow forwards to just anywhere, we only allow them to the artifactory host. 46 | int sp = socketAddress.getPort(); 47 | if (sp != toPort) { 48 | if (LOGGER.isDebugEnabled()) { 49 | LOGGER.debug("Denying forwarding requested from {} for {} tohost {} toPort {}", socketAddress, session, 50 | toHost, Integer.valueOf(toPort)); 51 | } 52 | 53 | return false; 54 | } 55 | 56 | String spHost = socketAddress.getHostName().toLowerCase(); 57 | if (!toHost.equals(spHost)) { 58 | if (LOGGER.isDebugEnabled()) { 59 | LOGGER.debug("Denying forwarding requested from {} for {} tohost {} toPort {}", socketAddress, session, 60 | toHost, Integer.valueOf(toPort)); 61 | } 62 | 63 | return false; 64 | } 65 | 66 | return true; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/jetty/JettyRunnableComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.jetty; 14 | 15 | import java.io.IOException; 16 | 17 | import org.eclipse.jetty.server.Server; 18 | 19 | import com.yahoo.sshd.utils.RunnableComponent; 20 | 21 | /** 22 | * A wrapper to allow jetty to be started and stopped. 23 | * 24 | * @author areese 25 | * 26 | */ 27 | public class JettyRunnableComponent implements RunnableComponent { 28 | 29 | private int jettyPort; 30 | private String jettyWebAppDir; 31 | private Server server; 32 | private JettyServiceSetting jettyServiceSetting; 33 | 34 | public JettyRunnableComponent(final int jettyPort, final String jettyWebAppDir, 35 | final JettyServiceSetting jettyServiceSetting) { 36 | this.jettyPort = jettyPort; 37 | this.jettyServiceSetting = jettyServiceSetting; 38 | this.jettyWebAppDir = (null == jettyWebAppDir) ? null : jettyWebAppDir.trim(); 39 | } 40 | 41 | @Override 42 | public void run() { 43 | try { 44 | if (-1 == jettyPort || null == jettyWebAppDir || jettyWebAppDir.isEmpty()) { 45 | return; 46 | } 47 | 48 | server = JettyServer.newServer(jettyPort, jettyWebAppDir, jettyServiceSetting); 49 | server.start(); 50 | } catch (Exception e) { 51 | throw new RuntimeException(e); 52 | } 53 | } 54 | 55 | @Override 56 | public String getName() { 57 | return "Jetty Server"; 58 | } 59 | 60 | @Override 61 | public void close() throws IOException { 62 | if (null == server) { 63 | return; 64 | } 65 | 66 | try { 67 | server.stop(); 68 | } catch (Exception e) { 69 | throw new IOException(e); 70 | } finally { 71 | server = null; 72 | } 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/jetty/JettyServiceSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.yahoo.sshd.server.jetty; 15 | 16 | 17 | /** 18 | * Used to tell the Jetty server which resources to serve. 19 | * 20 | * @author muellerfabian 21 | * 22 | */ 23 | public enum JettyServiceSetting { 24 | 25 | ARTIFACTORY, 26 | VIP, 27 | BOTH; 28 | 29 | 30 | public static JettyServiceSetting valueOfIgnoreCase(String setting) throws IllegalArgumentException{ 31 | 32 | if (null != setting) { 33 | setting = setting.toUpperCase(); 34 | } 35 | 36 | return JettyServiceSetting.valueOf(setting); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/logging/DefaultRequestLogFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.logging; 14 | 15 | public class DefaultRequestLogFactory implements RequestLogFactory { 16 | 17 | @Override 18 | public SshRequestLog createRequestLog(String requestLogFilePath) { 19 | return new NCSARequestLog(requestLogFilePath); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/logging/RequestLogFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.logging; 14 | 15 | public interface RequestLogFactory { 16 | 17 | SshRequestLog createRequestLog(String requestLogFilePath); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/logging/SshRequestHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.logging; 14 | 15 | public interface SshRequestHandler { 16 | 17 | void handleRequest(SshRequestInfo requestInfo); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/logging/SshRequestLog.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.logging; 14 | 15 | import java.io.Closeable; 16 | 17 | 18 | public interface SshRequestLog extends Closeable { 19 | 20 | public void log(SshRequestInfo request); 21 | 22 | public void setup() throws Exception; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/logging/SshRequestLogListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.logging; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import org.apache.sshd.common.Session; 19 | import org.apache.sshd.common.SessionListener; 20 | import org.apache.sshd.server.session.ServerSession; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | public class SshRequestLogListener implements SessionListener, SshRequestHandler { 25 | private static final Logger LOGGER = LoggerFactory.getLogger(SshRequestLogListener.class); 26 | private SshRequestLog requestLog; 27 | private List sshRequestList = new ArrayList(); 28 | 29 | public SshRequestLogListener(SshRequestLog log) { 30 | this.requestLog = log; 31 | } 32 | 33 | public void setSshRequestLog(SshRequestLog log) { 34 | this.requestLog = log; 35 | } 36 | 37 | public void registerSession(ServerSession session) { 38 | session.addListener(this); 39 | } 40 | 41 | @Override 42 | public void sessionCreated(Session session) { 43 | // this may not be called if the listener is created after the session 44 | // has been created 45 | if (LOGGER.isDebugEnabled()) { 46 | LOGGER.debug("session " + session.toString() + "gets started."); 47 | } 48 | } 49 | 50 | @Override 51 | public void sessionClosed(Session session) { 52 | for (SshRequestInfo request : sshRequestList) { 53 | if (LOGGER.isDebugEnabled()) { 54 | LOGGER.debug("logging the ssh request info " + request.toString()); 55 | } 56 | requestLog.log(request); 57 | } 58 | if (LOGGER.isDebugEnabled()) { 59 | LOGGER.debug("session" + session.toString() + " closed."); 60 | } 61 | } 62 | 63 | @Override 64 | public void handleRequest(final SshRequestInfo requestInfo) { 65 | if (null == requestInfo) { 66 | LOGGER.warn("requestInfo is null somehow, no logging"); 67 | return; 68 | } 69 | sshRequestList.add(requestInfo); 70 | } 71 | 72 | @Override 73 | public void sessionEvent(Session session, Event event) { 74 | if (LOGGER.isDebugEnabled()) { 75 | LOGGER.debug("session " + session.toString() + " Event: " + event.toString()); 76 | } 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/logging/SshRequestStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | 14 | package com.yahoo.sshd.server.logging; 15 | 16 | public enum SshRequestStatus { 17 | 18 | OK(200, "GET"), // 19 | CREATED(201, "PUT"), // 20 | ACCEPTED(202, "Accepted"), // 21 | NO_CONTENT(204, "No Content"), // 22 | MOVED_PERMANENTLY(301, "Moved Permanently"), // 23 | SEE_OTHER(303, "See Other"), // 24 | NOT_MODIFIED(304, "Not Modified"), // 25 | TEMPORARY_REDIRECT(307, "Temporary Redirect"), // 26 | BAD_REQUEST(400, "Bad Request"), // 27 | UNAUTHORIZED(401, "Unauthorized"), // 28 | FORBIDDEN(403, "Forbidden"), // 29 | NOT_FOUND(404, "Not Found"), // 30 | METHOD_NOT_ALLOWED(405, "Method Not Allowed"), 31 | NOT_ACCEPTABLE(406, "Not Acceptable"), // 32 | CONFLICT(409, "Conflict"), // 33 | GONE(410, "Gone"), // 34 | PRECONDITION_FAILED(412, "Precondition Failed"), // 35 | UNSUPPORTED_MEDIA_TYPE(415, "Unsupported Media Type"), // 36 | INTERNAL_SERVER_ERROR(500, "Internal Server Error"), // 37 | SERVICE_UNAVAILABLE(503, "Service Unavailable"); // 38 | 39 | private final int code; 40 | private final String reason; 41 | 42 | SshRequestStatus(final int statusCode, final String reasonPhrase) { 43 | this.code = statusCode; 44 | this.reason = reasonPhrase; 45 | } 46 | 47 | public int getStatusCode() { 48 | return code; 49 | } 50 | 51 | public String getReasonPhrase() { 52 | return toString(); 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return reason; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/settings/SshdConfigurationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.settings; 14 | 15 | public class SshdConfigurationException extends Exception { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | public SshdConfigurationException(Exception e) { 20 | super(e); 21 | } 22 | 23 | public SshdConfigurationException(String message) { 24 | super(message); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/settings/SshdProxySettingsFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.settings; 14 | 15 | import javax.annotation.Nonnull; 16 | 17 | public class SshdProxySettingsFactory implements SshdSettingsFactory { 18 | 19 | @Override 20 | public SshdSettingsInterface createSshdSettings(@Nonnull String[] args) throws SshdConfigurationException { 21 | return new SshdSettingsBuilder(args).build(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/settings/SshdSettingsFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.settings; 14 | 15 | public interface SshdSettingsFactory { 16 | SshdSettingsInterface createSshdSettings(String[] args) throws SshdConfigurationException; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/settings/SshdSettingsModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.settings; 14 | 15 | import org.apache.sshd.server.keyprovider.PEMHostKeyProviderFactory; 16 | import org.apache.sshd.server.keyprovider.SshdPEMHostKeyProviderFactory; 17 | 18 | import com.google.inject.AbstractModule; 19 | import com.yahoo.sshd.authorization.ArtifactoryAuthorizerProviderFactory; 20 | import com.yahoo.sshd.authorization.file.DefaultArtifactoryAuthorizerProviderFactory; 21 | import com.yahoo.sshd.server.filesystem.ArtifactoryFileSystemFactory; 22 | import com.yahoo.sshd.server.filesystem.InjectableArtifactoryFileSystemFactory; 23 | import com.yahoo.sshd.server.logging.DefaultRequestLogFactory; 24 | import com.yahoo.sshd.server.logging.RequestLogFactory; 25 | 26 | public class SshdSettingsModule extends AbstractModule { 27 | 28 | @Override 29 | protected void configure() { 30 | bind(SshdSettingsFactory.class).to(SshdProxySettingsFactory.class); 31 | bind(InjectableArtifactoryFileSystemFactory.class).to(ArtifactoryFileSystemFactory.class); 32 | bind(PEMHostKeyProviderFactory.class).to(SshdPEMHostKeyProviderFactory.class); 33 | bind(ArtifactoryAuthorizerProviderFactory.class).to(DefaultArtifactoryAuthorizerProviderFactory.class); 34 | bind(RequestLogFactory.class).to(DefaultRequestLogFactory.class); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/shell/ForwardingShellFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | /* Some portions of this code are Copyright (c) 2014, Yahoo! Inc. All rights reserved. */ 14 | package com.yahoo.sshd.server.shell; 15 | 16 | import java.util.EnumSet; 17 | 18 | import org.apache.sshd.common.Factory; 19 | import org.apache.sshd.server.Command; 20 | import org.apache.sshd.server.shell.ProcessShellFactory.TtyOptions; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | /** 25 | * Derived from {@link org.apache.sshd.server.shell.ProcessShellFactory}. 26 | * 27 | * A {@link org.apache.sshd.common.Factory} of {@link org.apache.sshd.server.Command} that will simply echo 28 | * text back. The idea is to keep the shell open to allow port forwarding in the background 29 | * 30 | * @author areese 31 | * 32 | */ 33 | public class ForwardingShellFactory implements Factory { 34 | @SuppressWarnings("unused") 35 | private static final Logger LOGGER = LoggerFactory.getLogger(ForwardingShellFactory.class); 36 | 37 | private String[] command; 38 | private EnumSet ttyOptions; 39 | 40 | public ForwardingShellFactory(EnumSet ttyOptions) { 41 | this(new String[] {}, ttyOptions); 42 | } 43 | 44 | public ForwardingShellFactory(String[] command, EnumSet ttyOptions) { 45 | this.command = command; 46 | this.ttyOptions = ttyOptions; 47 | } 48 | 49 | public String[] getCommand() { 50 | return command; 51 | } 52 | 53 | public void setCommand(String[] command) { 54 | this.command = command; 55 | } 56 | 57 | @Override 58 | public Command create() { 59 | return new ForwardingShellWrapper(ttyOptions); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/shell/GroovyShellFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | /* Some portions of this code are Copyright (c) 2014, Yahoo! Inc. All rights reserved. */ 14 | package com.yahoo.sshd.server.shell; 15 | 16 | import java.util.EnumSet; 17 | 18 | import org.apache.sshd.common.Factory; 19 | import org.apache.sshd.server.Command; 20 | import org.apache.sshd.server.shell.ProcessShellFactory.TtyOptions; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | 25 | /** 26 | * Derived from {@link org.apache.sshd.server.shell.ProcessShellFactory}. 27 | * 28 | * A {@link org.apache.sshd.common.Factory} of {@link org.apache.sshd.server.Command} that will spawn a groovy 29 | * shell There is a major setback, that only out is bound, when to truly be useful, I need to dig into artifactory and 30 | * bind useful bits from there. 31 | * 32 | * 33 | * @author areese 34 | * 35 | */ 36 | public class GroovyShellFactory implements Factory { 37 | @SuppressWarnings("unused") 38 | private static final Logger LOGGER = LoggerFactory.getLogger(GroovyShellFactory.class); 39 | 40 | private String[] command; 41 | private EnumSet ttyOptions; 42 | 43 | public GroovyShellFactory(EnumSet ttyOptions) { 44 | this.command = new String[] {}; 45 | this.ttyOptions = ttyOptions; 46 | } 47 | 48 | public String[] getCommand() { 49 | return command; 50 | } 51 | 52 | public void setCommand(String[] command) { 53 | this.command = command; 54 | } 55 | 56 | @Override 57 | public Command create() { 58 | return new GroovyShellWrapper(ttyOptions); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/shell/SshProxyMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.shell; 14 | 15 | public class SshProxyMessage { 16 | public static final String MESSAGE_STRING = "" // 17 | + "*---------------------------------------------------*\n" 18 | + "| _ _ _ _| _-|-. _ _ |\n" 19 | + "| this is a |_)| (_)(_||_|(_ | |(_)| | server |\n" 20 | + "| | |\n" 21 | + "*---------------------------------------------------*\n" // 22 | + ""; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/shell/groovy/GroovyPrompt.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.sshd.server.shell.groovy; 2 | 3 | import groovy.lang.Closure; 4 | 5 | public class GroovyPrompt extends Closure { 6 | private static final long serialVersionUID = 1L; 7 | 8 | public GroovyPrompt(Object owner) { 9 | super(owner); 10 | } 11 | 12 | public String doCall() { 13 | return "groovy => "; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/server/shell/groovy/OutputStreamErrorHandler.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.sshd.server.shell.groovy; 2 | 3 | import java.io.OutputStream; 4 | import java.io.PrintStream; 5 | 6 | import groovy.lang.Closure; 7 | 8 | public class OutputStreamErrorHandler extends Closure { 9 | private static final long serialVersionUID = 1L; 10 | 11 | private final OutputStream err; 12 | 13 | public OutputStreamErrorHandler(Object owner, OutputStream err) { 14 | super(owner); 15 | this.err = err; 16 | } 17 | 18 | public Void doCall(Object o) { 19 | if (!(o instanceof Throwable) || null == err) { 20 | return null; 21 | } 22 | 23 | try (PrintStream ps = new PrintStream(err)) { 24 | ((Throwable) o).printStackTrace(ps); 25 | } 26 | 27 | return null; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactMetaDataParseFailureException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | public class ArtifactMetaDataParseFailureException extends Exception { 16 | 17 | private static final long serialVersionUID = 1L; 18 | 19 | public ArtifactMetaDataParseFailureException(String message, Exception e) { 20 | super(message, e); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | public class ArtifactNotFoundException extends Exception { 16 | private static final long serialVersionUID = 1L; 17 | 18 | public ArtifactNotFoundException(Exception ex) { 19 | super(ex); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryBadRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import com.yahoo.sshd.server.logging.SshRequestStatus; 16 | 17 | import org.apache.sshd.common.file.SshFile; 18 | 19 | public class ArtifactoryBadRequestException extends ArtifactoryIOException { 20 | 21 | private static final long serialVersionUID = 1L; 22 | 23 | public ArtifactoryBadRequestException(String message) { 24 | super(message, null); 25 | } 26 | 27 | public ArtifactoryBadRequestException(String message, SshFile file) { 28 | super(message, file); 29 | } 30 | 31 | @Override 32 | public int getStatusCode() { 33 | return SshRequestStatus.BAD_REQUEST.getStatusCode(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | public interface ArtifactoryClientFactory { 16 | JFrogArtifactoryClientHelper createJFrogClientHelper(final ArtifactoryInformation afInfo, 17 | final String repositoryName); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryExceptionInformation.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.sshd.tools.artifactory; 2 | 3 | import org.apache.sshd.common.file.SshFile; 4 | 5 | public interface ArtifactoryExceptionInformation { 6 | /** 7 | * 8 | * @return the sshFile associated with this exception. 9 | */ 10 | SshFile getFile(); 11 | 12 | /** 13 | * = 14 | * @return the http style status code associated with this exception. 15 | */ 16 | int getStatusCode(); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryFileNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import java.io.FileNotFoundException; 16 | 17 | import org.apache.sshd.common.file.SshFile; 18 | 19 | import com.yahoo.sshd.server.logging.SshRequestStatus; 20 | 21 | public class ArtifactoryFileNotFoundException extends FileNotFoundException implements ArtifactoryExceptionInformation { 22 | 23 | private static final long serialVersionUID = 1L; 24 | private SshFile file; 25 | 26 | public ArtifactoryFileNotFoundException(String filePath, Throwable cause) { 27 | super(filePath); 28 | this.initCause(cause); 29 | } 30 | 31 | public ArtifactoryFileNotFoundException(String filePath) { 32 | super(filePath); 33 | } 34 | 35 | public ArtifactoryFileNotFoundException(String filePath, SshFile file) { 36 | super(filePath); 37 | this.file = file; 38 | } 39 | 40 | @Override 41 | public SshFile getFile() { 42 | return file; 43 | } 44 | 45 | @Override 46 | public int getStatusCode() { 47 | return SshRequestStatus.NOT_FOUND.getStatusCode(); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryIOException.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.sshd.tools.artifactory; 2 | 3 | import java.io.IOException; 4 | 5 | import org.apache.sshd.common.file.SshFile; 6 | 7 | public abstract class ArtifactoryIOException extends IOException implements ArtifactoryExceptionInformation { 8 | 9 | private static final long serialVersionUID = 1L; 10 | 11 | private final SshFile file; 12 | 13 | public ArtifactoryIOException(String message, SshFile file) { 14 | super(message); 15 | this.file = file; 16 | } 17 | 18 | @Override 19 | public SshFile getFile() { 20 | return file; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryNoReadPermissionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import org.apache.sshd.common.file.SshFile; 16 | 17 | import com.yahoo.sshd.server.logging.SshRequestStatus; 18 | 19 | 20 | public class ArtifactoryNoReadPermissionException extends ArtifactoryIOException { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ArtifactoryNoReadPermissionException(String message) { 25 | super(message, null); 26 | } 27 | 28 | public ArtifactoryNoReadPermissionException(String message, SshFile file) { 29 | super(message, file); 30 | } 31 | 32 | @Override 33 | public int getStatusCode() { 34 | return SshRequestStatus.FORBIDDEN.getStatusCode(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/ArtifactoryNoWritePermissionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import org.apache.sshd.common.file.SshFile; 16 | 17 | import com.yahoo.sshd.server.logging.SshRequestStatus; 18 | 19 | public class ArtifactoryNoWritePermissionException extends ArtifactoryIOException { 20 | private static final long serialVersionUID = 1L; 21 | 22 | public ArtifactoryNoWritePermissionException(String message) { 23 | super(message, null); 24 | } 25 | 26 | public ArtifactoryNoWritePermissionException(String message, SshFile file) { 27 | super(message, file); 28 | } 29 | 30 | @Override 31 | public int getStatusCode() { 32 | return SshRequestStatus.FORBIDDEN.getStatusCode(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/Checksum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import java.util.LinkedHashMap; 16 | import java.util.LinkedList; 17 | import java.util.List; 18 | import java.util.Map.Entry; 19 | 20 | import com.fasterxml.jackson.databind.annotation.JsonDeserialize; 21 | 22 | @JsonDeserialize(builder = Checksum.class) 23 | public class Checksum { 24 | private final String type; 25 | private final String value; 26 | 27 | /** 28 | * @param type 29 | * @param value 30 | */ 31 | Checksum(String type, String value) { 32 | this.type = type; 33 | this.value = value; 34 | } 35 | 36 | public String getType() { 37 | return type; 38 | } 39 | 40 | public String getValue() { 41 | return value; 42 | } 43 | 44 | @Override 45 | public int hashCode() { 46 | final int prime = 31; 47 | int result = 1; 48 | result = prime * result + ((type == null) ? 0 : type.hashCode()); 49 | result = prime * result + ((value == null) ? 0 : value.hashCode()); 50 | return result; 51 | } 52 | 53 | @Override 54 | public boolean equals(Object obj) { 55 | if (this == obj) { 56 | return true; 57 | } 58 | if (obj == null) { 59 | return false; 60 | } 61 | if (getClass() != obj.getClass()) { 62 | return false; 63 | } 64 | Checksum other = (Checksum) obj; 65 | if (type == null) { 66 | if (other.type != null) { 67 | return false; 68 | } 69 | } else if (!type.equals(other.type)) { 70 | return false; 71 | } 72 | if (value == null) { 73 | if (other.value != null) { 74 | return false; 75 | } 76 | } else if (!value.equals(other.value)) { 77 | return false; 78 | } 79 | return true; 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | return "Checksum [type=" + type + ", value=" + value + "]"; 85 | } 86 | 87 | public static Checksum[] build(LinkedHashMap checksums) { 88 | if (null == checksums) { 89 | return null; 90 | } 91 | 92 | List list = new LinkedList<>(); 93 | 94 | for (Entry e : checksums.entrySet()) { 95 | list.add(new Checksum(e.getKey(), e.getValue())); 96 | } 97 | 98 | return list.toArray(new Checksum[] {}); 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/tools/artifactory/JFrogArtifactoryClientHelperFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | public class JFrogArtifactoryClientHelperFactoryImpl implements ArtifactoryClientFactory { 16 | 17 | @Override 18 | public JFrogArtifactoryClientHelper createJFrogClientHelper(final ArtifactoryInformation afInfo, 19 | final String repositoryName) { 20 | return new JFrogArtifactoryClientHelper(afInfo, repositoryName); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/AuthUserData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils; 14 | 15 | /** 16 | * this interface defines a datatype which leaves how to get password in a secure way to the concrete classes 17 | * 18 | * @author yili 19 | * 20 | */ 21 | 22 | public interface AuthUserData { 23 | public String getUserName(); 24 | 25 | public char[] getPassword(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/DirectoryWatchServiceEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 5 | * following conditions are met: 6 | * 7 | * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following 8 | * disclaimer. 9 | * 10 | * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following 11 | * disclaimer in the documentation and/or other materials provided with the distribution. 12 | * 13 | * - Neither the name of Oracle nor the names of its contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 17 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | */ 24 | 25 | /* Some portions of this code are Copyright (c) 2014, Yahoo! Inc. All rights reserved. */ 26 | 27 | /* 28 | * Adapted from: 29 | * http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/essential 30 | * /io/examples/WatchDir.java 31 | */ 32 | package com.yahoo.sshd.utils; 33 | 34 | import java.nio.file.Path; 35 | 36 | public interface DirectoryWatchServiceEventHandler { 37 | 38 | public void onProcessEvents(Path changed); 39 | 40 | public void onProcessCreateEvents(Path changed); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/RunnableComponent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils; 14 | 15 | import java.io.Closeable; 16 | import java.io.IOException; 17 | 18 | /** 19 | * An interface for something that can run, has a name and can be stopped. 20 | * 21 | * @author areese 22 | * 23 | */ 24 | public interface RunnableComponent extends Runnable, Closeable { 25 | @Override 26 | public void run(); 27 | 28 | public String getName(); 29 | 30 | @Override 31 | public void close() throws IOException; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/ThreadSafeSimpleDateFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils; 14 | 15 | import java.text.ParseException; 16 | import java.text.SimpleDateFormat; 17 | import java.util.Date; 18 | 19 | public class ThreadSafeSimpleDateFormat { 20 | private final String format; 21 | private final ThreadLocal tls = new ThreadLocal() { 22 | @Override 23 | protected SimpleDateFormat initialValue() { 24 | return new SimpleDateFormat(format); 25 | } 26 | }; 27 | 28 | public ThreadSafeSimpleDateFormat(final String format) { 29 | this.format = format; 30 | } 31 | 32 | public Date format(String date) throws ParseException { 33 | return tls.get().parse(date); 34 | } 35 | 36 | public long formatLong(String date) throws ParseException { 37 | return tls.get().parse(date).getTime(); 38 | } 39 | 40 | public long formatLongNoException(String date) { 41 | if (null == date) { 42 | return 0L; 43 | } 44 | 45 | date = date.trim(); 46 | 47 | if (date.isEmpty()) { 48 | return 0L; 49 | } 50 | 51 | try { 52 | return tls.get().parse(date).getTime(); 53 | } catch (ParseException e) { 54 | return 0; 55 | } 56 | } 57 | 58 | public String formatLongToString(long startTimestamp) { 59 | return tls.get().format(new Date(startTimestamp)); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/AsyncHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | public interface AsyncHandler { 16 | 17 | public void onCompleted() throws Exception; 18 | 19 | public void onThrowable(Throwable t); 20 | 21 | public Throwable getThrowable(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/AsyncHandlerImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.util.concurrent.CountDownLatch; 16 | 17 | public final class AsyncHandlerImpl implements AsyncHandler { 18 | private final CountDownLatch responseArrived; 19 | private Throwable responseThrowable = null; 20 | 21 | public AsyncHandlerImpl(final CountDownLatch responseArrived) { 22 | this.responseArrived = responseArrived; 23 | } 24 | 25 | @Override 26 | public void onCompleted() throws Exception { 27 | responseArrived.countDown(); 28 | } 29 | 30 | @Override 31 | public void onThrowable(Throwable t) { 32 | responseThrowable = t; 33 | responseArrived.countDown(); 34 | } 35 | 36 | @Override 37 | public Throwable getThrowable() { 38 | return this.responseThrowable; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/AsyncPipedOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.io.IOException; 16 | import java.io.PipedInputStream; 17 | import java.io.PipedOutputStream; 18 | import java.util.concurrent.CountDownLatch; 19 | 20 | /** 21 | * 22 | * @author charlesk 23 | * 24 | */ 25 | public class AsyncPipedOutputStream extends PipedOutputStream { 26 | private final CountDownLatch responseArrived = new CountDownLatch(1); 27 | private final AsyncHandlerImpl asyncHandlerImpl = new AsyncHandlerImpl(responseArrived); 28 | 29 | public AsyncPipedOutputStream(PipedInputStream pipedInputStream) throws IOException { 30 | super(pipedInputStream); 31 | } 32 | 33 | /** 34 | * close method will wait until count down latch reaches 0 35 | */ 36 | @Override 37 | public void close() throws IOException { 38 | try { 39 | // call close here first so that input stream can be read. 40 | super.close(); 41 | // block here until countdownlatch gets to 0 through AsyncHandlerImpl. 42 | responseArrived.await(); 43 | } catch (InterruptedException e) { 44 | throw new IOException("InterruptedException while waiting for the response to arrive."); 45 | } 46 | Throwable responseThrowable = asyncHandlerImpl.getThrowable(); 47 | if (responseThrowable != null) { 48 | // we got exception throw it. 49 | throw new IOException(responseThrowable); 50 | } 51 | } 52 | 53 | /** 54 | * 55 | * @return AsyncHandler implementation which has been initialized with CountDownLatch. 56 | */ 57 | public AsyncHandler getAsyncHandler() { 58 | return this.asyncHandlerImpl; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/EmptyInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.io.IOException; 16 | import java.io.InputStream; 17 | 18 | public class EmptyInputStream extends InputStream { 19 | 20 | @Override 21 | public int read(byte[] b) throws IOException { 22 | return -1; 23 | } 24 | 25 | @Override 26 | public int read(byte[] b, int off, int len) throws IOException { 27 | return -1; 28 | } 29 | 30 | @Override 31 | public long skip(long n) throws IOException { 32 | return 0; 33 | } 34 | 35 | @Override 36 | public int available() throws IOException { 37 | return 0; 38 | } 39 | 40 | @Override 41 | public void close() throws IOException { 42 | 43 | } 44 | 45 | @Override 46 | public synchronized void mark(int readlimit) { 47 | 48 | } 49 | 50 | @Override 51 | public synchronized void reset() throws IOException { 52 | 53 | } 54 | 55 | @Override 56 | public boolean markSupported() { 57 | return false; 58 | } 59 | 60 | @Override 61 | public int read() throws IOException { 62 | return -1; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/EmptyOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.io.IOException; 16 | import java.io.OutputStream; 17 | 18 | /** 19 | * A stream that is always empty. 20 | * 21 | * @author areese 22 | * 23 | */ 24 | public class EmptyOutputStream extends OutputStream { 25 | 26 | @Override 27 | public void write(byte[] b) throws IOException { 28 | 29 | } 30 | 31 | @Override 32 | public void write(byte[] b, int off, int len) throws IOException { 33 | 34 | } 35 | 36 | @Override 37 | public void flush() throws IOException { 38 | 39 | } 40 | 41 | @Override 42 | public void close() throws IOException { 43 | 44 | } 45 | 46 | @Override 47 | public void write(int b) throws IOException { 48 | 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/InputStreamWithLength.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.io.IOException; 16 | import java.io.InputStream; 17 | 18 | public class InputStreamWithLength extends InputStream implements InputStreamWithLengthInterface { 19 | 20 | private final InputStream is; 21 | private final int length; 22 | 23 | public InputStreamWithLength(final InputStream is, final int length) { 24 | this.is = is; 25 | this.length = length; 26 | } 27 | 28 | @Override 29 | public int read(byte[] b) throws IOException { 30 | return is.read(b); 31 | } 32 | 33 | @Override 34 | public int read(byte[] b, int off, int len) throws IOException { 35 | return is.read(b, off, len); 36 | } 37 | 38 | @Override 39 | public long skip(long n) throws IOException { 40 | return is.skip(n); 41 | } 42 | 43 | @Override 44 | public int available() throws IOException { 45 | return is.available(); 46 | } 47 | 48 | @Override 49 | public void close() throws IOException { 50 | is.close(); 51 | } 52 | 53 | @Override 54 | public synchronized void mark(int readlimit) { 55 | is.mark(readlimit); 56 | } 57 | 58 | @Override 59 | public synchronized void reset() throws IOException { 60 | is.reset(); 61 | } 62 | 63 | @Override 64 | public boolean markSupported() { 65 | return is.markSupported(); 66 | } 67 | 68 | @Override 69 | public int read() throws IOException { 70 | return is.read(); 71 | } 72 | 73 | @Override 74 | public int getLength() { 75 | return length; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/yahoo/sshd/utils/streams/InputStreamWithLengthInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.io.Closeable; 16 | import java.io.IOException; 17 | 18 | public interface InputStreamWithLengthInterface extends Closeable { 19 | public int read() throws IOException; 20 | 21 | public int read(byte[] b) throws IOException; 22 | 23 | public int read(byte[] b, int off, int len) throws IOException; 24 | 25 | public long skip(long n) throws IOException; 26 | 27 | public int available() throws IOException; 28 | 29 | @Override 30 | public void close() throws IOException; 31 | 32 | public void mark(int readlimit); 33 | 34 | public void reset() throws IOException; 35 | 36 | public boolean markSupported(); 37 | 38 | public int getLength(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/sshd/server/keyprovider/PEMHostKeyProviderFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | /* Some portions of this code are Copyright (c) 2014, Yahoo! Inc. All rights reserved. */ 14 | package org.apache.sshd.server.keyprovider; 15 | 16 | import org.apache.sshd.common.KeyPairProvider; 17 | 18 | public interface PEMHostKeyProviderFactory { 19 | 20 | KeyPairProvider createPEMHostKeyProvider(String path); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/apache/sshd/server/keyprovider/SshdPEMHostKeyProviderFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE 3 | * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file 4 | * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | /* Some portions of this code are Copyright (c) 2014, Yahoo! Inc. All rights reserved. */ 14 | package org.apache.sshd.server.keyprovider; 15 | 16 | import org.apache.sshd.common.KeyPairProvider; 17 | 18 | public class SshdPEMHostKeyProviderFactory implements PEMHostKeyProviderFactory { 19 | 20 | @Override 21 | public KeyPairProvider createPEMHostKeyProvider(String path) { 22 | return new PEMHostKeyProvider(path); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/asynchttpclient.properties: -------------------------------------------------------------------------------- 1 | setAllowPoolingConnection=true 2 | setCompressionEnabled=true 3 | setConnectionTimeoutInMs=60000 4 | setMaximumConnectionsPerHost=20 5 | setMaximumConnectionsTotal=100 6 | setRequestTimeoutInMs=500000 7 | -------------------------------------------------------------------------------- /src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{HH:mm:ss.SSS} %-5level [thread: %thread] %logger{36}.%M:%L - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 16 | 18 | 19 | 21 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/sshd_proxy.properties: -------------------------------------------------------------------------------- 1 | sshd.port=2222 2 | sshd.artifactoryUrl=http://your_artifactory_host:4080/artifactory 3 | sshd.artifactoryUsername=artifactory_username 4 | sshd.artifactoryPassword=artifactory_password 5 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/authentication/file/TestLocalUserPKAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authentication.file; 14 | 15 | import java.io.FileInputStream; 16 | import java.security.PublicKey; 17 | import java.util.Map; 18 | import java.util.concurrent.CountDownLatch; 19 | 20 | import org.apache.karaf.shell.ssh.KarafPublickeyAuthenticator; 21 | import org.apache.karaf.shell.ssh.KarafPublickeyAuthenticator.AuthorizedKey; 22 | import org.apache.sshd.common.io.IoSession; 23 | import org.apache.sshd.server.session.ServerSession; 24 | import org.mockito.Mockito; 25 | import org.testng.annotations.Test; 26 | 27 | public class TestLocalUserPKAuthenticator { 28 | @Test 29 | public void testDefault() throws Exception { 30 | CountDownLatch wakeupLatch = new CountDownLatch(1); 31 | LocalUserPKAuthenticator lpka = new LocalUserPKAuthenticator(wakeupLatch) { 32 | 33 | @Override 34 | String getUserName() { 35 | return "areese"; 36 | } 37 | 38 | @Override 39 | String getUserHome() { 40 | return "src/test/resources/MultiUserPKAuthenticator/home/areese/"; 41 | } 42 | }; 43 | 44 | lpka.start(); 45 | 46 | ServerSession session = Mockito.mock(ServerSession.class); 47 | IoSession ioSession = Mockito.mock(IoSession.class); 48 | Mockito.when(session.getIoSession()).thenReturn(ioSession); 49 | 50 | Map publicKeys = null; 51 | try (FileInputStream karafFis = new FileInputStream(lpka.getAuthorizedKeysPath())) { 52 | publicKeys = 53 | KarafPublickeyAuthenticator.parseAuthorizedKeys(lpka.getAuthorizedKeysPath() 54 | .getAbsolutePath(), karafFis); 55 | } 56 | 57 | for (PublicKey publicKey : publicKeys.keySet()) { 58 | lpka.authenticate("areese", publicKey, session); 59 | } 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/authorization/file/TestArtifactoryAuthorization.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization.file; 14 | 15 | import org.mockito.Mockito; 16 | import org.testng.Assert; 17 | import org.testng.annotations.BeforeClass; 18 | import org.testng.annotations.DataProvider; 19 | import org.testng.annotations.Test; 20 | 21 | import com.yahoo.sshd.authorization.ArtifactoryPermTargetType; 22 | import com.yahoo.sshd.server.settings.SshdSettingsInterface; 23 | 24 | @Test(groups = "unit") 25 | public class TestArtifactoryAuthorization { 26 | 27 | private FileBasedArtifactoryAuthorizer artifactoryAuthorization; 28 | 29 | @BeforeClass 30 | public void init() { 31 | SshdSettingsInterface mockedSshdSettings = Mockito.mock(SshdSettingsInterface.class); 32 | Mockito.when(mockedSshdSettings.getArtifactoryAuthorizationFilePath()).thenReturn( 33 | "src/test/resources/auth/auth.txt"); 34 | artifactoryAuthorization = new FileBasedArtifactoryAuthorizer(mockedSshdSettings); 35 | } 36 | 37 | @SuppressWarnings("boxing") 38 | @DataProvider(name = "authSample") 39 | public static Object[][] getAuthSample() { 40 | return new Object[][] { 41 | // Success cases 42 | // repo & user found. user has read perm 43 | {"repoX", "a", ArtifactoryPermTargetType.READ, true}, 44 | // repo & user found. user has write perm 45 | {"repoX", "a", ArtifactoryPermTargetType.WRITE, true}, 46 | // repo found with no user but all READ 47 | {"repoX", "c", ArtifactoryPermTargetType.READ, true}, 48 | 49 | // failing cases 50 | // repo not found case 51 | {"repoA", "charlesk", ArtifactoryPermTargetType.WRITE, false}, 52 | // repo found but user not found case 53 | {"repoX", "user2", ArtifactoryPermTargetType.WRITE, false}, 54 | // repo found but no wrte perm 55 | {"repoX", "c", ArtifactoryPermTargetType.WRITE, false}}; 56 | } 57 | 58 | @Test(dataProvider = "authSample") 59 | public void testAuthorization(String repositoryName, String userName, ArtifactoryPermTargetType permissionTarget, 60 | boolean expected) { 61 | boolean actual = artifactoryAuthorization.authorized(repositoryName, userName, permissionTarget); 62 | Assert.assertEquals(expected, actual); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/authorization/file/TestAuthFileScanner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.authorization.file; 14 | 15 | import org.testng.annotations.Test; 16 | 17 | public class TestAuthFileScanner { 18 | 19 | @Test 20 | public void testAuthFileScanner() { 21 | // File file = new File("src/test/resources/auth/auth.txt"); 22 | // AuthFileScanner authFileScanner = new AuthFileScanner(file.toPath()); 23 | // Thread authFileScannerThread = new Thread(authFileScanner); 24 | // authFileScannerThread.start(); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/TestHostKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server; 14 | 15 | import java.security.KeyPair; 16 | 17 | import org.apache.sshd.server.keyprovider.PEMHostKeyProvider; 18 | import org.testng.Assert; 19 | import org.testng.annotations.Test; 20 | 21 | @Test(groups = "unit") 22 | public class TestHostKey { 23 | @Test 24 | public void testHostKey() { 25 | System.err.println("os.name=" + System.getProperty("os.name")); 26 | PEMHostKeyProvider keyPairProvider = new PEMHostKeyProvider("src/test/resources/hostkey.pem"); 27 | Iterable keys = keyPairProvider.loadKeys(); 28 | Assert.assertNotNull(keys); 29 | // TODO: fix 30 | // Assert.assertFalse(keys.); 31 | for (KeyPair k : keys) { 32 | Assert.assertNotNull(k); 33 | Assert.assertNotNull(k.getPrivate()); 34 | System.err.println("key: " + k.getPrivate()); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/command/TestScpCommandSessionListener.java: -------------------------------------------------------------------------------- 1 | package com.yahoo.sshd.server.command; 2 | 3 | import org.testng.Assert; 4 | import org.testng.annotations.Test; 5 | 6 | import java.util.concurrent.Executors; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | /** 10 | * Test the ScpCommandSessionListener 11 | * 12 | * Created by adam701 on 9/30/15. 13 | * 14 | */ 15 | public class TestScpCommandSessionListener { 16 | 17 | @Test 18 | public void testSessionCloseInterruptThread() throws InterruptedException { 19 | RunnableWithInterruptedFlag blockedTask = new RunnableWithInterruptedFlag(); 20 | 21 | Thread thread = Executors.defaultThreadFactory().newThread(blockedTask); 22 | thread.start(); 23 | 24 | ScpCommandSessionListener scpCommandSessionListener = new ScpCommandSessionListener(thread); 25 | scpCommandSessionListener.sessionClosed(null); 26 | thread.join(100000); 27 | 28 | Assert.assertEquals(blockedTask.interrupt, true, "Session close event should interrupt the thread."); 29 | } 30 | 31 | private class RunnableWithInterruptedFlag implements Runnable { 32 | 33 | boolean interrupt = false; 34 | 35 | @Override 36 | public void run() { 37 | try { 38 | TimeUnit.SECONDS.sleep(20); 39 | } catch (InterruptedException e) { 40 | this.interrupt = true; 41 | } 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/jetty/TestJettyRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.jetty; 14 | 15 | import org.testng.annotations.DataProvider; 16 | import org.testng.annotations.Test; 17 | 18 | import com.yahoo.sshd.utils.RunnableComponent; 19 | 20 | public class TestJettyRunnable { 21 | @SuppressWarnings("boxing") 22 | @DataProvider 23 | public Object[][] disabled() { 24 | return new Object[][] {// 25 | // 26 | {-1, null},// 27 | {1, null},// 28 | {-1, ""},// 29 | {1, ""},// 30 | }; 31 | } 32 | 33 | @Test(dataProvider = "disabled") 34 | public void testDisabled(int port, String webapp) throws Exception { 35 | RunnableComponent rc = new JettyRunnableComponent(port, webapp, JettyServiceSetting.ARTIFACTORY); 36 | rc.run(); 37 | rc.close(); 38 | } 39 | 40 | // FIXME: figure out how to get a dynamic port, I made this one up. 41 | @Test 42 | public void test() throws Exception { 43 | RunnableComponent rc = new JettyRunnableComponent(60540, "target/webapps", JettyServiceSetting.ARTIFACTORY); 44 | rc.run(); 45 | rc.close(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/logging/TestSshRequestLogListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.logging; 14 | 15 | import org.apache.sshd.server.session.ServerSession; 16 | import org.mockito.Mockito; 17 | import org.testng.annotations.Test; 18 | 19 | public class TestSshRequestLogListener { 20 | 21 | @SuppressWarnings("resource") 22 | @Test 23 | public void testRequestLogDoLog() { 24 | ServerSession session = Mockito.mock(ServerSession.class); 25 | SshRequestInfo requestInfo = Mockito.mock(SshRequestInfo.class); 26 | SshRequestLog requestLogger = Mockito.mock(SshRequestLog.class); 27 | 28 | SshRequestLogListener logListener = new SshRequestLogListener(requestLogger); 29 | logListener.handleRequest(requestInfo); 30 | logListener.sessionClosed(session); 31 | Mockito.verify(requestLogger).log(requestInfo); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/settings/TestChainedFactories.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.settings; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import org.apache.sshd.server.Command; 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | import com.yahoo.sshd.server.command.DelegatingCommandFactory; 23 | 24 | @Test(groups = "unit") 25 | public class TestChainedFactories { 26 | 27 | static final class NumberedDelegateCommandFactory extends DelegatingCommandFactory { 28 | final int number; 29 | 30 | public NumberedDelegateCommandFactory(int number) { 31 | this(number, null); 32 | } 33 | 34 | public NumberedDelegateCommandFactory(int number, DelegatingCommandFactory delegate) { 35 | super(delegate); 36 | this.number = number; 37 | } 38 | 39 | @Override 40 | public Command createCommand(String command) { 41 | return null; 42 | } 43 | 44 | public int getNumber() { 45 | return number; 46 | } 47 | } 48 | 49 | @Test 50 | public void testDelegatingCf() throws SshdConfigurationException { 51 | List cfList = new ArrayList<>(); 52 | 53 | for (int i = 0; i < 10; i++) { 54 | cfList.add(new NumberedDelegateCommandFactory(i)); 55 | } 56 | 57 | SshdSettingsInterface sshdSettings = 58 | new SshdSettingsBuilder().setSshdPort(2222).setConfiguration(Utils.getConfigMock()) 59 | .setArtifactoryUsername("a").setArtifactoryPassword("password") 60 | .setArtifactoryUrl("http://your:4080/artifactory").setCommandFactories(cfList) 61 | .build(); 62 | 63 | DelegatingCommandFactory commandFactory = sshdSettings.getCommandFactory(); 64 | Assert.assertNotNull(commandFactory); 65 | 66 | int i = 0; 67 | while (null != commandFactory) { 68 | Assert.assertTrue(commandFactory instanceof NumberedDelegateCommandFactory); 69 | Assert.assertEquals(((NumberedDelegateCommandFactory) commandFactory).getNumber(), i++); 70 | commandFactory = (DelegatingCommandFactory) commandFactory.getDelegate(); 71 | } 72 | 73 | Assert.assertEquals(i, 10); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/settings/TestCipherFactories.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.settings; 14 | 15 | import java.util.Collections; 16 | import java.util.List; 17 | 18 | import org.apache.sshd.common.Cipher; 19 | import org.apache.sshd.common.NamedFactory; 20 | import org.testng.Assert; 21 | import org.testng.annotations.Test; 22 | 23 | import com.yahoo.sshd.server.command.DelegatingCommandFactory; 24 | 25 | @Test(groups = "unit") 26 | public class TestCipherFactories { 27 | @Test 28 | public void testDefaultFactories() throws SshdConfigurationException { 29 | // IF THIS TEST IS FAILING. Install the unlimited strength jce policy 30 | // files. 31 | // arcfour's aren't working on 7u45 32 | 33 | SshdSettingsInterface settings = 34 | new SshdSettingsBuilder().setSshdPort(2222).setConfiguration(Utils.getConfigMock()) 35 | .setArtifactoryUsername("a").setArtifactoryPassword("password") 36 | .setArtifactoryUrl("http://your:4080/artifactory") 37 | .setCommandFactories(Collections.emptyList()).build(); 38 | 39 | List> ciphers = settings.getCiphers(); 40 | 41 | Assert.assertTrue(ciphers.size() >= 4); 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/server/shell/TestMessageShellFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.server.shell; 14 | 15 | import java.lang.reflect.Field; 16 | import java.util.Collections; 17 | import java.util.EnumSet; 18 | import java.util.Map; 19 | 20 | import org.apache.sshd.common.PtyMode; 21 | import org.apache.sshd.server.Command; 22 | import org.apache.sshd.server.Environment; 23 | import org.apache.sshd.server.Signal; 24 | import org.apache.sshd.server.SignalListener; 25 | import org.apache.sshd.server.shell.InvertedShellWrapper; 26 | import org.testng.Assert; 27 | import org.testng.annotations.Test; 28 | 29 | @Test(groups = "unit") 30 | public class TestMessageShellFactory { 31 | @Test 32 | public void testStringMessage() throws Exception { 33 | MessageShellFactory factory = new MessageShellFactory("dummy"); 34 | Command command = factory.create(); 35 | 36 | command.start(new Environment() { 37 | 38 | @Override 39 | public void removeSignalListener(SignalListener listener) {} 40 | 41 | @Override 42 | public Map getPtyModes() { 43 | return Collections.emptyMap(); 44 | } 45 | 46 | @Override 47 | public Map getEnv() { 48 | return Collections.emptyMap(); 49 | } 50 | 51 | @Override 52 | public void addSignalListener(SignalListener listener, EnumSet signals) {} 53 | 54 | @Override 55 | public void addSignalListener(SignalListener listener, Signal... signal) {} 56 | 57 | @Override 58 | public void addSignalListener(SignalListener listener) {} 59 | }); 60 | 61 | Assert.assertTrue(command instanceof InvertedShellWrapper); 62 | InvertedShellWrapper shellWrapper = (InvertedShellWrapper) command; 63 | 64 | // gotta get the shell out 65 | Field inField = InvertedShellWrapper.class.getDeclaredField("in"); 66 | inField.setAccessible(true); 67 | Object object = inField.get(shellWrapper); 68 | 69 | System.out.println(inField); 70 | System.out.println(object); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/tools/artifactory/TestExceptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import org.testng.annotations.Test; 16 | 17 | @Test(groups = "unit") 18 | public class TestExceptions { 19 | @SuppressWarnings("unused") 20 | @Test 21 | public void testUpCodeCoverage() { 22 | new ArtifactoryFileNotFoundException("", new Exception()); 23 | new ArtifactMetaDataParseFailureException("", new Exception()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/tools/artifactory/TestFormat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import org.testng.Assert; 16 | import org.testng.annotations.Test; 17 | 18 | @Test(groups = "unit") 19 | public class TestFormat { 20 | @Test 21 | public void testBadIsZero() { 22 | Assert.assertEquals(ArtifactMetaDataBuilder.getDateFormatter().formatLongNoException(null), 0); 23 | Assert.assertEquals(ArtifactMetaDataBuilder.getDateFormatter().formatLongNoException(""), 0); 24 | Assert.assertEquals(ArtifactMetaDataBuilder.getDateFormatter().formatLongNoException("dasdsa"), 0); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/tools/artifactory/TestRepoStripping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import org.testng.Assert; 16 | import org.testng.annotations.DataProvider; 17 | import org.testng.annotations.Test; 18 | 19 | @Test(groups = "unit") 20 | public class TestRepoStripping { 21 | @DataProvider 22 | Object[][] repos() { 23 | return new Object[][] {// 24 | {null, null},// 25 | {"", RepositoryAndPath.EMPTY_REPOSITORY}, // 26 | {"/", RepositoryAndPath.EMPTY_REPOSITORY},// 27 | {"/repo", RepositoryAndPath.EMPTY_REPOSITORY}, // 28 | { 29 | "/ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT/", 30 | new RepositoryAndPath("ssh-proxy-test", 31 | "com/yahoo/sshd/0.0.1-SNAPSHOT/")}, // 32 | { 33 | "ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT/", 34 | new RepositoryAndPath("ssh-proxy-test", 35 | "com/yahoo/sshd/0.0.1-SNAPSHOT/")}, // 36 | {"samIAm/com/foo.jar", new RepositoryAndPath("samIAm", "com/foo.jar")}, // 37 | }; 38 | } 39 | 40 | @Test(dataProvider = "repos") 41 | public void testRepoStripping(String in, RepositoryAndPath expected) { 42 | RepositoryAndPath actual = RepositoryAndPath.splitRepositoryAndPath(in); 43 | Assert.assertEquals(actual, expected); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/tools/artifactory/TestRepositoryAndPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.tools.artifactory; 14 | 15 | import org.testng.Assert; 16 | import org.testng.annotations.DataProvider; 17 | import org.testng.annotations.Test; 18 | 19 | @Test(groups = "unit") 20 | public class TestRepositoryAndPath { 21 | 22 | @SuppressWarnings("boxing") 23 | @DataProvider 24 | Object[][] repos() { 25 | return new Object[][] {// 26 | {null, null, null, false},// 27 | {"", "", "", false}, // 28 | {"/", "", "", false},// 29 | {"/repo", "", "", false}, // 30 | {"/ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT/", "ssh-proxy-test", 31 | "com/yahoo/sshd/0.0.1-SNAPSHOT/", false}, // 32 | {"ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT/", "ssh-proxy-test", 33 | "com/yahoo/sshd/0.0.1-SNAPSHOT/", false}, // 34 | {"samIAm/com/foo.jar", "samIAm", "com/foo.jar", false}, // 35 | {"/dev/null/abc", "/dev/null", "abc", true}, // 36 | }; 37 | } 38 | 39 | @Test(dataProvider = "repos") 40 | public void testDevNull(String physicalName, String repository, String path, boolean devnull) { 41 | RepositoryAndPath repositoryAndPath = RepositoryAndPath.splitRepositoryAndPath(physicalName); 42 | 43 | if (null == physicalName) { 44 | Assert.assertNull(repositoryAndPath); 45 | } else { 46 | Assert.assertEquals(repositoryAndPath.getRepository(), repository); 47 | Assert.assertEquals(repositoryAndPath.getPath(), path); 48 | Assert.assertEquals(repositoryAndPath.isDevNull(), devnull); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/test/java/com/yahoo/sshd/utils/streams/TestEmptyStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package com.yahoo.sshd.utils.streams; 14 | 15 | import java.io.IOException; 16 | import java.io.InputStream; 17 | import java.io.OutputStream; 18 | 19 | import org.testng.Assert; 20 | import org.testng.annotations.Test; 21 | 22 | @Test(groups = "unit") 23 | public class TestEmptyStream { 24 | @Test 25 | public void testEmptyInputStream() throws IOException { 26 | InputStream eis = new EmptyInputStream(); 27 | Assert.assertEquals(eis.read(new byte[] {}), -1); 28 | Assert.assertEquals(eis.read(new byte[] {}, 0, 0), -1); 29 | Assert.assertEquals(eis.skip(0), 0); 30 | Assert.assertEquals(eis.available(), 0); 31 | eis.close(); 32 | eis.mark(0); 33 | eis.reset(); 34 | Assert.assertEquals(eis.markSupported(), false); 35 | Assert.assertEquals(eis.read(), -1); 36 | } 37 | 38 | @Test 39 | public void testEmptyOutputStream() throws IOException { 40 | // all we can test here is did it throw? this thing does nothing. 41 | OutputStream eis = new EmptyOutputStream(); 42 | eis.close(); 43 | eis.write(0); 44 | eis.write(new byte[] {}); 45 | eis.write(new byte[] {}, 0, 0); 46 | eis.flush(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/org/apache/sshd/common/kex/TestDH.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Yahoo! Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the 5 | * License. You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on 10 | * an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the 11 | * specific language governing permissions and limitations under the License. 12 | */ 13 | package org.apache.sshd.common.kex; 14 | 15 | import java.math.BigInteger; 16 | import java.security.KeyPair; 17 | import java.security.KeyPairGenerator; 18 | 19 | import javax.crypto.interfaces.DHPublicKey; 20 | import javax.crypto.spec.DHParameterSpec; 21 | 22 | import org.testng.Assert; 23 | import org.testng.annotations.DataProvider; 24 | import org.testng.annotations.Test; 25 | 26 | public class TestDH { 27 | @SuppressWarnings("boxing") 28 | @DataProvider 29 | public Object[][] keyPairGenerator() throws Exception { 30 | KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH"); 31 | kpg.initialize(512); 32 | return new Object[][] {{1, kpg}}; 33 | } 34 | 35 | @Test( 36 | description = "https://issues.apache.org/jira/browse/SSHD-330; https://bugzilla.wikimedia.org/show_bug.cgi?id=53895#c28", 37 | invocationCount = 500, dataProvider = "keyPairGenerator") 38 | public void testDH(int a, KeyPairGenerator kpg) throws Exception { 39 | 40 | KeyPair kp = kpg.generateKeyPair(); 41 | 42 | BigInteger Y = ((DHPublicKey) kp.getPublic()).getY(); 43 | DHParameterSpec params = ((DHPublicKey) kp.getPublic()).getParams(); 44 | BigInteger P = params.getP(); 45 | BigInteger G = params.getG(); 46 | 47 | DH dh = new DH(); 48 | dh.setF(Y); 49 | dh.setP(P); 50 | dh.setG(G); 51 | dh.getE(); 52 | byte[] actual = dh.getK(); 53 | 54 | if (actual[0] == 0) { 55 | Assert.fail("Found leading 0"); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/dir_test/home/dir_test/.ssh/authorized_keys/empty_dir: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/MultiUserPKAuthenticator/dir_test/home/dir_test/.ssh/authorized_keys/empty_dir -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/empty_home/empty_dir: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/MultiUserPKAuthenticator/empty_home/empty_dir -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/home/areese/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhAHddpmSbk11HiaiGeriqzW7xdO08mSvJP/RSzCRdGbOTnQcOgObcQYnI1CRMay2kH5R2ZRajlR80Nqa/QJ3y/zqLNExVUhkJsfnCfK1UIn02d84+6wfCbcKsWIlFVIiBDbPUPepDBZB+VwQUIKtafHIifpFlNz1aKRdOxjmbQiWCqzzQ6AKpue1ylCmW27HzSrNUvcMlNF6NvSoRt4IXXnpTK5ftBoVCS8rVGqi4rECI72BPRngMq0NOPhf8zeqoX0EP8BfyfECEuXlDAMrNpSyIdLOTMUF3EwVb3EmhqiTHg+3gNQcViWyHHaiCiyaiT+JnLsC3q+h4/XkWaZcn areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/home/areese/.ssh/bar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/MultiUserPKAuthenticator/home/areese/.ssh/bar -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/home/areese/bar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/MultiUserPKAuthenticator/home/areese/bar -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/home/areese/foo_dir/bar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/MultiUserPKAuthenticator/home/areese/foo_dir/bar -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/home/bob/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDxnXUoor++OyjEFIGAXahWOK42W5jP6zwm1MbbfbNLaoCLThbqJhpLnXFo7OcRdiSrgl7/h81mRkVy6wBjCFFJFxH4q5RWA7v5iRAsQxXuZL5Asb3M6YsLNZUfR/ul6KjLOAqkeLorLk+RT52/fE0GHBfpDmi3swLVLZvO+wgTY83kNxFXbKfgJHsSjgexPTlcYmOxsqlMG4eIc4Phtb9njk41qdB7IrxsGvM5gULE7xwKG8S5+KtDTNbbWCuyTwUeF9Yac6ocnolAhtvFtBUuOU/wnvSZVf7WOotbk1kLbHFVlKXscfLbYdC0ljxJP6Dj9PVNZ3wO3K+M/ZL7KEZ9 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/MultiUserPKAuthenticator/home/sam/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaU2f0cYVAI9PnZCqb6D6l87Lm+QKifZN2oCQU146do63G9Lw1Kaaam3mIVvvIsHRIwWfEx2eY8cKZPFGojIl5s2xa9IgAgv5aixiBCK6mvnHFxTiuBqStslWxOXdZSMXWeFTAK1sEg+IR1eGQICwXKNzGegX0Gp07AS0qRYzYWXBLtObiCJdjOaQxIA5/FysjcuA1FfjuR67zYr+HrtMQdqH+TI9HRs+z7JUGhz4zM19L5tq9c83f2i7wdX+/eNf5cwcc2X2pZW4l7IA+JkXclNnx/mSUCDXM0p/0QzhzLjNmsZtipE5H63XTAq8mfm6VN9BNizly5pyno3Y+bCWD areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/alwaysempty/empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/alwaysempty/empty -------------------------------------------------------------------------------- /src/test/resources/auth/auth.txt: -------------------------------------------------------------------------------- 1 | # add repository names and users 2 | # permissions are separated by commas 3 | # users are separated by pipe 4 | # * represents all 5 | 6 | #user a,b can write, all users can read. 7 | repoX=WRITE:a|b,READ:* 8 | 9 | #all writes and reads allowed. 10 | repoY=WRITE:*,READ:* 11 | 12 | #users z can write, users z can read. 13 | repoZ=WRITE:z,READ:z 14 | 15 | #handle bad cases 16 | repoA 17 | repoB= 18 | repoC=WRITE,foo 19 | pepoK 20 | -------------------------------------------------------------------------------- /src/test/resources/conf/debug.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/conf/debug.properties -------------------------------------------------------------------------------- /src/test/resources/conf/sshd_proxy/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YahooArchive/artifactory_ssh_proxy/63feb0963ddf278bf0acad6b48c608b3087fa30e/src/test/resources/conf/sshd_proxy/.gitkeep -------------------------------------------------------------------------------- /src/test/resources/conf/sshd_proxy/sshd_proxy.properties: -------------------------------------------------------------------------------- 1 | sshd.port=2222 2 | sshd.artifactoryUrl=http://your-test-artifactory-server:4080/ 3 | sshd.artifactoryUsername=test_user_name 4 | sshd.artifactoryPassword=test_password 5 | -------------------------------------------------------------------------------- /src/test/resources/conf/sshd_proxy/test_env_mapping.properties: -------------------------------------------------------------------------------- 1 | sshd.port=2222 2 | sshd.artifactoryUrl=http://your-test-artifactory-server:4080/ 3 | sshd.artifactoryUsername=test_user_name 4 | sshd.artifactoryPassword=test_password 5 | sshd.envMapping.APP_NAME=X-SshProxy-APP_NAME 6 | sshd.envMapping.PROJECT_ID=X-SshProxy-PROJECT_ID 7 | sshd.envMapping.BRANCH=X-SshProxy-BRANCH 8 | sshd.envMapping.PROJECT_TYPE=X-SshProxy-PROJECT_TYPE 9 | sshd.envMapping.JOB_TYPE=X-SshProxy-JOB_TYPE 10 | sshd.envMapping.BUILD_CONTAINER=X-SshProxy-BUILD_CONTAINER 11 | sshd.envMapping.BUILD_NUMBER=X-SshProxy-BUILD_NUMBER 12 | sshd.envMapping.BUILD_URL=X-SshProxy-BUILD_URL 13 | sshd.envMapping.PULL_REQUEST=X-SshProxy-PULL_REQUEST 14 | sshd.envMapping.SCM_URL=X-SshProxy-SCM_URL 15 | sshd.envMapping.GIT_URL=X-SshProxy-GIT_URL 16 | sshd.envMapping.GIT_BRANCH=X-SshProxy-GIT_BRANCH 17 | sshd.envMapping.GIT_COMMIT=X-SshProxy-GIT_COMMIT 18 | -------------------------------------------------------------------------------- /src/test/resources/developer_config/sshd_proxy.properties: -------------------------------------------------------------------------------- 1 | sshd.root=$ROOT 2 | sshd.port=2222 3 | sshd.artifactoryUrl=http://localhost:4080/artifactory 4 | # use the default. 5 | sshd.artifactoryUsername=admin 6 | sshd.artifactoryPassword=password 7 | 8 | # run artifactory in the same jvm 9 | sshd.jetty.port=4080 10 | sshd.jetty.webapp.dir=$ROOT/webapps -------------------------------------------------------------------------------- /src/test/resources/hostkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBuwIBAAKBgQCmHrgLRZVPogcZi5zg88Bk2Rv/kD/WlfAu+osRm7hbivR/CdPF 3 | PybvdShop6w410Nw85cjT7wLE1z5ap3CyrPJUzjhCbpS1nuwYuxmHjGVwte4YwbE 4 | leRhE8SngwkPRBhIP/joKesMLU9Rs8KqxiA0xlz3pItQL2J66XUm7p8YHwIVAM5M 5 | XP2CNKAXPnQFS4X0qW+cMDp3AoGBAISfgieVwKM9RinnMTyMbsZgQgRdN9Wo88Tv 6 | tAQRaouDuCf+YL9L4bBf1CYFHMhblnT55oEUPuj/ip3bG7HODIh2vS6F0msARPam 7 | oKkmfvA3SfODdjlSpZkEA8ZPrBlCdSAklxaMLBbfFfZmJqdoMAngkToxBeyF6H4w 8 | +OXgTdVFAoGAHA9QsUR4sd6VcTiu36OSmlW38w5GwFEJw6TS6Vjz3DGqrZGJL9yG 9 | VawA2bUfNZ9h7LqbMYpXe1e+gCjQbbwT7WFgQmI2rRmLw3nlIZsN/2N7n6UdDGvJ 10 | 5UTqjTA12Q6z3m8wWQZQpOXZHait145np84Kx35ZJcaxYEuBAxx3FxwCFH2qwIKF 11 | vLLNhwqFAPCoD5/VC6fW 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-0: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 2 | ���s���>��Y�f7���*'X˿�5p@z �>:��a� 3 | |�)��sL���0�E��!ĕS�D��t�z���ű�h���Ցt� -z��M�|�B�t:g}0�9�͈�+�&���QaY�:�>X��؅��a(s5o\�B0�o�"x��f 4 | ��i^-�̈ؤ>{"����` �+��(�պ᝹���;�2����)GqPu4-G-����A�]5� $ཛྷ���_`�6�?��2<�!�ȝ��$�}i�5ºj�HB� 8 | �O�4\4�'����74���^��O���f��������̽J6&��%�������5����x�mJ���;�X�'?<��D�jA�J9���#Or�04��rf�G1_���R �V���R46����ψd�U*ɗ9�v�K"�]q�*>��ė�G>��)s"pZH�O�o) 9 | ��^��I��1��d=x���'��(Oo.��� ���)!: p�X�� 10 | ��^_ e�R?�=ǔy�~n�H �|� ��]���ƾ��N(b�v%줚� jV�כ�S�۽�J s#�f^���M%��@tk5 �f�[���T"�s���������},e�@�Z_��g8���]�5�%areese@dinnercareזז�Q 2t;������R�{4Ԗ� ��J�ͽ$�cB �XzT�S5f$�I�Xj�y ]#BC��O���N+0�:��8�އ,+�8|��N)͞��8�)�i�f2�?p�1Pju��îb^4��5�V�� a�� qO0�%� T V����[�W�lC�Xu�Z³x�*�3��f��ru���qCk��)��yR��}�)����;�N������e��#N�aw��k �C��c��`#hJ�ہ�̤�~*$ R���-���4��3D���Bn�b�&U}��V�Fg�V�o��j\��р� ;j�,f�h��(����7�\K%��a P��� �4U%@<��[�p^ � a��_�da!E[�Z�5�je/�W��v9�;W�*= 9�� n2(==9�����*/$��N�u;�Y9�-�WYe��ڞ�S�p L; -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-1.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 29101622042123948190645093980145511801170499359028311033644624443052456604982871431391868865790515337583038245873464025170957361796209448328797109290628536040787592944445703300571006200310749653962628113214208390471550328880126004465721270038112226849736950655886374910514305777471197598006365708313327913615966009894065232196181729054563529766468182610607088903396324478030925597404394507533497070343980038780435048993162640201493972447422410729420393681701359517771474247991025306292861179165926115421547469869751255736957722062790433007338877413590717409287603687558753930246105642273656070742873685030758143474981 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-2: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 ���m �G���c�Hf�.��5�p�b,�cU#G�a5��Wa� �\�h�UE�o�1���T�#l; ��dB �&x�N���#<�� +�92���� Y� ��x �ЭDB �����v�$6O5�q%���!�ǘbT����2I3t��o���o����ԋ�Ԗ\��\�� ��:M��αs��9�ApyY�X��-�X��󍐨�'Ũ�-��BG�=��PC��5�p��hH�ٱ���%���areese@dinnercare~�~���p����Q����o�H��5; ڨQ�X�9�N4g�9����e����Z���������1�)Q� � ?��-z�>�G{��kb`�Zy�al^;Edm�j�H���d�[��n�����3���Y�S/�H���])|��" �,�buAu�U�n� &zz藹�֡�,�x�|��Y|9/̮md�P�Ig�� �g���aGRz�`A�z�i䫄��qg;{�m��H-nCQ��p�Y�3��Φ����ɭlߛ`]�ZJ�0Ɣf��;DA��ݷ D�!���J�'"n3�O �r���˗�\]%�� N���;'!�E�B�D�߇��&�ۃ4(�E.�2�K�7r�pK���O�U�� l>�'���D���ZI񢡒�J4��3a���5������ 7��h�?����-������քݢ�t� ���������,�S>e� W�i|Q҇q�!^}��!�O!�s�~���H�f�$m�y��50�Ë�������i3�TH � �y=|�崆�qE7B<�T1#�\ծ��X��&?�hI�(�����sr��Z���C�a��!����㒋�� ��g���|�� ���1�x) �����C�J�2�>;�Ѯ��Ü�� ���ǔ��0�&�_��P�X`g>�V���р��a�>_(@E��areese@dinnercare���:A.�}ߢ�=����_��ꞽ�y�æ*3�F%�Qgh���̇��ė�_5A���l��D�fY)%�: ���. M�p�����;V��� ݄i�2�W*�c/4�Ta�Jx]�z�^���,���w�gq���1J��)!�c�ӫ�} ����ȪE5SGq��VCo�^p����|�5"������'�Ӱ���Z�^�z��na��R����I(���Μq���(��P-�@�X � 5 | �ڼ�K��GE=!�XJ))<����{�$U-D���_cz$!�=�# �Ibu1���Yz5�� ���S�8` 6 | �ҶFI �����R���Kʪ����)P�����n';.̒�[�Z#�`�l��-b�.��ǝ[��;�B��0�!, �S��Jw�{�}�R �|��W�E�ᡧN� 7 | V:��_ח]I�k��`�����1R�lq�Y -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-3.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 27860381483377256603788469958106646803214003743088904140085500195459274183814334442265613549480568661087001240192142650966783363695402229712727743803181376789384080598686933021292850595207346988007251322478474906820877212923940865250568256772067767427940205575322764082096918378911305736916670440274852138016428441030504184927475380951501086127113373794330403832939038954132386749277430344120512966559743391953759935691572409274115601580905641403276360565854696890869384255634427246952998373842918974625547324282766864550376165436213782181064933707467454764265901553894938646215529570736746464800432241212141666171859 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-4: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 2 | ���M��)N!��[i�c��ץ���8"�c���e ��Q��r/�8-9����!��x�����9��F���-G��yJ�� 3 | U��8�$;���D�y4�H>����l!�n�Jdm� 4 | ��Bm�~��*�ق�cU8}����_��:4�Fd�?Ѭ}s�� 5 | �#��B�|���7�t��s)���K�v��dG��a�ԃ�n�!�5�*�QN��C�"�g�Ma#�ū0�th���m����P�T�?X�#��N�>r�;��-��w�:hp=��J] ��w�wI�2�oi��� w;�-�&��+zv���1f!��3G6=�|i�H�PK�* _S��i�01�9�:�Q� ,U��$<+��i�3*��5�?4Q�D�H�!�i�=�O������2��`6�^Ae6aCS �&Z�|@��zE;���,�����sj�]�]TF��[��s/���6�����0���*��_z�IY�(n�6x������"'�CN�_�s��m�*�U��`f��%��N�"�Ͽ���յ� 8) �E�P(��a�KqR_�V/�#iW �~Fz����#�tz�X}����rk%Y:�62��tJt)ȣ��[ 7 | ��B�s�k�slhJa!ă��!�����'�.Zq���d���Se#�mSR?f[�)��ubv��ex1Ǵb�]��<�ӝ�y����#i����.�%�� 8 | 9 | BEz���=;����V/s%��G���� *�& 10 | �'\���������VE�- +S������+ -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-4.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 21659689877116981071678981171025559057910612316037555870185433780456080184720067085241438558781408878777408239708137900619373313892087072695566394947650319734373181848108281916742146082335346875238286263374082942703777238681772078093816310133738968387699217909776358574802109874930675401787542608895593929157881989543144293676122034257392184646905072248260732132489282939543109098091339508981748038301330605644849602104573963304883745638017745756470566427929981669739338526051377868653247913906549957903521961596588219210535579795388386758286473865006511245102730977869213482898012449032933075465772544457605093169889 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-5: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 2 | ��"rw`ax�4K6mT���}�Px��zF̭���( @����8F]?��A�ǝȓT �e�v�W;�v�dz�r�@]�]L��E�fB S��I ë�wW��_b�8��A*�>Э��I�,�0$_��l��|t%6D��2�U��?6�F�_Y��G-%>)���)�=��(Ž��H�'�cŊ�W2�8�n�Y'f�کݕ�F�� Y��̊�P�k���IKq������`SP�5�o�3O�����mG�]�'爋areese@dinnercare7�C�C�?z��W$إ �Dޚ�Dwu������(o���>j��^�?��-c~Y"3i�$_�e8�r����Z��A.YC 3 | �*rŌ,��ȸs<@"DΛ��O�P��9�41� 4 | ץr:������� 5 | +_yf>�Q�C(����=M�a�j�Tj^�+�o��&V�5iq73��y3e��:�6Z 6 | Q4k�-�Ϥn�1i0���Ͱ'{q�K�uPR{2�!S�2h��ԜgM;V�&L��ަo'�j�[U��� �G��}��B��cZ`���^M˰.�Ek�L�b2fl���c�`3���  ';�&�[� 7 | g��қܷ� ����uA�κ����'l�}�l�5#���A�N�#je}b�h����Cz(��\�$��7{|G�Z��}�$ ��@���� t���<�8J�[��! 10 | y��� *)$�k�-m��+���g�>�0�ނ���(�/PdZ4��)P!}848��6����ϔ��H����%��ݘ˛���#����e�x�H59��x��/�[3U��Z�A����<�4ѸP� m -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-5.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 21156324154634775562246787839399140282369221738866308946620865831105890414146166825402853505443232378040369275169725676610555388435728186368746949662299868723156755481673999457818246905542443558613026775698243232676211470504080386554417786805777684846121319660006686608055337910759000463982386960797441459559929010697182476409329990174151664970841253497077825102236831850004206656174548693074757328193855711818452056054829971056305573757686833317127016675401168581294262468066249065422923648949800012433477134541670111588658504227459124129659443273672691747472289553095844225319608944533866982255723196564014453196939 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-6: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 2 | א.���s�j9�t�� 3 | ���@����4r�:%UGuѐ("��X�—�f�y��K�+jo[i��>���?���w0n-�9��I$��SG 4 | ͨR1@� 5 | ��%$O0�0����� ����&�?m�A]�A$���p�ڍ9݉��$vp�����]K�|]_d�ȯږ��h�Z5�>9��-Wr!(S�?��m�cU��ݿ������̑~���-���@��OI��p 6 | 3Z�~�<��CPM�g� ���Qareese@dinnercare�6�6�kY�s���1�5�E,;�H˯�8n^���8��L���pu ��tN,<�|]��H��4J^!3�.Qf�?�m%��GS0�+�����ҥ�6��U��t������E�"�ksO�A�\���+���)�~�S�f�_��@���������[����N�G'. 7 | ���Q���(��5J�eȨ=�E|n�L�Y= /� �~8)e����dR�}�w����z�����E~ �M��j�[�D�|,!�U�[8U�v���`V�C��x�r�s� ���^��{Hi�� ߀�������[I����<&�48q��+�~��ӲHlʻ��c&��O� 8 | ��е)� 9 | ���^n�Oc��&������N2؛�z��� 10 | ��z:�:_��ךٯ�} 11 | �6y��|o�w���1 13 | ��i |�]����f��K��n��S~�2�\<a -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-6.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 27212334384666486024665991508044902408988314959597541884732711653372278322729496494671265456959165094144427673626724462828542523797639839314362768747467970587367228677718729770642595159827298355377227394025958500104845699470254231114597212648338903039530012473701898984577982505706154505467525196037427676717884546582824690338841778431581329808193041137263137115939591968286509543488716282306122068535856808015616248197664687291071968207801027320769828654385672433183964712508038405949400157098244893279504253031651449153279610065654387416951356165097233147088831001699298691719082031362128535078995763228630317006929 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-7: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 �\���V����҆d-���8>EL�t@���Z/p�ȳh���x�X��NZ5�Q�ӹ�.il+���q���=������Q��N@��.�p��O7e���E���W��;�l�-�㤟��{\ǀ����:(��İ�U�j��v��텬(�[��RM�b'�|��zƵoa�*{�Q.�h�@�t����� $��6�[ޢ�^�V���}��\����>nt Q;U�D��l��������מkDd���areese@dinnercare���� k�e�� _�H�̚?X5�k)�M�uX���ŕ�����v������c�^�I�:Vd�`P�(qv�&Yԩނ�x?�!�gv�V*$���yy]�V�n� pn��C^��W$ص���w�8<�ύ֘EX熲4����e"�1r�������'�G�̨{�%m\�7n"�^��=�Sz�+� ?r���c.!�N5�(���1Fg��6�H�M�#{�GEؗ���F��QI�\ �u�o`�N�TӞ�}q\���3�%?��!�Z�0�+�gC��N���{o`q���C�=⤋�����l��$���#��F&��m �R�Q�L -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-7.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 25545964813790640158463029774988795307437369854879301726218844938318939831468884813167884709338266046250532320120071560045072985792662968996048158932756130989682951315997235994671158062979355643995875623827491363037727144130108464375145309819777899076815413576697096225802135382507154796609016185603294437811564796329057718958304460207967427635247455002507611765333034666853345041457880446841922516272577025772567092020387350919596080048999242773122080868613575500503078408761471868190587804854818658940788300907110331502456385437627879727126448411349436197012135657348119699567067345061252970494774344333030623669637 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-8: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 ���=N��op��!��`��4g�����/�ȹ ƌ����F@(�Lwx4�3����s�S|iXT�𔼔_�)���'f���E��.r)/6��[�DI�f�VV�(;oYZ�N� I��Th.�n N�^�r�3��T��!4�]�(� �i\�v��xx�p��Z"��vv]Bx��oZ ���^Ǟ~�[C4> ���Jc��*�����^۬����ׁC�35'̒��}_W)�q��]��%ׯ:�i0�P�areese@dinnercarec~c~����u�wFӌ`,�HC��7�\�&f�+���;�B�Zy|�ڤ�$u����a6�˾��k�-��|�7-�������z���%I� i �=�}�h�t�+�;�զ3����v:�qk`F���r����� ,+!���֥�w�f�~~J���!t�)f ]e�T��#pUc���F}0�!�����kJg�*bg���^��>�4t��2n��(tƃ�� �P(���uU;Fʰ��iI.b�%�'v �޾�5E���(��g�8y��/���3ح5<�����Q`��[����h�`�P���ؽy5�,��S�n�}�yׅ7�g�C�K8���"��\22A�N?cYe�:�eV{��^L�?��6���l9�-�I�4Ҵ��A`�sIc]s��7!�Z�1�M�m�d*Y;ָ&¾�\O]`#��~<�������e9|����0�I� t�:Ŝt_0����}��2R�H�Iu�&��w�A�ng�M>��D�-����[Njzj=�9���N�K���g~_F��wDbvҾ�o�<��ksD���"T6��"y:|Г Φ��ؤ�� D��D�����7����O2��G4S$�c�6r�,�4�R�eK�&!��i�Ɉ#�=EQ �? -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-8.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 26250695756093961410135384040286998630066868720220431979768277849980071783706396542680639282274532966825712166551985297309464238495502041376467291106435126294126846675697473189814198437374247416864650928459100039245543263224759434328518203606701486613047536958718116290164885453485898558476399833451587121637559526122036431365992433063554574849683352842649221809160715493142957028429021970903482154241123658321645415672576633364368060419510380229372006802576272874689665969538856805116190668229304096622338427809556342287674080948259094598944465592684751390036463296069790162511776366391596853902713011684491944874161 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-9: -------------------------------------------------------------------------------- 1 | SSH PRIVATE KEY FILE FORMAT 1.1 2 | ��^?c���4�-=$����|�˅P��q������?R�$�[��J��V�8��g�YX���� ��ґH�E.~�)�� �9P���n�C<ԛ��K��Ծ��iW��?�)��k�����x�� ��N@���j �G� ���h���X*��V`�b'����5#��fJ�OV��j�Q�s���,�nc��W�'iE�4wu�+�e�=�]������lU�k�.R#P���ɱeareese@dinnercareɍɍ�`��M�+�l����&W�)#D��O��̭�����ǽ�v����D��t�����ܑ��r�Eaa�%`�K��:�����İU��-`���1��y�xY�5B��Ʉ nlj�̎壖��) 3 | �ZDUl��ѣ"�c�D,��� ��4�uz�e �K�Pr&�lI0Zg{z����������`.3���p���4�H���C����b���.�l$ev�d<��ǣ�-��M��f�.vp<�R��a~�3�w�Dߕ5kӝF��V����_m,����}�-�²{_ �i)��F���@��J�%J���[���C8��� 4 | ���[l��uBP*�ޕ��Sk�������i`���RɄ�Z��=8q�HծN����{\̩.h�~��]�r ��k$�gI2L�+f�3�!�*�,^95�\ԍKk-N�W�N� ��Q��hyC�r 5 | U{��9��14q����kߨ�r 6 | /�$��8�����cY"�>P�-8g=�M�^DS\?�\���������0�J�: 7 | �$^�ZcEģՌљ�$Ak"�tӁ���@ 8 | $��>�-��&�r�r/f:�~+�Q�qr��i:\f?��T�2>��#��Z��f�4��W!�� 9 | �.�xkNk]�q|�ԏ��S�� -------------------------------------------------------------------------------- /src/test/resources/invalid_keys/test_ssh_key-9.pub: -------------------------------------------------------------------------------- 1 | 2048 65537 21909924231167481869232569522162865597928918824529644902077083055158366821424615334687463778914369167241319467289777729787454751011012696544216418381587387675632503162293852647540550749458638311329775230801361556751473445415894106783857701122069232796224376926628669201345769932529019946995845841462621413478560586565217999008610573816728679423989315795168162187104998456018361799773849972643264211068178912370169080815382402504012612776578077427969082023766922230418395690901093807753692786749744140323097759951172933376118342475737332243514032035909168988076593439268144653486169181832316332980857914050304868462949 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/json/directory.json: -------------------------------------------------------------------------------- 1 | {"repo":"ssh-proxy-test","path":"/com/yahoo/sshd/0.0.1-SNAPSHOT","created":"2013-09-06T21:03:00.973Z","createdBy":"statefile_headless_test","lastModified":"2013-09-06T21:03:00.973Z","modifiedBy":"statefile_headless_test","lastUpdated":"2013-09-06T21:03:00.973Z","children":[{"uri":"/maven-metadata.xml","folder":false},{"uri":"/sshd-0.0.1-20130906.210256-1.jar","folder":false},{"uri":"/sshd-0.0.1-20130906.210256-1.pom","folder":false},{"uri":"/sshd-0.0.1-20130907.001010-2.jar","folder":false},{"uri":"/sshd-0.0.1-20130907.001010-2.pom","folder":false},{"uri":"/sshd-0.0.1-20130907.043957-3.jar","folder":false},{"uri":"/sshd-0.0.1-20130907.043957-3.pom","folder":false},{"uri":"/sshd-0.0.1-20130910.215640-4.jar","folder":false},{"uri":"/sshd-0.0.1-20130910.215640-4.pom","folder":false},{"uri":"/sshd-0.0.1-20130911.161404-5.jar","folder":false},{"uri":"/sshd-0.0.1-20130911.161404-5.pom","folder":false}],"uri":"http://your-test-artifactory-server:4080/artifactory/api/storage/ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT"} -------------------------------------------------------------------------------- /src/test/resources/json/empty.json: -------------------------------------------------------------------------------- 1 | {"repo":"ssh-proxy-test","path":"/com/yahoo/sshd/empty","created":"2013-09-13T16:35:03.331Z","createdBy":"admin","lastModified":"2013-09-13T16:35:03.331Z","modifiedBy":"admin","lastUpdated":"2013-09-13T16:35:03.331Z","children":[],"uri":"http://your-test-artifactory-server:4080/artifactory/api/storage/ssh-proxy-test/com/yahoo/sshd/empty"} -------------------------------------------------------------------------------- /src/test/resources/json/file.json: -------------------------------------------------------------------------------- 1 | {"repo":"ssh-proxy-test","path":"/com/yahoo/sshd/0.0.1-SNAPSHOT/maven-metadata.xml","created":"2013-09-06T21:03:16.526Z","createdBy":"statefile_headless_test","lastModified":"2013-09-11T16:14:15.840Z","modifiedBy":"statefile_headless_test","lastUpdated":"2013-09-11T16:14:15.840Z","downloadUri":"http://your-test-artifactory-server:4080/artifactory/ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT/maven-metadata.xml","mimeType":"application/xml","size":"755","checksums":{"sha1":"db3f9b4b64f5688df0c372f468134554a8d54014","md5":"d422f836fa5ff52428c4454f27471dbe"},"originalChecksums":{"sha1":"db3f9b4b64f5688df0c372f468134554a8d54014","md5":"d422f836fa5ff52428c4454f27471dbe"},"uri":"http://your-test-artifactory-server:4080/artifactory/api/storage/ssh-proxy-test/com/yahoo/sshd/0.0.1-SNAPSHOT/maven-metadata.xml"} -------------------------------------------------------------------------------- /src/test/resources/json/parent_directory.json: -------------------------------------------------------------------------------- 1 | {"repo":"ssh-proxy-test","path":"/com/yahoo/sshd","created":"2013-09-06T21:03:00.973Z","createdBy":"statefile_headless_test","lastModified":"2013-09-06T21:03:00.973Z","modifiedBy":"statefile_headless_test","lastUpdated":"2013-09-06T21:03:00.973Z","children":[{"uri":"/0.0.1-SNAPSHOT","folder":true},{"uri":"/maven-metadata.xml","folder":false}],"uri":"http://your-test-artifactory-server:4080/artifactory/api/storage/ssh-proxy-test/com/yahoo/sshd"} -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-0: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEA4QB3XaZkm5NdR4mohnq4qs1u8XTtPJkryT/0UswkXRmzk50H 3 | DoDm3EGJyNQkTGstpB+UdmUWo5UfNDamv0Cd8v86izRMVVIZCbH5wnytVCJ9NnfO 4 | PusHwm3CrFiJRVSIgQ2z1D3qQwWQflcEFCCrWnxyIn6RZTc9WikXTsY5m0Ilgqs8 5 | 0OgCqbntcpQpltux80qzVL3DJTRejb0qEbeCF156UyuX7QaFQkvK1RqouKxAiO9g 6 | T0Z4DKtDTj4X/M3qqF9BD/AX8nxAhLl5QwDKzaUsiHSzkzFBdxMFW9xJoaokx4Pt 7 | 4DUHFYlshx2ogosmok/iZy7At6voeP15FmmXJwIDAQABAoIBAFpvGor8hvF08IgB 8 | T0gF6VVVTqMj8PprQgsYdnYU8QSugNvywFRXAPNEMEIU6iYA6g5OVxijFs9W73zH 9 | /oteSF3Tsc8jjQ65+bBI5W8DN5NabWNIEhB93NeL0DP/PeUszdS5Ei9bV13qzaHK 10 | DaydWOH8pM8yefPpmPI1E9YonBzHX2hlYV8e+CI0a9eUzZuISugSFX2nPzx8Qi0s 11 | MvbUoOQFUgJ8gVv3JBR77ocbcfXEdCe3OTIUH/UJwrs5706cGdnC9UVVplzkP0rc 12 | la5/w4X1HwDWAcpUzIEkk4toj+aSc+lsc+id1k4kIV4hby5KeBEEaRQLpsE8syad 13 | mwxMzfECgYEA8M1B2xZ/TJIHzpTirE3RamF0AF4WtEcLJ/OV7kt4+zSlIl6eUY7X 14 | 7KB4vmx7Zk+QInI3XqOdOCS3bfGSuXWADDU260fTKIJZ4oFe9E1z8ixvgCEUMgwP 15 | Ha9IFvMDYQWdS0kXgMBlrSn0Cs09WOA2yvtjmuMtD7GJKb4wXJxjJU8CgYEA7zPs 16 | ANF32b0woNf97NBQyM4nJ5ce0pNe8QWZdLdFjmRSF4gu91myZBO8r4bbclTVJwTB 17 | RPC9C9dp/Fz70Ly+R9I6RoU/zJdc18IQi46u6PW3lWPvu+KjiTcIM3EKA6BQMgXI 18 | Kt8MDhDrIm94y1YUgLRl7WFNxXalArV30EX5KqkCgYEA8FtxSMaD+mIo+MMUHvjt 19 | 90mfCF7iOsBPGmnBVkJvWA+MZWocjTwPu1nSLAEMi2sPa9KmAgk+fTPpBA0Fb6kh 20 | Tw4u61qeIuk53yVTKnfFLA2+nh5mki4HSJIVWxLmZIm+H8+tbg6dbuNZfQ6wFW54 21 | QtP68DeiWu/TAZ+dllNjg3ECgYAkYOIgkbrHe5VcsNymWlwe3fNoevwuDEmhIDfh 22 | X0oNyMYPXB/AcHzH6ZSFoV3YenxcTcXS5UXq+hzdS4rkiP/rTlaciQFV7SMqkRIR 23 | F2cUeOItryAzk9lJMfxmTme2e3gW03hIxNlBfmM0Pn3BdtrxY/4oZub8A/o+eji5 24 | jRrC2QKBgFmOEtcS1eFCA0jMLPu1uTYHNhtQdxRxUOF2OHEavXTl3HVrpCKVI5Uf 25 | rnl4EBWSoMl9jt4BVNv2HugzdSXLtnTvgTRq2OdbbuubRsNGoiDGxDSmUNtYHVEu 26 | nnOejcKW9Ojd5KlMJb9li/MT4HpaMRLqKyrK5SW8hAtbxjNh256K 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-0.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhAHddpmSbk11HiaiGeriqzW7xdO08mSvJP/RSzCRdGbOTnQcOgObcQYnI1CRMay2kH5R2ZRajlR80Nqa/QJ3y/zqLNExVUhkJsfnCfK1UIn02d84+6wfCbcKsWIlFVIiBDbPUPepDBZB+VwQUIKtafHIifpFlNz1aKRdOxjmbQiWCqzzQ6AKpue1ylCmW27HzSrNUvcMlNF6NvSoRt4IXXnpTK5ftBoVCS8rVGqi4rECI72BPRngMq0NOPhf8zeqoX0EP8BfyfECEuXlDAMrNpSyIdLOTMUF3EwVb3EmhqiTHg+3gNQcViWyHHaiCiyaiT+JnLsC3q+h4/XkWaZcn areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-1: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEA8Z11KKK/vjsoxBSBgF2oVjiuNluYz+s8JtTG232zS2qAi04W 3 | 6iYaS51xaOznEXYkq4Je/4fNZkZFcusAYwhRSRcR+KuUVgO7+YkQLEMV7mS+QLG9 4 | zOmLCzWVH0f7peioyzgKpHi6Ky5PkU+dv3xNBhwX6Q5ot7MC1S2bzvsIE2PN5DcR 5 | V2yn4CR7Eo4HsT05XGJjsbKpTBuHiHOD4bW/Z45ONanQeyK8bBrzOYFCxO8cChvE 6 | ufirQ0zW21grsk8FHhfWGnOqHJ6JQIbbxbQVLjlP8J70mVX+1jqLW5NZC2xxVZSl 7 | 7HHy22HQtJY8ST+g4/T1TWd8DtyvjP2S+yhGfQIDAQABAoIBACq8dySg5Nl5DVTh 8 | a6aQ6l2V2Pq0aOsd6J3VtPbN3RDR3brGLTdtVelaB91PSe/Evee4P6VjF+mnNFGH 9 | T6I0rmwHMJ6TesFcF7ujisDJfO+V0jEPP0snY/ivmZjW2qQV6wVG/FrrH8LThi9l 10 | rblY+ybBgVkvu0YC29VpI84QiPUksiLu7uMOca0PS/4TpYvOxqkfQHhsZbwEbt0T 11 | 5rZ/aZ8JJxwKUbFVBoLw8DqSdDuj+9v0gP8npPVPtlkpxAsiT4Ycm7YFuV2IBbvx 12 | U6xcmdfCM+qrW9VygJDvNq3LefTOoctb43kkJ1S15c7BWS/lsWd7EkBYhVIFCf+S 13 | ptf2wuECgYEA+bHXSYQXGDJI6u0Jjx7EA3RxDv/cXStx/UfwhmE0J2DkvQ3XyKtz 14 | EmIDKKbtFwAiaxTJx3MXYnJqO3CMusxs0F04KGcAtJwHRm1XbhjkwpRg6PG5mh+c 15 | LChJ2ZxH46M6L7ptao1RBjiWXvNeHzymnfjFJFL+Hgt8q4VBSzM65X8CgYEA97di 16 | vmr6pYJf3ktVZVOormZPdnJNxPaQ6zZhVqtNePc7AqRX/8fDobyLnoDaKPvqvJ6+ 17 | ARU4eGiLbRv+6iodr7V5spb5EVhHVRyGiXa93yMIBeTw3slEBourn52t3w0ySYMt 18 | Q72oPvJb6GBrtBPdtWviCqzKaZ4WyL4i9nQPagMCgYArmvAi6Yty8U0kobKaqN/I 19 | Tqxz1yDvsGeeuNJ7VTxbaCNqFKHLbI2S90Tf847SBnb8RkwapbG+woZkzPn2oT6b 20 | gLwO6jYIVHs8xFmRY42HoYvvAk/MZ5rJZ1vGQfGYAmhl72OuSPGOaZFxEYUtZVUf 21 | n1MmTcwNCSqDdaj6bf7qFwKBgFbPfpxKs1IDUYN+lQuweMG9ewWAYz6uRfUYFp6f 22 | 48OLqLNxUqGBqU5p2+gNMecA+a9mViHdBPA1ev8eu4PmhIbKKz7p55krfbwXBhLw 23 | ePPUvAAMzljU4bEFi3yhbohngIMApIFD2s1Mc+cIu1XdTGpCx3GEQl8nFsb80xXZ 24 | cHlvAoGAQTc0Z0uKWDZpcyO20H9D+9bRN2cvdH2SmGA0rIC/FSyH/6+QvkwzTVzo 25 | WIIjBwnCBe0KpsDXeYh8bC4UDBs5gC4u0n5c+RxqJHbwGfrBCCf033tiBQOZ/Vql 26 | 5/wLR3GRiLaYxIF78POX2R+zK4ZEneKu9pytc75iPk6mke82dCo= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-1.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDxnXUoor++OyjEFIGAXahWOK42W5jP6zwm1MbbfbNLaoCLThbqJhpLnXFo7OcRdiSrgl7/h81mRkVy6wBjCFFJFxH4q5RWA7v5iRAsQxXuZL5Asb3M6YsLNZUfR/ul6KjLOAqkeLorLk+RT52/fE0GHBfpDmi3swLVLZvO+wgTY83kNxFXbKfgJHsSjgexPTlcYmOxsqlMG4eIc4Phtb9njk41qdB7IrxsGvM5gULE7xwKG8S5+KtDTNbbWCuyTwUeF9Yac6ocnolAhtvFtBUuOU/wnvSZVf7WOotbk1kLbHFVlKXscfLbYdC0ljxJP6Dj9PVNZ3wO3K+M/ZL7KEZ9 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-10: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBugIBAAKBgQCNDS9D8/Rp1d3fOb3p3BlUhxLAUIzdmTze56+IiaDgxdafJccB 3 | /H1G+oa8WUdVYkUrf8Oje3zsIh0Bt69YF1ZbkWr3st+iam5ERhOzsjFevOCpMi3s 4 | fbSb1W2uGq4B8qStNHMq3/z0YNxeVe4f+481M1svlSG2WAEVq5E7CD74IQIVAKew 5 | W9A6sMhnxjt1KL9Yhqz2CKjLAoGAej3tI2SJRDji0VM7qcj4kZ9RflmA54JxIIFy 6 | hskQ1RJ76xJehfPaM+t/xqf5zLK3nBmOJWIOurNKN/HXdQv5SlwK17Eertdh+FoQ 7 | BVT/aQeLz4zBiHGcI8JUOcCcc0AAY1oKHnhLUczDsak7dVlVPNIOr7McIY133IrL 8 | aP+EXV4CgYAqhd4EaTtpaEAaN/4VEjcxQ+DtJtw2rVJOKDHo81EzrcISdqVd96vz 9 | bU1WaTeIaboNiLVPVpzgkupr0Otgxv5nD5pcCCBtxUdXz4uv1Dp9wfrJUaX+/xbl 10 | qxsOCAvsmlOiqVTDKGDpNrqNiB5e7Pu3bnYaZo/lfsGQCmkTi9ZW5AIUev4rKdqz 11 | jYnGQB0y+PHoipjex6Y= 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-10.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAI0NL0Pz9GnV3d85vencGVSHEsBQjN2ZPN7nr4iJoODF1p8lxwH8fUb6hrxZR1ViRSt/w6N7fOwiHQG3r1gXVluRavey36JqbkRGE7OyMV684KkyLex9tJvVba4argHypK00cyrf/PRg3F5V7h/7jzUzWy+VIbZYARWrkTsIPvghAAAAFQCnsFvQOrDIZ8Y7dSi/WIas9gioywAAAIB6Pe0jZIlEOOLRUzupyPiRn1F+WYDngnEggXKGyRDVEnvrEl6F89oz63/Gp/nMsrecGY4lYg66s0o38dd1C/lKXArXsR6u12H4WhAFVP9pB4vPjMGIcZwjwlQ5wJxzQABjWgoeeEtRzMOxqTt1WVU80g6vsxwhjXfcisto/4RdXgAAAIAqhd4EaTtpaEAaN/4VEjcxQ+DtJtw2rVJOKDHo81EzrcISdqVd96vzbU1WaTeIaboNiLVPVpzgkupr0Otgxv5nD5pcCCBtxUdXz4uv1Dp9wfrJUaX+/xblqxsOCAvsmlOiqVTDKGDpNrqNiB5e7Pu3bnYaZo/lfsGQCmkTi9ZW5A== areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-11: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBuwIBAAKBgQD9tnMBCf+BUsmcr5b+2kqgdHrXcWO5P5PZ3jgTgRqaudApvhJ+ 3 | 3F9+tcWYRA9s90iRky59JGJFu3q5cZeigPvQxOM0Noy16LW6j57YdrEJT0Ly4B5k 4 | p2sfFSucU6bBttJH3CKZMtJkU+7eLo0IU/57jDL6M9SWSLwNCnLiSD1O8QIVAOr5 5 | Zda0TYlXXgcHsIcdURnaxDuTAoGBAOSVX3NnYmgyXn8fO55hTy1U3amrL0wmUqo/ 6 | qLWg8NmhuEnMZwU7a1M0qpwusZZcut9pS5mlEBo0YYOGWvEXiwPnXd5pgY4DmK7a 7 | mgb22ZI2axxwypN6zPK9icYYnbHumtVTs0WE6LowhIy89nlQHionsw3Dpf2TvYN+ 8 | 98zyY9BAAoGAYjf7GuXOvU0v0NyqG5gztlx6ffRxVqn1IVrwClKO1J71dvyOLnWT 9 | ujrQOLRVnZ/WhnGBFpy39G8wgdPCQhNnPKuHgzPuXrKX71LPCr8eP5oWtB61yabA 10 | qQdY9RcVtCQYcLjy5yWiB7sqdH3pQ8tt6YOvVcZhF8Gc9rz4+v0lEfQCFBX9yNIL 11 | NvsZlcYdkrAqoVY1Wh78 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-11.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAP22cwEJ/4FSyZyvlv7aSqB0etdxY7k/k9neOBOBGpq50Cm+En7cX361xZhED2z3SJGTLn0kYkW7erlxl6KA+9DE4zQ2jLXotbqPnth2sQlPQvLgHmSnax8VK5xTpsG20kfcIpky0mRT7t4ujQhT/nuMMvoz1JZIvA0KcuJIPU7xAAAAFQDq+WXWtE2JV14HB7CHHVEZ2sQ7kwAAAIEA5JVfc2diaDJefx87nmFPLVTdqasvTCZSqj+otaDw2aG4ScxnBTtrUzSqnC6xlly632lLmaUQGjRhg4Za8ReLA+dd3mmBjgOYrtqaBvbZkjZrHHDKk3rM8r2Jxhidse6a1VOzRYToujCEjLz2eVAeKiezDcOl/ZO9g373zPJj0EAAAACAYjf7GuXOvU0v0NyqG5gztlx6ffRxVqn1IVrwClKO1J71dvyOLnWTujrQOLRVnZ/WhnGBFpy39G8wgdPCQhNnPKuHgzPuXrKX71LPCr8eP5oWtB61yabAqQdY9RcVtCQYcLjy5yWiB7sqdH3pQ8tt6YOvVcZhF8Gc9rz4+v0lEfQ= areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-12: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBuwIBAAKBgQCuES1RED3GNYcXzXDSA09Htdx5cPkzgxYXtWT19nbTWPwVMsOt 3 | 6BAABNYYxRVtAVf9GvoyXOt+sjuXVYfZYaDdBFJbljinEf8keYUXfznXe1FUomQW 4 | HAJD5Vt2S1QesSbPJoOGIoUBteLH7fH7n+Qh2xA4Y+vsVVxJHCctHo1DxQIVALTi 5 | 6+J3UB7RIOiWfLqr/3DDlzpnAoGAVtS4xPn4AEjxcWJ6qOCH/002Ywqn+XDJ/VIX 6 | E0VxXgCbroYuU+3POiS2u3UQXSDC1OBP9EEdYhRwXkBF/U+b/Pe/Q2F5f4TWAiST 7 | 7v0fDm5hK8m8GWHpG9AqVHn5LIRh38ghNYv25gXy5LtucQIzw/kRAxf3LK4Z21z7 8 | CcLoGPoCgYEAoomVq4lqas2aRwgu/p9WMS0GZN6rJKq3DIACYd/uE66sS844BvRi 9 | +aG41S//fwbDVAYWUJNSGBBNSQjvgPJR9OP0EWkj2iJF6mEhhk5/Oyls13TjaGcI 10 | 5Imnwky/vCSSEWSETCkvNMoHmj3C85uSuJ5GtpaUiXozXqdp8XFKb0UCFF25d+Py 11 | En3e6389n2h4wHrFUmsH 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-12.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAK4RLVEQPcY1hxfNcNIDT0e13Hlw+TODFhe1ZPX2dtNY/BUyw63oEAAE1hjFFW0BV/0a+jJc636yO5dVh9lhoN0EUluWOKcR/yR5hRd/Odd7UVSiZBYcAkPlW3ZLVB6xJs8mg4YihQG14sft8fuf5CHbEDhj6+xVXEkcJy0ejUPFAAAAFQC04uvid1Ae0SDolny6q/9ww5c6ZwAAAIBW1LjE+fgASPFxYnqo4If/TTZjCqf5cMn9UhcTRXFeAJuuhi5T7c86JLa7dRBdIMLU4E/0QR1iFHBeQEX9T5v8979DYXl/hNYCJJPu/R8ObmErybwZYekb0CpUefkshGHfyCE1i/bmBfLku25xAjPD+REDF/csrhnbXPsJwugY+gAAAIEAoomVq4lqas2aRwgu/p9WMS0GZN6rJKq3DIACYd/uE66sS844BvRi+aG41S//fwbDVAYWUJNSGBBNSQjvgPJR9OP0EWkj2iJF6mEhhk5/Oyls13TjaGcI5Imnwky/vCSSEWSETCkvNMoHmj3C85uSuJ5GtpaUiXozXqdp8XFKb0U= areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-13: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBuwIBAAKBgQCZn1SQ+NjsRttipw68xdXZJRL3LKryID6YCuS1BSVqMTjtww8U 3 | fojNL5tNSr0Pnwq4/2l6oq3QINdO21Gm1sYeD23lap0XoGNOjwKXy+vVU53kNUBk 4 | Npsygt9oTAM6GoU+IWdIIsghYI9ZUNL9venzGxQ9Kb3vWRd6Y9HaNrjaCQIVAIMn 5 | QNXj8OL4pfH3v0KNwIIxLH3LAoGAOpn8D1e8aHW5QaSfHVzzN5VjNCQn8iWF9QUX 6 | EeSaa48OHV5uJ29agf126e0sNBdRYpWz7kApo/jTc2wj+yUyFJf6L/KRg1XUwDo2 7 | 9ZHi2GA3l5of2lWM6HQrtJWx/1fCUxqxCoebXSaVbDSfyrZTxZRkJ8Fz1KBDG4sw 8 | BDlz9DMCgYEAlaicqsc4VA5D89TX79w3zKqB3cN6S/mRoZUAPTx/uuTk5FXMH/f+ 9 | 6JM1sYVa2FIKjqchLNtkQxy5Q+jUTJjv5H+RaE4Y8O6/Lh3J5fvv8UtXN5FpbjoU 10 | WZzMt9kdNHpVqd35vuDp9D/+wXOF68g9o9CK8cCpeCb7WfIFh6a2aI4CFAJ3YjcC 11 | R3Yst3pZdVmfBHq2bwWg 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-13.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAJmfVJD42OxG22KnDrzF1dklEvcsqvIgPpgK5LUFJWoxOO3DDxR+iM0vm01KvQ+fCrj/aXqirdAg107bUabWxh4PbeVqnRegY06PApfL69VTneQ1QGQ2mzKC32hMAzoahT4hZ0giyCFgj1lQ0v296fMbFD0pve9ZF3pj0do2uNoJAAAAFQCDJ0DV4/Di+KXx979CjcCCMSx9ywAAAIA6mfwPV7xodblBpJ8dXPM3lWM0JCfyJYX1BRcR5Jprjw4dXm4nb1qB/Xbp7Sw0F1FilbPuQCmj+NNzbCP7JTIUl/ov8pGDVdTAOjb1keLYYDeXmh/aVYzodCu0lbH/V8JTGrEKh5tdJpVsNJ/KtlPFlGQnwXPUoEMbizAEOXP0MwAAAIEAlaicqsc4VA5D89TX79w3zKqB3cN6S/mRoZUAPTx/uuTk5FXMH/f+6JM1sYVa2FIKjqchLNtkQxy5Q+jUTJjv5H+RaE4Y8O6/Lh3J5fvv8UtXN5FpbjoUWZzMt9kdNHpVqd35vuDp9D/+wXOF68g9o9CK8cCpeCb7WfIFh6a2aI4= areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-14: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBuwIBAAKBgQD/Q2WUFIROJuVXFdk7aN/OA48zS1Jzx7xOPqlm7ysvQqxzVOcW 3 | 5rvxgna0aYJ7gQhi0cdyMODWPqIj4+nL0QvVbxZJmrE7bRKH49rMfJuqCzusJM9w 4 | hb1x1EoygQzl1q+i9foeerzDoGzTZf7p6nW8ZOSap1uUlclnYHWgnBtVzQIVAOjZ 5 | ijteeWtFEnNheGD0Zl53/MmBAoGARzOk+2HnXsdhUoxtt6vqY9Fb7Qyadq9L34qN 6 | gvdfuAYEYtNqamWdaSPxsHzgIwqxwV9HkDxFkbSHmilGaKOhMEjkED4wfnkbbkf3 7 | Dx0K9aPIYh70JIFXZxToDMrfjdryhBJF8Q/Mi6k4nvti5+9mbAaoQlhs5D3zuD0F 8 | VSzZ48ICgYBV599O/J9x8CMNnTxy+moC7ujJsTRXFAnnXm/N8V8W3f1TAmjmpeH4 9 | gkZsH2WZMuheJKvKQpkjxFYfRUBFYowVLYIyYb8gQJRREyMb7r/fQyf3KjzLJcSQ 10 | HmR66Z+LyTXtNhcNTbTxck6A07uAEx0MYEG4I0tQvwwdg/frAo5TqgIVAIEANhvX 11 | 8bK+bwG0YO/ZzyNUNDdi 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-14.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAP9DZZQUhE4m5VcV2Tto384DjzNLUnPHvE4+qWbvKy9CrHNU5xbmu/GCdrRpgnuBCGLRx3Iw4NY+oiPj6cvRC9VvFkmasTttEofj2sx8m6oLO6wkz3CFvXHUSjKBDOXWr6L1+h56vMOgbNNl/unqdbxk5JqnW5SVyWdgdaCcG1XNAAAAFQDo2Yo7XnlrRRJzYXhg9GZed/zJgQAAAIBHM6T7Yedex2FSjG23q+pj0VvtDJp2r0vfio2C91+4BgRi02pqZZ1pI/GwfOAjCrHBX0eQPEWRtIeaKUZoo6EwSOQQPjB+eRtuR/cPHQr1o8hiHvQkgVdnFOgMyt+N2vKEEkXxD8yLqTie+2Ln72ZsBqhCWGzkPfO4PQVVLNnjwgAAAIBV599O/J9x8CMNnTxy+moC7ujJsTRXFAnnXm/N8V8W3f1TAmjmpeH4gkZsH2WZMuheJKvKQpkjxFYfRUBFYowVLYIyYb8gQJRREyMb7r/fQyf3KjzLJcSQHmR66Z+LyTXtNhcNTbTxck6A07uAEx0MYEG4I0tQvwwdg/frAo5Tqg== areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-15: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBvAIBAAKBgQDE3bTdZmwqSesx8z2cuFUEfRcDJxLUXfJJsNMt3sWobhAFITgS 3 | lwoiL8JWgt6nRHmQewu3i1C/Vjgb1X2J1sf/f0B8wTJIgEKVPMbPfyrohUzeRrr0 4 | mPO5m/+zwauhM1zDVeCa8LgHJ47w+/9B9MLmEMzbhWXiWtWtA4+atPOACQIVAPja 5 | ASjp9UQbYIGqZddmzFOAiEYjAoGBAK834WXwlD3Ayoo/lum/zqg21CsVE1ct+vyE 6 | IhX6Oq2d20DWbpx5KOE9gdqksod53RwJ2rcIwqY79PQn9ZpNDhD8jJxF1IRNNAyi 7 | MfoWoEGLdg8ie0+yBHG4NGXy2wRLoXK3lobGtBtKBoi5aw3NzuBKpn/YImPgwoKx 8 | i9DTqUcQAoGBAL6K7Uf1rOiA2ssOSF3VL3MVv+7x8JwD7GAsLVrQ4V1qziJwfzV4 9 | nhmH2gTibP/OvNg1t/VgazgedRKEIKHvXG+LLs2C6/yHfJ/sOP05k4SvQOBfuZYA 10 | xCoPrh7LpV6gi1llqqh+vPIbBaN3xKleasBvFUAu3MqZV7XGuR1xx1utAhRDovsZ 11 | qg6VKMKaeVwuz/GapMnzPA== 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-15.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAMTdtN1mbCpJ6zHzPZy4VQR9FwMnEtRd8kmw0y3exahuEAUhOBKXCiIvwlaC3qdEeZB7C7eLUL9WOBvVfYnWx/9/QHzBMkiAQpU8xs9/KuiFTN5GuvSY87mb/7PBq6EzXMNV4JrwuAcnjvD7/0H0wuYQzNuFZeJa1a0Dj5q084AJAAAAFQD42gEo6fVEG2CBqmXXZsxTgIhGIwAAAIEArzfhZfCUPcDKij+W6b/OqDbUKxUTVy36/IQiFfo6rZ3bQNZunHko4T2B2qSyh3ndHAnatwjCpjv09Cf1mk0OEPyMnEXUhE00DKIx+hagQYt2DyJ7T7IEcbg0ZfLbBEuhcreWhsa0G0oGiLlrDc3O4Eqmf9giY+DCgrGL0NOpRxAAAACBAL6K7Uf1rOiA2ssOSF3VL3MVv+7x8JwD7GAsLVrQ4V1qziJwfzV4nhmH2gTibP/OvNg1t/VgazgedRKEIKHvXG+LLs2C6/yHfJ/sOP05k4SvQOBfuZYAxCoPrh7LpV6gi1llqqh+vPIbBaN3xKleasBvFUAu3MqZV7XGuR1xx1ut areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-16: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBugIBAAKBgQD5G6s3cofD9T9PcGGZMA6NDoXRnO4AL+VkBRnWOV1ZBtiQ9XSR 3 | 9pi9agTmE2Wtq7EzKYfEhRfM0PWz07UTxBUtboROvxLVkOZmWSKGJGqAFusAAlKM 4 | fNlcnyzIUKPNhRcq90WLYfCGPrxDzRVJRpg10ojuUCLuCI7Irf2QdPBHWQIVAMDa 5 | oKwU+yJt6ZZl2jzNPnjQk0IVAoGABPUhpv/fOWUlOzKN9BY2vjk7PhcrVkIBs6cO 6 | oSjXbv8dMhqlgHyp10CvyX1+UR8OPQDr62Jly7EATTzPo1jxMWe91bghHfHypy0z 7 | SgwZLqDTxo+oatLiJW3R/YuJ4rI8C1Z/Mp8BoRjkIsfvyX0LHCTbSKYnRhviajjG 8 | Fa4v0g8CgYBrmBac5Idhpmi7rTxGTceOuUMaLrLegzwVKBBazlOdcqGc7eYZp7Yw 9 | bQQtf25sw08JVPHqu9gDb2zB/M5SPriDsx/AlU3EPrs5YG0m76jI8HH9NT7itFmQ 10 | D2zRw+SlLZkbpq7DoSsvvRs4FLl3hQxmfAUqpvSV/9qJCe/wYVR/DAIUTVvi6b9i 11 | g9M8voejVsYxuXruI4A= 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-16.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAPkbqzdyh8P1P09wYZkwDo0OhdGc7gAv5WQFGdY5XVkG2JD1dJH2mL1qBOYTZa2rsTMph8SFF8zQ9bPTtRPEFS1uhE6/EtWQ5mZZIoYkaoAW6wACUox82VyfLMhQo82FFyr3RYth8IY+vEPNFUlGmDXSiO5QIu4Ijsit/ZB08EdZAAAAFQDA2qCsFPsibemWZdo8zT540JNCFQAAAIAE9SGm/985ZSU7Mo30Fja+OTs+FytWQgGzpw6hKNdu/x0yGqWAfKnXQK/JfX5RHw49AOvrYmXLsQBNPM+jWPExZ73VuCEd8fKnLTNKDBkuoNPGj6hq0uIlbdH9i4nisjwLVn8ynwGhGOQix+/JfQscJNtIpidGG+JqOMYVri/SDwAAAIBrmBac5Idhpmi7rTxGTceOuUMaLrLegzwVKBBazlOdcqGc7eYZp7YwbQQtf25sw08JVPHqu9gDb2zB/M5SPriDsx/AlU3EPrs5YG0m76jI8HH9NT7itFmQD2zRw+SlLZkbpq7DoSsvvRs4FLl3hQxmfAUqpvSV/9qJCe/wYVR/DA== areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-17: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBvAIBAAKBgQDpxRh5fV4GoyfR08LMvO8R/5hkgfkwT+MsfIzpEsQW0Hk168Dy 3 | rrR2WdSBvHL5LDQcPNsUKmrIj6BBxnMls3OWaCoMe42ffRBEdSiAdENTl5c72J+K 4 | Ol/U4dv3s0kZyGqIVhE0P/DSCUMrTzZrHWLqPqDgnbg+hwPFUU5kv5/V1wIVAIkP 5 | FSnDxARrylpE+Y2L+8TQK6C1AoGBAONv5x91Zg9zornVrJCmW39zhoF0gqnbn/G6 6 | lzq87LGmY5LKlWBiwjkiR42ZaA/qUZTLDo3D3yHDTQ57ljN1nbcal3Gy624OXAOY 7 | YquLECS+/HgPF3V8EwmZQMP1em/vR3kbJtsIDBUBgoZl6nvXH8KbAJAIlIzUoSbX 8 | m9ctTc9wAoGBAMJPiCVtLliBTsQCTPI5dZDlDnEPp8Dg0HUXkFTEwJHk+GugZ5WZ 9 | c+7eNLqyFQJQnFyKRogQTDcVNHQz+EZy1xZg3t/DLqkwZ9gNwy/msNpVVB0f1KYA 10 | cNSj4G4skeq7WDYupcdDIy2kVtnP3SnYazf7zIFyrh8Itdg9B7t5BcGbAhQdVJS1 11 | inewPfssl4NzMG8M5uoHyA== 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-17.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBAOnFGHl9XgajJ9HTwsy87xH/mGSB+TBP4yx8jOkSxBbQeTXrwPKutHZZ1IG8cvksNBw82xQqasiPoEHGcyWzc5ZoKgx7jZ99EER1KIB0Q1OXlzvYn4o6X9Th2/ezSRnIaohWETQ/8NIJQytPNmsdYuo+oOCduD6HA8VRTmS/n9XXAAAAFQCJDxUpw8QEa8paRPmNi/vE0CugtQAAAIEA42/nH3VmD3OiudWskKZbf3OGgXSCqduf8bqXOrzssaZjksqVYGLCOSJHjZloD+pRlMsOjcPfIcNNDnuWM3WdtxqXcbLrbg5cA5hiq4sQJL78eA8XdXwTCZlAw/V6b+9HeRsm2wgMFQGChmXqe9cfwpsAkAiUjNShJteb1y1Nz3AAAACBAMJPiCVtLliBTsQCTPI5dZDlDnEPp8Dg0HUXkFTEwJHk+GugZ5WZc+7eNLqyFQJQnFyKRogQTDcVNHQz+EZy1xZg3t/DLqkwZ9gNwy/msNpVVB0f1KYAcNSj4G4skeq7WDYupcdDIy2kVtnP3SnYazf7zIFyrh8Itdg9B7t5BcGb areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-18: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBugIBAAKBgQC8tixWe17US+LQoDUy9ugMvpXr1/94VbBtww4oc3vFYfBgFO6g 3 | 5Eaf7p+7ndZ5N302fwJm9uzjS8a1Tl16cjbQb4zhMPO55sXucdR29Ooh1/ZN4820 4 | bRF59xSY6EuOIoPnUjoQ4hGiN1Ip8feVgZWqI8OEyWUxqsHMBU2Ve5OcOwIVAMzS 5 | Hsuq6Y2RUJBeujZL6L3TxlsbAoGAHiBf4zTSl/KU5edFk599UKAe5u1idZQJPjKX 6 | uGKK/dBubp6VNGX350NAd27Cnqt8nl5MOHHarZmd5AyNI7KAhlOyFbtPkaCShGS2 7 | cwHu5vObaLCjlyOLuSb/pw6WYTw33niNPe/h8j4NTkWzvukLRgMoHXVm+tdciOI+ 8 | F7pYtrACgYAhXKALZGe81B/wpsVCBHQNcJjmbXlMDEtn03esJkdGr8QmGjSta9Hj 9 | iZ30JNkbj+1zGP6fDwb97avkP/VXTCbMww8NP5ddWAziAzj486dte5K6pFdcSwvv 10 | jFz5N6oyA70Rcgn1ACHE8l+X9etKh9pzwEC/8Sf9GGRtlLyBqZ7rRwIUdsBVIuI1 11 | gaOdAfLK5fiQaoFvwpw= 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-18.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBALy2LFZ7XtRL4tCgNTL26Ay+levX/3hVsG3DDihze8Vh8GAU7qDkRp/un7ud1nk3fTZ/Amb27ONLxrVOXXpyNtBvjOEw87nmxe5x1Hb06iHX9k3jzbRtEXn3FJjoS44ig+dSOhDiEaI3Uinx95WBlaojw4TJZTGqwcwFTZV7k5w7AAAAFQDM0h7LqumNkVCQXro2S+i908ZbGwAAAIAeIF/jNNKX8pTl50WTn31QoB7m7WJ1lAk+Mpe4Yor90G5unpU0ZffnQ0B3bsKeq3yeXkw4cdqtmZ3kDI0jsoCGU7IVu0+RoJKEZLZzAe7m85tosKOXI4u5Jv+nDpZhPDfeeI097+HyPg1ORbO+6QtGAygddWb611yI4j4Xuli2sAAAAIAhXKALZGe81B/wpsVCBHQNcJjmbXlMDEtn03esJkdGr8QmGjSta9HjiZ30JNkbj+1zGP6fDwb97avkP/VXTCbMww8NP5ddWAziAzj486dte5K6pFdcSwvvjFz5N6oyA70Rcgn1ACHE8l+X9etKh9pzwEC/8Sf9GGRtlLyBqZ7rRw== areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-19: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIIBvAIBAAKBgQCzLI0i7JsT5av+T7D6xgWjmcR93fhzOGXX4wS9lPlvge5nYNKb 3 | uPXXryZ1pYr+jE3fNfI9ufVtvEH3icCaaf1kZOlHh62jYEbH04CMd5/hVVesHmHu 4 | t+AQIsHSgrh7AoPT+mT8l0XVnYDxdP/0eIF+r1cJkggULKOycJRTrExDAQIVAPTF 5 | QJNJDO9zQa7c8u5hmvhDSwYPAoGAb0pG+VjXcTIw21T32IhQd06d0m/VznQ6Mm1u 6 | CvVxUPufxA1jSult2FoHwP+TJGMw0LcMW5yHqos0YhjG4dqhIknPFQ+DcfMkdpCq 7 | Qeau86NcrR2L9NZIlGaf+qvUPX+A0AglAHiJUzb0WNMQm1kgfoeaDs2o5oC6skoe 8 | Gmre17gCgYEAiF4W2SPJn4vlYGdfOc/QGIRtak2tl/vVPLl73cEWWwyUlGKHckYd 9 | YWuBgL5qGtfgf4rC+NzQ9zAHSsvUc9pKv24Cs9n+f5hpz/I4ZHK1nED+e4vYl3S5 10 | za6W9ZaRpaBjOL7DuPZzh51aJzZ4tOZ82L+a/kAds1q2AYP75PxRfpsCFQCnhv1y 11 | SCAq26cRq6zbwg8YwberXg== 12 | -----END DSA PRIVATE KEY----- 13 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-19.pub: -------------------------------------------------------------------------------- 1 | ssh-dss AAAAB3NzaC1kc3MAAACBALMsjSLsmxPlq/5PsPrGBaOZxH3d+HM4ZdfjBL2U+W+B7mdg0pu49devJnWliv6MTd818j259W28QfeJwJpp/WRk6UeHraNgRsfTgIx3n+FVV6weYe634BAiwdKCuHsCg9P6ZPyXRdWdgPF0//R4gX6vVwmSCBQso7JwlFOsTEMBAAAAFQD0xUCTSQzvc0Gu3PLuYZr4Q0sGDwAAAIBvSkb5WNdxMjDbVPfYiFB3Tp3Sb9XOdDoybW4K9XFQ+5/EDWNK6W3YWgfA/5MkYzDQtwxbnIeqizRiGMbh2qEiSc8VD4Nx8yR2kKpB5q7zo1ytHYv01kiUZp/6q9Q9f4DQCCUAeIlTNvRY0xCbWSB+h5oOzajmgLqySh4aat7XuAAAAIEAiF4W2SPJn4vlYGdfOc/QGIRtak2tl/vVPLl73cEWWwyUlGKHckYdYWuBgL5qGtfgf4rC+NzQ9zAHSsvUc9pKv24Cs9n+f5hpz/I4ZHK1nED+e4vYl3S5za6W9ZaRpaBjOL7DuPZzh51aJzZ4tOZ82L+a/kAds1q2AYP75PxRfps= areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-2: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEA2lNn9HGFQCPT52Qqm+g+pfOy5vkCon2TdqAkFNeOnaOtxvS8 3 | NSmmmpt5iFb7yLB0SMFnxMdnmPHCmTxRqIyJebNsWvSIAIL+WosYgQiupr5xxcU4 4 | rgakrbJVsTl3WUjF1nhUwCtbBIPiEdXhkCAsFyjcxnoF9BqdOwEtKkWM2FlwS7Tm 5 | 4giXYzmkMSAOfxcrI3LgNRX47keu82K/h67TEHah/kyPR0bPs+yVBoc+MzNfS+ba 6 | vXPN39ou8HV/v3jX+XMHHNl9qWVuJeyAPiZF3JTZ8f5klAg1zNKf9EM4cy4zZrGb 7 | YqROR+t10wKvJn5ulTfQTYs5cuacp6N2PmwlgwIDAQABAoIBAEiko9wzwXB7+0/s 8 | hjjl56J0Gby8ceH7Aovf8OF2b5+IDJQ8bjsKJsMepCt3NcOq4qYqpApXhuLe3i76 9 | YPlB+aQizRTedDonW9ZonbihWOtmRpjVbGyLDVQ2GEklo85zZlBcLWbbhidUcm4Y 10 | yjqYWdNC52KqyzxTdqlhVNPR3HFHg5/vVMZtC091HCQJhjGG1HX2tqQBE/lPt/Hs 11 | e3ySDDMJaOMl2siQI9nJJb8/bV6JTimk0iUp/hQ1ugFoBH6vhvEUsqtg9Uk1M/tR 12 | CEP3rozogl38HteQ5NmokelBMdjP2iNwWONvGTGnWo9caFWbQRAMzwfdPFBV7uty 13 | ABAyT7ECgYEA9h35z4octzZzCL18vL228oGyOHam2bPLKz02G56T1wiMvpcsktKJ 14 | O9hOsyzQzlW/5fiWAb70Wf0HgiL7031VKrd3h2xm8AtrNufZTbo/+rEg6Hp8JFd6 15 | gF1sz25zVJz4HZOSYjY5ozQ6l50Wgsmh127YX1KC3rGaNuQwZ7gH4e8CgYEA4xe+ 16 | FphOGD0c4Gv8zE62TFh1WTgWCjuj+CDojkv79WudBDKRiQBFHxgEuqh2NmkTzyIF 17 | LL8l1tnVHUfsC0XTT1TdSILIn0ugynRfLssvT0WSzd2d2nqXGINoxy4IHHJI7ai8 18 | Oo+2eiLgOWXPV/ztmvw6ZqpCUvD7osVvNjoZ+a0CgYEAzGMeZw0CReBQ7aw236MJ 19 | QCEW+S8H5vkZuyHNQmiRy9zMzSZMHO38i5dZ3BBWo1Ow1nF3WaHT2Lt5tcgJq5uE 20 | 08Gi4PLUFXrWIbWuz47hvPXGJ2o4mBGRqPJs/2JxIo5sulsoEKmJehBQrEIHRLvf 21 | zEHALIEgL4H8WKNt02SQHz8CgYAl0JFNr+TpMlv5nuHEn6LJib1YsvcwkwfVzJ0M 22 | /Ogi0N2fklAbsRjRea1n659rpgmvZynXbqj9Yt6S9qP+qIzsW+RRK73+kJhgvgoP 23 | f7QMDjjI4QtlEx7P7SnoaOje28T7Firp0X6ATghqZmKlcy+ZrECJUfajWw975kaD 24 | kB89LQKBgC4AJC7iNx2NhrvI/GjAWLchp7p+DbkBC8SAi7WFEJcGvyZAB2IbccOB 25 | vpFo8hgta0qNnhb3ThIXbKaNt1kpHC1Eq5dnOWRp8R+sdgo4+xmwtWfREF6eXc9C 26 | TLDRwu0PAvX5UmpLKjiEDoltedD1d0UQ5z9mLNfEUdbaP2ZAXKo0 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-2.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDaU2f0cYVAI9PnZCqb6D6l87Lm+QKifZN2oCQU146do63G9Lw1Kaaam3mIVvvIsHRIwWfEx2eY8cKZPFGojIl5s2xa9IgAgv5aixiBCK6mvnHFxTiuBqStslWxOXdZSMXWeFTAK1sEg+IR1eGQICwXKNzGegX0Gp07AS0qRYzYWXBLtObiCJdjOaQxIA5/FysjcuA1FfjuR67zYr+HrtMQdqH+TI9HRs+z7JUGhz4zM19L5tq9c83f2i7wdX+/eNf5cwcc2X2pZW4l7IA+JkXclNnx/mSUCDXM0p/0QzhzLjNmsZtipE5H63XTAq8mfm6VN9BNizly5pyno3Y+bCWD areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-3: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpQIBAAKCAQEA485OvCxUoN8nxHxKpYKG5BjK1H0HtFcAgGDfkBWYRsFCVl7+ 3 | SsaC85cKQFVnWpSUidcdZyMF+5o2LXgH0LGnJG4r30DpCof5sB1rqqXCOvQ7h8T/ 4 | XHTn3Ken6e3345AyeWwUrovN0yM6GE36yc8NQOP4Qd6eEt9ajsr+4pvjenr0l6cu 5 | /soGU6MP907myLRQqUAN/DExYVTA4PKGoJ2Q6Dv5H9nbPh+w8LO1pA4DCWWCzna9 6 | SDeVAuaZPt41Fou4Wwy7YnxqQA8tKKlKcPh7mXt3JOuRrzcLsOYxFkxU7taqVW9k 7 | /Mch2BfG2mtNZJ9AbxyMUVSyr+hpzNCvb5g00wIDAQABAoIBAQDcSKpQQhnPuhqN 8 | YJcaNv7TYLn6AbFKjPraKVLl1Ev813KbbJ4/lngYrsxl62/W4mhEZjRzgCWP585N 9 | 54y/HJsAmlxoNS9kVJp41+o+CK2qLnPGVRONxypSb/jqN4gGkHCOg5n4Mw5kBeNu 10 | jzFcppAtWIS+xVNb8olyHQ+d95pf2uSuRjZiUQv/rZHSfvwbTJya6bYi/JEtcYCt 11 | NbAx1T7LDMtMgLEbrIjbKPIOmoBnImhokXtC32fxRUGM9gwBhXR6IXd1CxdybGjn 12 | bkVtCNtNr1NMj2SSyAJe7y48qssmUqR/X7q4g4lH4RZdRYKJkW6dqCcsynVhMUPF 13 | G8WY3XdRAoGBAPdldezGHpeCDLwX8SDfwV7CNX/Pj6OSPRVsMHAQjpAVV3zXsTPj 14 | bH59JsYweWKnvSix5aQ05zKavy1S2onQknWB82NvbCDU67q/MZzY+zwUNQIlI9// 15 | QfznBu0p3v9L85S0r2vaK18VBF5Sf5pH1BM0utEvnFZn9hfhVFVkh5fbAoGBAOu6 16 | b4OSTEqiH7tUbxis+HSOcKCNNNYQll7b29fD8v+UEyMaXskdlzqcz8HTiM15AdOO 17 | tqiaqlSQhUo2/6EtF5Hvv8aVUrQY+mZD/+30fH5ON6HBCeLS8yJigE91B3xGO25D 18 | pAwWgDQhii/f29U+FoSer3L09H83eYAghvgLaoRpAoGAagxvEXEX2gBgbxygO2RP 19 | IsyDXGdf/lEIqC85UEB4rCDJ4PUgu8poToxdW6WZ0wVuW4xukQYweQvGmaojjeH/ 20 | dimfaGdx5V0AM4wTu1Vz1Jwg4OuExldINR3fZTiGo88t+fe+HrBl2RtMRRZ+JmdV 21 | 7Gm1D0imbo+f+TqZCQXP7fMCgYEA1YR/sat4UznaiDIIl09FlT3YInUE4MkRi0aW 22 | MTAaEQos82TValHVQ4/6V1Sl24e58ciZBsthcUuekASVM4bGjLee+98RlHPzi2IY 23 | lY8YnMd4eJmDvOLau9CA7HfSmex7tHqsQw62fYHLy2V3mAWvG90oinX6aKj08uuD 24 | lXWxu9ECgYEA5gIX9OoASufYJxN5cEK5J9DTpt+Yso89OR5EfXSNuVjOTxYRIVfl 25 | 0TlwUMrpzujiZJQiV+52A870AaVhCzUObEKy9PPSmYI+v8QjrlGtST/DYZe0CKra 26 | /ea5cmx+DTnrnOOBOQpe+hDSFfEF7WkctsmkxlNl7/cZZmm1aXt/454= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-3.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjzk68LFSg3yfEfEqlgobkGMrUfQe0VwCAYN+QFZhGwUJWXv5KxoLzlwpAVWdalJSJ1x1nIwX7mjYteAfQsackbivfQOkKh/mwHWuqpcI69DuHxP9cdOfcp6fp7ffjkDJ5bBSui83TIzoYTfrJzw1A4/hB3p4S31qOyv7im+N6evSXpy7+ygZTow/3TubItFCpQA38MTFhVMDg8oagnZDoO/kf2ds+H7Dws7WkDgMJZYLOdr1IN5UC5pk+3jUWi7hbDLtifGpADy0oqUpw+HuZe3ck65GvNwuw5jEWTFTu1qpVb2T8xyHYF8baa01kn0BvHIxRVLKv6GnM0K9vmDTT areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-4: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEA1T+ihBX398eo8Dtg9XPbbVSERC/n1IZYcO9hJZmv05okWAJa 3 | cAeD5hOGniWRm006MD6+MrzlW9radF1EMDVWHRrUX71Qup3AXPZ9LpKbWzIImG7y 4 | Tx2Sjq2xSAyFsqxaLM4jQKp97y75P8B7lkmXE1d7hzhLU9TPlhkOQ/1WemuFFf15 5 | aSSzH0OoyOrtkFM7QJ/g9Hm2TivPPqOyeQ2uDXAQ1D9dmjECEaY9v/YEpkk6wEG8 6 | +TktwpE+kHNULaCtOfuG6Fu2KJ5Pw2hdvVothdlfnUDWzOtRb+hnQTSPylGsIXSd 7 | G8PBIv2opWmQQIsdvoXJYc+pqb22Ma7EwbjozwIDAQABAoIBAB6Ymb2v1Tsk13VY 8 | X6n37IS8Opn58Z5JhEj3341ghpyqogpKlCU8vsz1AjyQkVqh8vZXGjz3Y0URmoRV 9 | mWH9VRSp88ykwf90gNQVvZJAELA99oPAb12wlYWJIEWBHnGrTujczqwJijYWHEbs 10 | XA8NEfMBe0TEa/JkN0CG6cgRgiXgIh1Xt8Pt7EffvQkXpdqs3DUhznk+9mXCU1gi 11 | cT1l+gcA5nnAZbdNpRgVSrRJSOrbUJDhI6XzkoFP9RAXWX4ZGB4X609H55xoMrvY 12 | kop0nmTka8PmtE71r+i3DRSOCAHic6wSUvcRzJFoSRAr1puc3/a3Rzo82NmwdzG/ 13 | W9cuIVkCgYEA/UMXwAYGTrLUx7rIUmClZTpyR6cUS3htbQEQq0WUJk2viQwIVePg 14 | LY8zlM4DtQYIPA/Uo61Nb/cZGiF8VWI5G/hnMuc2CnSWmaWAVC8nN6P9mvSO5RPX 15 | e4yhWi88ClPpmP3szAx2Zo9pCg/gGrH2xGWfv4nJoybbbHSa7xm4P0UCgYEA143N 16 | 0T8GwUR+NZ8sWrUzMGKikddVzLe4vstQuWU1pVfxmst8R1iRq4r1e8orq1gnovYv 17 | gC2/yYg1yK7FE0h2PGq3RkcHXzEG5At3bDgpoFOHg9qWHTz8BFLENin7AsGCQBnP 18 | qdE8GlGsBT0OptKTRYLYpSaDH6AreRPiUqkQrwMCgYEAzVTuFoNL7dZTaTNoYlF1 19 | ByNhr/IoJCAZJ70rVJDu0jc9z/DveSNth8KIYWa93rBrULbNAX7qP5KoyWTItzkR 20 | cDnvAXgvej6YMy3ZY2dvdk8At/b7O4Lgu4yC7OlK1ly+EYodyDl6bSBsWvoQCdSr 21 | awOxhsshraM9VysayiuiE7kCgYAq+y+rJbInH407C/5AKBmI8GISSqnlJE1GXiw+ 22 | i5vi2GJox2KEp3iEiDTi9jE2/WEJ8aUPHhA8E1kGJzNM4QoSigT5kng51wDUwCSU 23 | A67pNT60YAXG1r457ncJhd1zczqRpZPu/LXLWbW/ZaliQmLzXV/trnw+9iU1A24B 24 | pYyaGQKBgFILKLRkGGPnsrK+lA0qP0ol8ro9yxwCymgjfvsvfbl6hwU0qMoa8ovO 25 | 71vx94o/M7mk4o4BHGM3w6QyZA2KFA5F18FPa1gQ98hGO8SOAXZyr7ZPzy/MIp3B 26 | Jsex050imKYzrfxzgeFGNvy/aujxdrHJEFNbZCIHLnz7Rh1kUQYp 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-4.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDVP6KEFff3x6jwO2D1c9ttVIREL+fUhlhw72Elma/TmiRYAlpwB4PmE4aeJZGbTTowPr4yvOVb2tp0XUQwNVYdGtRfvVC6ncBc9n0ukptbMgiYbvJPHZKOrbFIDIWyrFosziNAqn3vLvk/wHuWSZcTV3uHOEtT1M+WGQ5D/VZ6a4UV/XlpJLMfQ6jI6u2QUztAn+D0ebZOK88+o7J5Da4NcBDUP12aMQIRpj2/9gSmSTrAQbz5OS3CkT6Qc1QtoK05+4boW7Yonk/DaF29Wi2F2V+dQNbM61Fv6GdBNI/KUawhdJ0bw8Ei/ailaZBAix2+hclhz6mpvbYxrsTBuOjP areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-5: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAud5E0xl+pq6bh0kQ9sKQKOLVnIY7k+HfO0nUTiW9bu1/m/MY 3 | gh61dw9jufqGXwlpisdsxegINklM16PMZbtikA2oFy4dKaTeqA/4vtTqPjuW0KyV 4 | aCkzWvSpbKWjkF9XHqYLylUKoYsxO+zuQS4ifL6NnRW2ZcAMvNAc6JvSohBD2tCS 5 | 4L0u9+gldVg8tfx8ppn9uckjm2y5C40jQsPgPlo5HkSLpfD1/8PkvFUKbtEVscdC 6 | 2P2LWKnN/QfQuxGmPHHwj7T+ct2LReQqhdBmV5K1CXmo0/ADyvVMQ3w2N/Z8ikES 7 | Q78uHHWpGvX1xohixF8SUUSAOlX+rn/3PPartQIDAQABAoIBAGP0cDbGQyIITIOY 8 | e5L4VuZl9lJSrb99fLs5nP7ZtOHuvu1y8f8n3JbGo+7kF1cMjMGhNZHIkoH/MV/W 9 | KpmbCApIDdlJZ0156HOhAzg88Cu/h/94kHCPl5qWcHaJLUj6vLMywKxyx2DQpg2A 10 | ATD0Sn+jSizr/EcD3NW9ZY6CHeggxC27N/GNeIYCDvGshSMk1HpXazzlqt4SkN3s 11 | 3vshKl0LsFChRHkEoKuh+U2yFoqXhkPaJEFJsVEqo0kjFVX5ycvUpW5bcF40DFyj 12 | c7hkMh0IAT9Y4NVlDVG+93nmuRPyti1dajAFSIBHeFqmJK4Qg6shjUqXlEAXWjiK 13 | osgtd5ECgYEA5ct0WUn0OZvwvYsRuLEfkWgFIxMDa+0/clTDj6sOMMsTSag0SC6B 14 | WTLozeBj4y368392Pz8Ez5uWFzyfFcv2x2QmpfQJI+G1qqk8zkKL3xgG6Vz7Wzo4 15 | GBYH6DFkyTF70bKQX7KQmEYYtxWgAfivOxdNJz0TjFKpk3oPOWaPEc8CgYEAzxBw 16 | jQ6nahNIOpeIKJ2eInu2i8QU83oDcgB1DNZhICqCbeeKDWiNUrWI6oY00dtc4e6s 17 | psazl/Oc4JeDGARoiPoRHW95E1tX+SEHHyl/M0z0M4UFlHomxfk7ifOY5oqQGB3F 18 | 2j7JeLabSrz4wAb9bnwTOQCSs2f7QZIE3eSynzsCgYBjS8IP3ywARMkHLnPO6gKp 19 | E1i86jddSJxU7BnBF/o+zVGdT2igFDBieeQtKhwfi7vXwik3dSTADQwTKGfZxFPz 20 | nuwwY74bWink/9I9knXcRgaeikY3CnY4ujRaehWB9rb5Sv6ly4Q9uHRvkJGeqHYX 21 | w57cKMEsrn+GMYUomY+S8wKBgAISmA3RZ7uYFdEAU0yUx1BxDJK5k7wcLIynlIRc 22 | YPyBcGzJNIiN01xQlN5EGaNAHt3kFbZVptaOibN10MocwS8d0a4Jv5yB/Y9w1TFq 23 | qOtKiec6HaQu1NSGeiIXXiBwoqCbK6/TkRC0QzmsSpEhgMfqVgbsCovhLpKpc4MF 24 | FwShAoGADBunbOw1Z80tGYLTk6+2xxc2+wOF7PtF0EL7IenOvKElyOtf3hsw0XhZ 25 | OhEkppHMr3iZTION5k0oWnih8v6/KeMJalX6Aa6ALTw5qevzPY4f46lGLiFN0rq2 26 | 1h1wx1pXXRyiwSW4hLi5sMZQKx2bshVYwXY0M8PgHnWfv3tlwyQ= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-5.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC53kTTGX6mrpuHSRD2wpAo4tWchjuT4d87SdROJb1u7X+b8xiCHrV3D2O5+oZfCWmKx2zF6Ag2SUzXo8xlu2KQDagXLh0ppN6oD/i+1Oo+O5bQrJVoKTNa9KlspaOQX1cepgvKVQqhizE77O5BLiJ8vo2dFbZlwAy80Bzom9KiEEPa0JLgvS736CV1WDy1/Hymmf25ySObbLkLjSNCw+A+WjkeRIul8PX/w+S8VQpu0RWxx0LY/YtYqc39B9C7EaY8cfCPtP5y3YtF5CqF0GZXkrUJeajT8APK9UxDfDY39nyKQRJDvy4cdaka9fXGiGLEXxJRRIA6Vf6uf/c89qu1 areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-6: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEAs0cu/LQgM88QWcEkZTEWt8DKNfc30DIVysiitKWaNpGdoCKs 3 | CzkRYzq/BDxmf/33XVb35IRwDdVGGoALzx1rl5aeQOynj4ZUOaF6LEfXpZZgTqQW 4 | KRLbKS3qWy9PLoVkWR8+7eCcNBvJ37IDYifjWPih+QNGXAt8V2s3ijvPryf6Y/kl 5 | yNL/+zSTEDy+tlqnXAjXyFipbAszRWVhwYDzLp3JFyqlcyd4IVml2YuL4wXhCF/w 6 | sPIYM6iT33tWUQ3KgGe5eV9UpVQN6T6DvMaJdkp64aF5sa/IaPyBE9IIfmlAeDWX 7 | 0ptX29MCkoImPg2pNCy8cKL/cniHLiAEnls3BQIDAQABAoIBAF/m6lnAOaG9WK/K 8 | xB9lnRN7DDDGKJM017d8kJ02IUKjrsBlC8eNJaIBYQFxFhvNza+ewEj8F70uo6u1 9 | Z5vJzy5uIgX1EsWSRCf4G5TocZFg2e/3kusx7Q8gQse4jREDxmRudIlnp+ewHdOO 10 | NIUjdVi42FyOxeqjMkbJUhKeYED/qmXE78fDwjgwA9NHaqcWALdjP8R+nAqBZIbM 11 | xREggN4m0KF9USPwdu0ap1cIVegEbv9NrE22wf8w8XP5GoYbxeMky4SVOn4QRy7j 12 | zn4LpcVlOn92xIWSAQsMbxyRtrUiZBNjyNZTWlXTVja+1tcJ7XoeTvi2ZDNqoZWO 13 | ONtcRMECgYEA36cA82VmgN3cgXwieaM8pLiWR2pRf9Y1Doz+xdugbpHvCgccSSRa 14 | fwBFw94x/GQGx75nPBBLGrR2eHh748tc8SvXshL3MuArrjbSHsWltItbnx1EV/Nx 15 | TxXsnJJRltPR5KvEf7f/Iwd6etBCqALDun1DZCDoenF2FdfOrs+VRqkCgYEAzTUr 16 | GKo6qqLThPGPv3Sj8swTvnIqJo3WYllvCWM+e4m2vmr7uIZ19/bJVrtA7kLh5bGR 17 | 7EKT60VewzMpsbTcWvsxiKc66K/UZ3j6KdzPZipHjTSAYwlsai/IICSNsglHKDtv 18 | nhGrwVRbA0RwM6IkSxJ7gxwBKze53cX0doZIkv0CgYAY2ARTBUCNsBd+iruJp4hl 19 | A9wtsrG68aCTLTZf5DW+EpfrFT8fINqsoOsfBt+mmbXnGk99bJHrNYCzgS7B7yUz 20 | 5RrgvRqYnC49+/j7UhlGJPTYh/e/jVtY3aaa/eXySzVVoX8CcP32di401k2RPD1h 21 | yehihwVMFK55Xq+m24hJgQKBgC4LPQVGxO0epdlRnlB2KodDFTcJRL3r22ur54cy 22 | toVfrBpjxOFtgjDGNfz4/SO47Bju0/AwLCKBKTchVryh+UOM01t3MnedZEpnUbJs 23 | 8jhZSj67xgbyyVm2KPBVY1nMTSQQ2gWcr24ssFM2Wvqq6fvSRNZxRS3eTh0d2rFx 24 | hf09AoGACrjn/MVHKuPGm1YqtzzZXI9Y68gBhg3u6JAXkeZ4MTpqyDxSi6hxkwWC 25 | bPtFwuKRme0hdhdEV6EkLbEYDk+a8cZfZrpsaALy9Mtv2hbNEDotIMGv/6mzFInP 26 | suckylsXa7j62A88zmN6TeJNlipw19TC8ov2fHEGYSnTd3cGR9o= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-6.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCzRy78tCAzzxBZwSRlMRa3wMo19zfQMhXKyKK0pZo2kZ2gIqwLORFjOr8EPGZ//fddVvfkhHAN1UYagAvPHWuXlp5A7KePhlQ5oXosR9ellmBOpBYpEtspLepbL08uhWRZHz7t4Jw0G8nfsgNiJ+NY+KH5A0ZcC3xXazeKO8+vJ/pj+SXI0v/7NJMQPL62WqdcCNfIWKlsCzNFZWHBgPMunckXKqVzJ3ghWaXZi4vjBeEIX/Cw8hgzqJPfe1ZRDcqAZ7l5X1SlVA3pPoO8xol2SnrhoXmxr8ho/IET0gh+aUB4NZfSm1fb0wKSgiY+Dak0LLxwov9yeIcuIASeWzcF areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-7: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEpAIBAAKCAQEA20uZUWD0DOc2Ao5qwvxIL23QvneMBlM1MODWXpDwf1mdR8Zi 3 | XOVuWzAhjmEY2hbhmCLi3Rw3KILdDVYas+zNcZi8NLetbAVdQQQZTv+S4BRuKZ3K 4 | w6RyhTxoC4ykQNKCjmDkYmfTXZa85peGsy+bmb24sSNTViBt7/gcy94PiIe8MYvu 5 | ukQ1pXDZ3YM3t141ba6E4HXM4FiOB/U87wHggh966MSXDARKqjepBMmfzZg9nVU2 6 | /prrh4bbjGh6QgHyPr7fxnRlWagAJlLUhjx3Dre5UP4VKMQfpr5pUUIBD5X0zSX3 7 | 29jt6AH/Qt6/jBJiPZn/bSFDEugGOR4cjaA+KQIDAQABAoIBAQC2GKyTWsLNBCFh 8 | NgmJKBx45eN0haiMiAOfNtRLameKGEv2EdIT+aANsIXsyMvuLRnfTvi7Snay+Re9 9 | v0YlKfne3klKLUuga0PofRLW+npoAA8KF7ELjD5cTLDJBlxOR3+J4wNCg5yMFmN9 10 | x01e9aVroJMA5KiK2BryLUEcOKUFZMZg5HLvJ4jjSxD5AGg0O2nH8IQecT8KeqN1 11 | 3jJDSCGjFBQa8dZa7z3Fj/dZAHZR5J4GPKVA78h2BSwLfFaTyW01kbuxw1p/WV1B 12 | MV/9Bv6AFJcR/aJ4rVUYE+7xAIe+S156I65gDQfVoNQ5YJl1sDqFAZDlP0TsW9yV 13 | Uc4dzrKRAoGBAP7hb82ehjz05CjlQHJ7uwu5e5q4Y7o8FFvMzCWpvoS8pCrKSTRo 14 | /H9PLa8MRmoW11n6a5wjTDC4aF3VYLmg+fLEfacsDOfjA4a2SBbN1STwZa0knqGa 15 | eLVBf1m/OkhU0jv2eVwNQzQH5vRA1pEgJc61spAlNg/Q6ju9QtoYcZ1nAoGBANxC 16 | J0nUUkilngn41nACb8i547ccqUuBuuHc60vpmJy65hA9w83oHha2XdtLjRd7uxNE 17 | QJ2FbHQRpZ9MrU9j28FjMMnLY2yqk7S3fr1tQTz5EWD8iael7d6xv/WPvK1tIaHR 18 | mjjtS98VCJzh+7/AFTgdLQJzhBzUgzviz0t91X3vAoGAKgWW/kqVjTU+7LMnVfiq 19 | VPuGsnKWFp1TKfNw8QC0ZYQIePmS6i4o+wBd4s9eSJ1tcetElKCJLjspEdddNB2j 20 | N/BHWyl7EzwtV6dz6TaUXpu3170C3lfucMvUqEJL5KL/al1vksqo+soWvMx308N+ 21 | GD+CqhtId4EVLTY98GE5Uh8CgYEAyx5ChwZDP3Vj0cRlVHQazBwJEHNg+B3Rzrph 22 | TudD8r00rqOW70rwfHd/BF2e5poXAgR+JgXF5x/jAY2/gagQHz4u3tkufiasAgr5 23 | 2QxpDiaOTUd2VmFhhG2dHYKJN9GdI1JdC8RhpH8MK0kHVWR47P+S42DN45xizZYz 24 | HmYTvIcCgYBYShPLD1FdooQPiCn9Y2g8h0DNLOPokH46LQ+HEAkCINl3uagUzFKC 25 | 8JBdDPrwLuLXRf8x9T2TLl6ynkeZQXc9IRlgvVQB/24M58avibLB3poUCkMFNbh+ 26 | YS9+koZxJOUDw6ZT7zpU4Ep2rGEcn8yOJMchkbQa5fUSDUOFFFEwog== 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-7.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbS5lRYPQM5zYCjmrC/EgvbdC+d4wGUzUw4NZekPB/WZ1HxmJc5W5bMCGOYRjaFuGYIuLdHDcogt0NVhqz7M1xmLw0t61sBV1BBBlO/5LgFG4pncrDpHKFPGgLjKRA0oKOYORiZ9Ndlrzml4azL5uZvbixI1NWIG3v+BzL3g+Ih7wxi+66RDWlcNndgze3XjVtroTgdczgWI4H9TzvAeCCH3roxJcMBEqqN6kEyZ/NmD2dVTb+muuHhtuMaHpCAfI+vt/GdGVZqAAmUtSGPHcOt7lQ/hUoxB+mvmlRQgEPlfTNJffb2O3oAf9C3r+MEmI9mf9tIUMS6AY5HhyNoD4p areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-8: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEogIBAAKCAQEA4M8Q3+aLgC/vAAab4JBcD5+NgL9mBlSsm0m4KYxjU3CkAfmK 3 | sE37nf3+30ob7lwgG/pufecQnmkHJvCqcTQDGzqQUJz6y5zc9H9BK2isTiG6maTC 4 | 1TTFClObwDBjYAlaYxlSJL9ubHDKP46GgvxcMTsovSZ042PlpDtNxiExtJaABVKR 5 | +0y1UTSSsjwSvssQx1Fh+Tp2NGd8kfrA9cKrDW/+K6aH1i58d7P/Kl51Y9pV9/WA 6 | NSRDR33qVDb+ck0/4T91dUhz6yFhNeJu82aGJvE4nEvWg8dQv1A0+PyckKKB7TTn 7 | MChV5LWnuXAk2HzBgbM7AjjOHo441w0aUkIzbQIDAQABAoIBAA3xqglJQoPb9UYa 8 | ItcF/T/W1K8UsB5aaC5lny+sjoihZvrcYJbY7294TrPI4/yf6Dn0CaBzkZtRxmjK 9 | 6reE02B//G2Tnxa8DxR3RDKOFonuG6XmC1OwJzyhvPppxfAyBFI7QtYWraG6SUEx 10 | 9PPw9UL0eW1qEjv8eUT7jLJqYqvhwBn+y8gG17a88mn+iCwaVTPQX7Ujh5a2rx5b 11 | B6FrRmw8aUuYMvkMlcyRFCOfIDU2LFXkVg8OYsZBrHqmZIrrD9/kQYe8uY4GTUeq 12 | TLPqUbrmvBgpQmFVD4u3Hm5ZB/98h9z50iqP4Gn0MYQSw4Rn3Nk8DEskt6ovdVfE 13 | 7O2KIh0CgYEA+3bkGeHTD7B/n3Ns+XsTX8UBG9ALQfi88p2qJisThaUOA5ALsNFl 14 | BCr+FIbc8LJWXqmd21S3wFC5gPlrgPT8EXUxqbD64jo2ToljIIOhTS55YHyIy2rL 15 | xZO8F3GrvEhxGrfPSlKqOGfPP2EEJkRElUqsND06KfXd1swAK5fGP4MCgYEA5N0Y 16 | hSWXIuoosQ+EVb69+EoSFVJbLctMdl26eCBWnGbBeySMQa97QzNm1iCPkqcpz+Do 17 | 3wrXlR+sf0AJsu/lgR0Cjz8ng0kEDjRdRp0s12foUh3Jjw8xhbSS6NnJRAEfPm5I 18 | 4u8flrqEEk1yQUK0KF4EOOMIqqbSzEU5WaIr3k8CgYBt2F2DwNXFwL+/E1jDEjRA 19 | XXpCf/qq8tD22lB9I8v/UT5x5/ZzYsTRsUYUCWVx7zUzXLyMFtG9vIWMBWgkiN+j 20 | cKIlEh5FvFAEtpcKmPVZFbgHod7PnPMud35ub0UplityFGEEgl/BC/fII8UAQkoD 21 | PP9EQoqp0bD6J1rbsAz1qQKBgFkpObBFoMfdadTxMqElGmVslfbwis0gcr16bnb2 22 | QkfUUHRlHK9Kaj8X+2xYaxa7QTLXcGHUm4BhQpagoCayBztxzdl4xTAEdiwCgoRM 23 | H3gb5wp2yFuPk79/ReypTBvORBnSZVrjxe6241UuDuEV15ISbpqq+GljbKRgI6Oj 24 | 5mtJAoGANueFCWBHOeKH4Oxo43b5SB0cqInGzpjTqVP1GaOgc/j76TereqToTeC5 25 | 09GMuK+rOsd0t9Jv0+GjHx+c1V++3KOCiuawELuX8Yx16S/JEdcdLfEFdJn773Bl 26 | RNEdyODovemDES+1v10NMiLMvtMmcRYukV3vaEEkXhui32icQqs= 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-8.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgzxDf5ouAL+8ABpvgkFwPn42Av2YGVKybSbgpjGNTcKQB+YqwTfud/f7fShvuXCAb+m595xCeaQcm8KpxNAMbOpBQnPrLnNz0f0EraKxOIbqZpMLVNMUKU5vAMGNgCVpjGVIkv25scMo/joaC/FwxOyi9JnTjY+WkO03GITG0loAFUpH7TLVRNJKyPBK+yxDHUWH5OnY0Z3yR+sD1wqsNb/4rpofWLnx3s/8qXnVj2lX39YA1JENHfepUNv5yTT/hP3V1SHPrIWE14m7zZoYm8TicS9aDx1C/UDT4/JyQooHtNOcwKFXktae5cCTYfMGBszsCOM4ejjjXDRpSQjNt areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-9: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIEowIBAAKCAQEAvw7rOvRoZD1oH32BGQYo1Eqi7P4U3trklJY+rxt8FxIKeaXj 3 | QEfSCc+nDMeuaP0WyimujriJkS3TqZvcCPUlZ1fAwbcJlQoo95i61DFD70BdUVSI 4 | WDhyzta2q/iFdIm18ad0is9B4xfB8s9Jjkrhrwv3lRY9uMnvGgxYYIc/0QDRyaMm 5 | YOf9Nz6qyz/PkDVifY+a85/f/0DYweC9JeiWR35QotnNWJ2Hyp4TGaJaKEKbuVip 6 | v03gc/ccaoBkVWrIUgDKzpwHpW5TY5ZNcYm4ZGTZoiR3phGq9p1oyV3Usq0zfABO 7 | fJCeVBEqO4f/ziEuzpcG1UJKzH0bKFJX9d9BQwIDAQABAoIBAA+v5OaJTMz2Mcds 8 | IZ5xYAbWPfxhfEs0A9KjZ3AvPIgUZiHI2hjcDMXbc+bbullKdoWQ2JFFW548+gUS 9 | FAX0QubyUJRXOAUxuV1i/+wOQ3qweTkFTNCZieuru4HxPNvttq+pxSrki49e0wDh 10 | vjNduJwLyn9GPTkf827bFqKOWFILr9mRUFQpZvjDQ4JQVfKoyvwlpZPdIANfRPt0 11 | eEiMt4QPenqrMbh335B5inrQLTgUmPAgOcO8m/ww9iZucxIeF93Mbey0RurR0J8o 12 | W7V6CFysRelaHUcD8K+V+1/W+SkuwTyLF662OkCLPtuKmmhmd3T9GN58KJw4nOfG 13 | TuRwhJkCgYEA4vI83KCr42FqkkbkkpJQns1oqHyD2HmmyecSYQp/FMIyiHMBpiRQ 14 | dNHB/6tTYTLQsFcWnwaz/TIGbXLoCr2Heu7GPEGOhJzwECszblNlKVeO0gOXrkvo 15 | IAWI0+ClKT5xYL5N9jS6W2J2Lz1eDJu3U7ZG6P43aR3bl/lenWkRdzcCgYEA14SE 16 | N7KLyEjCDU85BP8YZmWSht/V9SJlFyVVlG9JV54ti9rkK8mcMH/fN88LXf7TcmoN 17 | beqVnoV/uYKUhSUVBMsqZQMHWFqevDRLtX9l4vxwqun0bA1FY2HNB/QTQIvJh1Id 18 | SEHYyOCxUk1/KKu8NvC0UNwt5GA3jq2WBa7AtFUCgYEA3TYznva6NWw6XhTeLgSS 19 | swgTsM+WEIcbzYgAATkjAA//A8PeYpzZE9V2HQlZv8+xXYG2GhKFlRKS81Ji3j05 20 | 9tkRv6BDE/6Jfakue6asX6zqGMnJqupwe+4JHkXFl7s29o7pHUjuMa969bcCmpWa 21 | D+4HlopdZoflCXDYCeVlUecCgYA8yabVYunkWwlI4cCOdTk3oIycuEPL+aCTz7b8 22 | wArqyLXGDb5vz1TbpSWbwy1MnNSdH+abyx/ab4MgGwGzMEtmZ7uUdC89L4o4QXPd 23 | RIrDZDqPKqADXhblOi+vf5tyiDsWjQWvXMs9lYrOUQd9vDrBMFFbwU68bJsfBj0b 24 | azf1ZQKBgAPgiGWz5BWgnQx2Y10+YukhKRUxnbZLkAGmwvWYRhpcD4bteIbVhWpr 25 | rM0W+n6bSKJAqlG1Z85wiZLmb0maThfzFT/m82eLTRD32VGELWW5PzJ8dFi1o+Vh 26 | nkBSWCiq6AqjOz+qYIuerm3jjahOWy4jEtXnjoeZr/L4X4BpE1sp 27 | -----END RSA PRIVATE KEY----- 28 | -------------------------------------------------------------------------------- /src/test/resources/keys/test_ssh_key-9.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/Dus69GhkPWgffYEZBijUSqLs/hTe2uSUlj6vG3wXEgp5peNAR9IJz6cMx65o/RbKKa6OuImRLdOpm9wI9SVnV8DBtwmVCij3mLrUMUPvQF1RVIhYOHLO1rar+IV0ibXxp3SKz0HjF8Hyz0mOSuGvC/eVFj24ye8aDFhghz/RANHJoyZg5/03PqrLP8+QNWJ9j5rzn9//QNjB4L0l6JZHflCi2c1YnYfKnhMZolooQpu5WKm/TeBz9xxqgGRVashSAMrOnAelblNjlk1xibhkZNmiJHemEar2nWjJXdSyrTN8AE58kJ5UESo7h//OIS7OlwbVQkrMfRsoUlf130FD areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/nested/home/areese/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhAHddpmSbk11HiaiGeriqzW7xdO08mSvJP/RSzCRdGbOTnQcOgObcQYnI1CRMay2kH5R2ZRajlR80Nqa/QJ3y/zqLNExVUhkJsfnCfK1UIn02d84+6wfCbcKsWIlFVIiBDbPUPepDBZB+VwQUIKtafHIifpFlNz1aKRdOxjmbQiWCqzzQ6AKpue1ylCmW27HzSrNUvcMlNF6NvSoRt4IXXnpTK5ftBoVCS8rVGqi4rECI72BPRngMq0NOPhf8zeqoX0EP8BfyfECEuXlDAMrNpSyIdLOTMUF3EwVb3EmhqiTHg+3gNQcViWyHHaiCiyaiT+JnLsC3q+h4/XkWaZcn areese@dinnercare 2 | -------------------------------------------------------------------------------- /src/test/resources/nested/home/areese/nested/home/areese/.ssh/authorized_keys: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhAHddpmSbk11HiaiGeriqzW7xdO08mSvJP/RSzCRdGbOTnQcOgObcQYnI1CRMay2kH5R2ZRajlR80Nqa/QJ3y/zqLNExVUhkJsfnCfK1UIn02d84+6wfCbcKsWIlFVIiBDbPUPepDBZB+VwQUIKtafHIifpFlNz1aKRdOxjmbQiWCqzzQ6AKpue1ylCmW27HzSrNUvcMlNF6NvSoRt4IXXnpTK5ftBoVCS8rVGqi4rECI72BPRngMq0NOPhf8zeqoX0EP8BfyfECEuXlDAMrNpSyIdLOTMUF3EwVb3EmhqiTHg+3gNQcViWyHHaiCiyaiT+JnLsC3q+h4/XkWaZcn areese@dinnercare 2 | -------------------------------------------------------------------------------- /travis/publish_to_bintray.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2015 Yahoo! Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the License); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an AS IS BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # Simple script to use from Travis-CI that will push out a jar to 17 | # bintray maven repository. This script should be ran from the travis 18 | # machine, and specified to be used in the yml build configuration. 19 | # 20 | # Poor man's deploy script. 21 | 22 | # TODO: Once https://github.com/travis-ci/dpl/pull/259 is merged, 23 | # modify this script and use the provider. 24 | 25 | set -e 26 | 27 | echo ${TRAVIS_TAG} | grep -q "sshd_proxy-"; 28 | IS_NOT_RELEASE=$? 29 | 30 | if ((${IS_NOT_RELEASE} == 1)); then 31 | echo "Not a tagged release version." 32 | echo "To release this tagged artifact into bintray, the git tag must be of" 33 | echo "the format: sshd_proxy-*. Example: sshd_proxy-0.0.2, sshd_proxy-1.2.3" 34 | echo "etc." 35 | exit 0 36 | fi 37 | 38 | echo "Publishing to bintray at https://bintray.com/yahoo" 39 | 40 | CURRENT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -E '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+') 41 | echo "Releasing version: ${CURRENT_VERSION}" 42 | 43 | # Some initial setup to get the right files in the right location for us 44 | mv dependency-reduced-pom.xml target/sshd_proxy-${CURRENT_VERSION}.pom 45 | mv pom.xml target/sshd_proxy-${CURRENT_VERSION}-original.pom 46 | mv target/original-sshd_proxy-${CURRENT_VERSION}.jar target/sshd_proxy-${CURRENT_VERSION}-original.jar 47 | 48 | ARTIFACTS=( sshd_proxy-${CURRENT_VERSION}-original.jar sshd_proxy-${CURRENT_VERSION}.jar sshd_proxy-${CURRENT_VERSION}-site.jar sshd_proxy-${CURRENT_VERSION}-sources.jar sshd_proxy-${CURRENT_VERSION}-javadoc.jar sshd_proxy-${CURRENT_VERSION}.pom sshd_proxy-${CURRENT_VERSION}-original.pom ) 49 | 50 | 51 | # Upload and Publish each artifact into bintray 52 | # https://bintray.com/yahoo/maven/artifactory_ssh_proxy/view 53 | for artifact in "${ARTIFACTS[@]}" 54 | do 55 | echo "Uploading and publishing $artifact at version ${CURRENT_VERSION}..." 56 | UPLOAD_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -T target/$artifact -u ${BINTRAY_USER}:${BINTRAY_API_KEY} "https://api.bintray.com/maven/yahoo/maven/artifactory_ssh_proxy/com/yahoo/sshd/sshd_proxy/${CURRENT_VERSION}/${artifact};publish=1") 57 | if (( $UPLOAD_RESPONSE >= 200 && $UPLOAD_RESPONSE < 227 )); then 58 | echo "Success Uploading & Publishing $artifact." 59 | echo 60 | else 61 | echo "Error during upload of $artifact" 62 | echo "HTTP $UPLOAD_RESPONSE" 63 | echo 64 | exit 1 65 | fi 66 | echo 67 | done 68 | echo "https://bintray.com/yahoo/maven/artifactory_ssh_proxy/${CURRENT_VERSION}/view" 69 | echo 70 | --------------------------------------------------------------------------------