diff --git a/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java b/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java index f66537b4..08c2c902 100644 --- a/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java +++ b/src/main/java/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor.java @@ -29,7 +29,10 @@ import hudson.plugins.sshslaves.SSHLauncher; import hudson.slaves.ComputerLauncher; import hudson.slaves.SlaveComputer; +import hudson.util.VersionNumber; import jenkins.model.Jenkins; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.DoNotUse; /** * An administrative warning that checks all SSH slaves have a {@link SshHostKeyVerificationStrategy} @@ -45,7 +48,7 @@ public boolean isActivated() { for (Computer computer : Jenkins.getActiveInstance().getComputers()) { if (computer instanceof SlaveComputer) { ComputerLauncher launcher = ((SlaveComputer) computer).getLauncher(); - + if (launcher instanceof SSHLauncher && null == ((SSHLauncher) launcher).getSshHostKeyVerificationStrategy()) { return true; } @@ -55,4 +58,16 @@ public boolean isActivated() { return false; } + //TODO: This method can be removed when the baseline is updated to 2.103. + /** + * @return true if this version of the plugin is running on a Jenkins version where JENKINS-43786 is included. + */ + @Restricted(DoNotUse.class) + public boolean isTheNewDesignAvailable() { + final VersionNumber version = Jenkins.getVersion(); + if (version != null && version.isNewerThan(new VersionNumber("2.103"))) { + return true; + } + return false; + } } diff --git a/src/main/resources/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor/message.jelly b/src/main/resources/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor/message.jelly index 31657fab..eda75c18 100644 --- a/src/main/resources/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor/message.jelly +++ b/src/main/resources/hudson/plugins/sshslaves/verifiers/MissingVerificationStrategyAdministrativeMonitor/message.jelly @@ -22,8 +22,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - -
-

SSH Host Key Verifiers are not configured for all SSH slaves on this Jenkins instance. This could leave these slaves open to man-in-the-middle attacks. Update your slave configuration to resolve this.

-
+ + + +
+

SSH Host Key Verifiers are not configured for all SSH slaves on this Jenkins instance. This could leave these slaves open to man-in-the-middle attacks. Update your slave configuration to resolve this.

+
+
+ + +
+ SSH Host Key Verifiers are not configured for all SSH slaves on this Jenkins instance. This could leave these slaves open to man-in-the-middle attacks. Update your slave configuration to resolve this. +
+
+
\ No newline at end of file