-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[JENKINS-60381] Remove old, deprecated agent protocols. #4387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
oleg-nenashev
merged 5 commits into
jenkinsci:master
from
jeffret-b:removeDeprecatedProtocols
Jan 10, 2020
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d611ba1
Remove deprecated agent protocols.
jeffret-b 659f388
Cleanup JavaDoc from references to removed classes.
jeffret-b bd0d956
Update to Remoting without protocols.
jeffret-b 50921cc
Reduce JnlpSlaveAgentProtocol to minimum.
jeffret-b 69dcf23
Add back in AgentProtocolTest.
jeffret-b File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
94 changes: 0 additions & 94 deletions
94
core/src/main/java/jenkins/slaves/DeprecatedAgentProtocolMonitor.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
95 changes: 7 additions & 88 deletions
95
core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,97 +1,16 @@ | ||
| package jenkins.slaves; | ||
|
|
||
| import hudson.Extension; | ||
| import hudson.ExtensionList; | ||
| import hudson.model.Computer; | ||
| import java.io.IOException; | ||
| import java.net.Socket; | ||
| import java.util.Collections; | ||
| import java.util.logging.Logger; | ||
| import javax.inject.Inject; | ||
| import jenkins.AgentProtocol; | ||
| import jenkins.security.HMACConfidentialKey; | ||
| import org.jenkinsci.Symbol; | ||
| import org.jenkinsci.remoting.engine.JnlpConnectionState; | ||
| import org.jenkinsci.remoting.engine.JnlpProtocol1Handler; | ||
|
|
||
| /** | ||
| * {@link AgentProtocol} that accepts connection from agents. | ||
| * | ||
| * <h2>Security</h2> | ||
| * <p> | ||
| * Once connected, remote agents can send in commands to be | ||
| * executed on the master, so in a way this is like an rsh service. | ||
| * Therefore, it is important that we reject connections from | ||
| * unauthorized remote agents. | ||
| * | ||
| * <p> | ||
| * We do this by computing HMAC of the agent name. | ||
| * This code is sent to the agent inside the {@code .jnlp} file | ||
| * (this file itself is protected by HTTP form-based authentication that | ||
| * we use everywhere else in Jenkins), and the agent sends this | ||
| * token back when it connects to the master. | ||
| * Unauthorized agents can't access the protected {@code .jnlp} file, | ||
| * so it can't impersonate a valid agent. | ||
| * | ||
| * <p> | ||
| * We don't want to force the inbound agents to be restarted | ||
| * whenever the server restarts, so right now this secret master key | ||
| * is generated once and used forever, which makes this whole scheme | ||
| * less secure. | ||
| * | ||
| * @author Kohsuke Kawaguchi | ||
| * @since 1.467 | ||
| * This class was part of the old JNLP1 protocol, which has been removed. | ||
| * The SLAVE_SECRET was still used by some plugins. It has been moved to | ||
| * JnlpAgentReceiver as a more suitable location, but this alias retained | ||
| * for compatibility. References should be updated to the new location. | ||
| */ | ||
| @Extension | ||
| @Symbol("jnlp") | ||
| public class JnlpSlaveAgentProtocol extends AgentProtocol { | ||
| /** | ||
| * Our logger | ||
| */ | ||
| private static final Logger LOGGER = Logger.getLogger(JnlpSlaveAgentProtocol.class.getName()); | ||
| /** | ||
| * This secret value is used as a seed for agents. | ||
| */ | ||
| public static final HMACConfidentialKey SLAVE_SECRET = | ||
| new HMACConfidentialKey(JnlpSlaveAgentProtocol.class, "secret"); | ||
|
|
||
| private NioChannelSelector hub; | ||
|
|
||
| private JnlpProtocol1Handler handler; | ||
|
|
||
| @Inject | ||
| public void setHub(NioChannelSelector hub) { | ||
| this.hub = hub; | ||
| this.handler = new JnlpProtocol1Handler(JnlpAgentReceiver.DATABASE, Computer.threadPoolForRemoting, | ||
| hub.getHub(), true); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isOptIn() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isDeprecated() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String getName() { | ||
| return handler.isEnabled() ? handler.getName() : null; | ||
| } | ||
|
|
||
| @Override | ||
| public String getDisplayName() { | ||
| return Messages.JnlpSlaveAgentProtocol_displayName(); | ||
| } | ||
|
|
||
| @Override | ||
| public void handle(Socket socket) throws IOException, InterruptedException { | ||
| handler.handle(socket, | ||
| Collections.singletonMap(JnlpConnectionState.COOKIE_KEY, JnlpAgentReceiver.generateCookie()), | ||
| ExtensionList.lookup(JnlpAgentReceiver.class)); | ||
| } | ||
| @Deprecated | ||
| public class JnlpSlaveAgentProtocol { | ||
|
|
||
| public static final HMACConfidentialKey SLAVE_SECRET = JnlpAgentReceiver.SLAVE_SECRET; | ||
|
|
||
| } |
67 changes: 0 additions & 67 deletions
67
core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol2.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.