private static void ValidateSshServer(SshServer server) { if (server.SshPort <= 0) { throw new ValidateException("SshPort", "You need a SSH port!"); } if (string.IsNullOrEmpty(server.SshUsername)) { throw new ValidateException("SshUsername", "You need a username!"); } if (string.IsNullOrEmpty(server.SshPassword) && (server.SshKeyFileName == null || !server.SshKeyFileName.Any())) { throw new ValidateException("SshPassword", "You need at least a password or a key file!"); } if (server.SshUsername == "root") { throw new ValidateException("SshUsername", "Dont use root here!"); } try { RconStatic.AuthenticateOnTheSshServer(server); } catch (CommandException e) { throw new ValidateException("Id", e.Message); } }