Skip to content
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

Verify signatures on official plugins #30800

Merged
merged 16 commits into from
May 25, 2018
Merged
4 changes: 3 additions & 1 deletion distribution/archives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ task createPluginsDir(type: EmptyDirTask) {
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, boolean oss) {
return copySpec {
into("elasticsearch-${version}") {
with libFiles
into('lib') {
with libFiles
}
into('config') {
dirMode 0750
fileMode 0660
Expand Down
8 changes: 5 additions & 3 deletions distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,15 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
* Common files in all distributions *
*****************************************************************************/
libFiles = copySpec {
into 'lib'
// delay by using closures, since they have not yet been configured, so no jar task exists yet
from { project(':server').jar }
from { project(':server').configurations.runtime }
from { project(':libs:plugin-classloader').jar }
// delay add tools using closures, since they have not yet been configured, so no jar task exists yet
from { project(':distribution:tools:launchers').jar }
from { project(':distribution:tools:plugin-cli').jar }
into('tools/plugin-cli') {
from { project(':distribution:tools:plugin-cli').jar }
from { project(':distribution:tools:plugin-cli').configurations.runtime }
}
}

modulesFiles = { oss ->
Expand Down
23 changes: 16 additions & 7 deletions distribution/packages/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,23 @@ Closure commonPackageConfig(String type, boolean oss) {
include 'README.textile'
fileMode 0644
}
into('lib') {
with copySpec {
with libFiles
// we need to specify every intermediate directory so we iterate through the parents; duplicate calls with the same part are fine
eachFile { FileCopyDetails fcp ->
String[] segments = fcp.relativePath.segments
for (int i = segments.length - 2; i > 0 && segments[i] != 'lib'; --i) {
directory('/' + segments[0..i].join('/'), 0755)
}
fcp.mode = 0644
}
}
}
into('modules') {
with copySpec {
with modulesFiles(oss)
// we need to specify every intermediate directory, but modules could have sub directories
// and there might not be any files as direct children of intermediates (eg platform)
// so we must iterate through the parents, but duplicate calls with the same path
// are ok (they don't show up in the built packages)
// we need to specify every intermediate directory so we iterate through the parents; duplicate calls with the same part are fine
eachFile { FileCopyDetails fcp ->
String[] segments = fcp.relativePath.segments
for (int i = segments.length - 2; i > 0 && segments[i] != 'modules'; --i) {
Expand Down Expand Up @@ -251,8 +261,8 @@ ospackage {
signingKeyId = project.hasProperty('signing.keyId') ? project.property('signing.keyId') : 'D88E42B4'
signingKeyPassphrase = project.property('signing.password')
signingKeyRingFile = project.hasProperty('signing.secretKeyRingFile') ?
project.file(project.property('signing.secretKeyRingFile')) :
new File(new File(System.getProperty('user.home'), '.gnupg'), 'secring.gpg')
project.file(project.property('signing.secretKeyRingFile')) :
new File(new File(System.getProperty('user.home'), '.gnupg'), 'secring.gpg')
}

requires('coreutils')
Expand All @@ -263,7 +273,6 @@ ospackage {
permissionGroup 'root'

into '/usr/share/elasticsearch'
with libFiles
with noticeFile
}

Expand Down
6 changes: 6 additions & 0 deletions distribution/src/bin/elasticsearch-cli
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ do
source "`dirname "$0"`"/$additional_source
done

IFS=';' read -r -a additional_classpath_directories <<< "$ES_ADDITIONAL_CLASSPATH_DIRECTORIES"
for additional_classpath_directory in "${additional_classpath_directories[@]}"
do
ES_CLASSPATH="$ES_CLASSPATH:$ES_HOME/$additional_classpath_directory/*"
done

exec \
"$JAVA" \
$ES_JAVA_OPTS \
Expand Down
6 changes: 6 additions & 0 deletions distribution/src/bin/elasticsearch-cli.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ for /f "tokens=1*" %%a in ("%*") do (
set arguments=%%b
)

if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES (
for %%a in ("%ES_ADDITIONAL_CLASSPATH_DIRECTORIES:;=","%") do (
set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/%%a/*
)
)

%JAVA% ^
%ES_JAVA_OPTS% ^
-Des.path.home="%ES_HOME%" ^
Expand Down
3 changes: 2 additions & 1 deletion distribution/src/bin/elasticsearch-plugin
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

"`dirname "$0"`"/elasticsearch-cli \
ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli \
"`dirname "$0"`"/elasticsearch-cli \
org.elasticsearch.plugins.PluginCli \
"$@"
1 change: 1 addition & 0 deletions distribution/src/bin/elasticsearch-plugin.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
setlocal enabledelayedexpansion
setlocal enableextensions

set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli
call "%~dp0elasticsearch-cli.bat" ^
org.elasticsearch.plugins.PluginCli ^
%* ^
Expand Down
8 changes: 8 additions & 0 deletions distribution/tools/plugin-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,22 @@

apply plugin: 'elasticsearch.build'

archivesBaseName = 'elasticsearch-plugin-cli'

dependencies {
compileOnly "org.elasticsearch:elasticsearch:${version}"
compileOnly "org.elasticsearch:elasticsearch-cli:${version}"
compile "org.bouncycastle:bcpg-jdk15on:1.59"
compile "org.bouncycastle:bcprov-jdk15on:1.59"
testCompile "org.elasticsearch.test:framework:${version}"
testCompile 'com.google.jimfs:jimfs:1.1'
testCompile 'com.google.guava:guava:18.0'
}

dependencyLicenses {
mapping from: /bc.*/, to: 'bouncycastle'
}

test {
// TODO: find a way to add permissions for the tests in this module
systemProperty 'tests.security.manager', 'false'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ee93e5376bb6cf0a15c027b5f5e4393f2738e709
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2507204241ab450456bdb8e8c0a8f986e418bd99
17 changes: 17 additions & 0 deletions distribution/tools/plugin-cli/licenses/bouncycastle-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Copyright (c) 2000-2015 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading