Skip to content

Commit 6a07925

Browse files
committed
Dropped support for Elasticsearch 7 [skip ci]
1 parent b64b698 commit 6a07925

File tree

1 file changed

+7
-61
lines changed

1 file changed

+7
-61
lines changed

index.js

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,7 @@ const versionMap = {
2929
'8.3': '8.3.3',
3030
'8.2': '8.2.3',
3131
'8.1': '8.1.3',
32-
'8.0': '8.0.1',
33-
'7.17': '7.17.28',
34-
'7.16': '7.16.3',
35-
'7.15': '7.15.2',
36-
'7.14': '7.14.2',
37-
'7.13': '7.13.4',
38-
'7.12': '7.12.1',
39-
'7.11': '7.11.1',
40-
'7.10': '7.10.2',
41-
'7.9': '7.9.3',
42-
'7.8': '7.8.1',
43-
'7.7': '7.7.1',
44-
'7.6': '7.6.2',
45-
'7.5': '7.5.2',
46-
'7.4': '7.4.2',
47-
'7.3': '7.3.2',
48-
'7.2': '7.2.1',
49-
'7.1': '7.1.1',
50-
'7.0': '7.0.1'
32+
'8.0': '8.0.1'
5133
};
5234

5335
function run() {
@@ -89,7 +71,7 @@ function getVersion() {
8971
if (versionMap[version]) {
9072
version = versionMap[version];
9173
}
92-
if (!/^[789]\.\d{1,2}\.\d{1,2}$/.test(version)) {
74+
if (!/^[89]\.\d{1,2}\.\d{1,2}$/.test(version)) {
9375
throw `Elasticsearch version not supported: ${version}`;
9476
}
9577
return version;
@@ -140,28 +122,6 @@ function download() {
140122
}
141123
}
142124

143-
// log4j
144-
// Elasticsearch 6 and 7 are not susceptible to RCE due to Java Security Manager
145-
// set flag to prevent information leak via DNS
146-
// https://discuss.elastic.co/t/apache-log4j2-remote-code-execution-rce-vulnerability-cve-2021-44228-esa-2021-31/291476
147-
function fixLog4j() {
148-
const jvmOptionsPath = path.join(esHome, 'config', 'jvm.options');
149-
if (!fs.readFileSync(jvmOptionsPath).includes('log4j2.formatMsgNoLookups')) {
150-
fs.appendFileSync(jvmOptionsPath, '\n-Dlog4j2.formatMsgNoLookups=true\n');
151-
152-
// needed for Elasticsearch < 6.5
153-
// but remove for all versions
154-
if (!isWindows()) {
155-
const coreJarPath = fs.readdirSync(path.join(esHome, 'lib')).filter(fn => fn.includes('log4j-core-'))[0];
156-
if (coreJarPath) {
157-
run('zip', '-q', '-d', path.join(esHome, 'lib', coreJarPath), 'org/apache/logging/log4j/core/lookup/JndiLookup.class');
158-
}
159-
} else if (elasticsearchVersion < '6.5') {
160-
throw 'Elasticsearch version not available';
161-
}
162-
}
163-
}
164-
165125
function installPlugins() {
166126
let plugins = (process.env['INPUT_PLUGINS'] || '').trim();
167127
if (plugins.length > 0) {
@@ -178,23 +138,16 @@ function installPlugins() {
178138
}
179139
});
180140

181-
// install multiple plugins at once with Elasticsearch 7.6+
141+
// install multiple plugins at once
182142
// https://www.elastic.co/guide/en/elasticsearch/plugins/7.6/installing-multiple-plugins.html
183143
const versionParts = elasticsearchVersion.split('.');
184-
const atOnce = parseInt(versionParts[0]) >= 7 && parseInt(versionParts[1]) >= 6;
185144
let pluginCmd = path.join(esHome, 'bin', 'elasticsearch-plugin');
186145
let runCmd = run;
187146
if (isWindows()) {
188147
pluginCmd += '.bat';
189148
runCmd = runBat;
190149
}
191-
if (atOnce) {
192-
runCmd(pluginCmd, 'install', '--silent', '--batch', ...plugins);
193-
} else {
194-
plugins.forEach( function(plugin) {
195-
runCmd(pluginCmd, 'install', '--silent', '--batch', plugin);
196-
});
197-
}
150+
runCmd(pluginCmd, 'install', '--silent', '--batch', ...plugins);
198151
}
199152
}
200153

@@ -248,26 +201,19 @@ const esHome = path.join(cacheDir, elasticsearchVersion);
248201
// java compatibility
249202
// https://www.elastic.co/support/matrix
250203
const majorVersion = parseInt(elasticsearchVersion.split('.')[0]);
251-
const javaHome = majorVersion == 7 ? process.env.JAVA_HOME_11_X64 : (majorVersion == 8 ? process.env.JAVA_HOME_17_X64 : process.env.JAVA_HOME_21_X64);
204+
const javaHome = majorVersion == 8 ? process.env.JAVA_HOME_17_X64 : process.env.JAVA_HOME_21_X64;
252205
if (javaHome) {
253-
if (majorVersion == 7) {
254-
process.env.JAVA_HOME = javaHome;
255-
addToEnv(`JAVA_HOME=${javaHome}`);
256-
} else {
257-
process.env.ES_JAVA_HOME = javaHome;
258-
addToEnv(`ES_JAVA_HOME=${javaHome}`);
259-
}
206+
process.env.ES_JAVA_HOME = javaHome;
207+
addToEnv(`ES_JAVA_HOME=${javaHome}`);
260208
}
261209

262210
if (!fs.existsSync(esHome)) {
263211
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'elasticsearch-'));
264212
process.chdir(tmpDir);
265213
download();
266-
fixLog4j();
267214
installPlugins();
268215
} else {
269216
console.log('Elasticsearch cached');
270-
fixLog4j();
271217
}
272218

273219
setConfig(esHome);

0 commit comments

Comments
 (0)