This repository was archived by the owner on Dec 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start on dummy shell to allow background forwarding
We don't use ssh to deploy right now * special hack, because I can't seem to get ssh output to work write. without the \r\n on os-x and rhel6, the * terminal doesn't start on a newline. it just eats it, and starts again on the same line. need to test on a * non-OS-X terminal Fix to use an enum to pick the shell mode Rework the layout of the forwarding filtering Add further tests for forwarding Add restrictions to prevent forwarding to hosts other than the artifactory host organize imports update notes Cleanup javadocs Cleanup Shell minor cleanup Fix groovy javadoc
- Loading branch information
Allen Reese
committed
Jan 6, 2015
1 parent
13b8b0a
commit 2ae27b4
Showing
18 changed files
with
1,082 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
To eat the auth. | ||
|
||
|
||
Need to set the channelFactories: | ||
|
||
ssh.setChannelFactories(channelFactories); | ||
|
||
|
||
if (channelFactories == null) { | ||
channelFactories = Arrays.asList( | ||
new ChannelSession.Factory(), | ||
new TcpipServerChannel.DirectTcpipFactory()); | ||
} | ||
|
||
|
||
Need to override TcpipServerChannel.DirectTcpipFactory and friends. | ||
|
||
Need to override the IOServiceFactory: | ||
org.apache.sshd.common.forward.TcpipServerChannel | ||
|
||
connector = getSession().getFactoryManager().getIoServiceFactory() | ||
.createConnector(handler); | ||
|
||
Which returns org.apache.sshd.common.io.nio2.Nio2ServiceFactory, which we need to override | ||
To override org.apache.sshd.common.io.nio2.Nio2Connector, which returns an org.apache.sshd.common.io.nio2.Nio2Session | ||
|
||
Which is where we can finally start eating bytes | ||
and worse. | ||
|
||
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. | ||
|
||
This will get really Ugly because if Authorization comes as multiple packets, we'll have to buffer that bit somewhere. | ||
|
||
Basically we need to buffer at least the Authorization header: | ||
WWW-Authenticate: Basic realm="nmrs_m7VKmomQ2YM3:" | ||
|
||
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. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
For auth override the following are required: | ||
|
||
1. tcp port forwarding of port X to artifactory host:port. | ||
2. Stream sniffing, we need to read the byte from the stream stripping out any Authorization headers. | ||
3. Add the authorization header where it's: ssh_user:encrypted password. | ||
4. encrypted password comes from encrypting a salt and the username. | ||
Another option is to just pass a token, and then have an artifactory plugin verify the token | ||
by connecting back to the ssh server, but that adds an extra RT. | ||
5. if in the same jvm 4 may change to be more secure. | ||
6. write a plugin to validate the password. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.