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

Plugin script to set proper plugin config dir attributes #14048

Merged

Conversation

javanna
Copy link
Member

@javanna javanna commented Oct 9, 2015

Depending on how elasticsearch is installed, we have two scenarios to take into account that relate to user, group and permissions assigned to the config directory:

  1. deb/rpm package: /etc/elasticsearch is root:elasticsearch 750 and the plugin script is run from root user
  2. tar/zip archive: es config dir is most likely elasticsearch:elasticsearch and the plugin script is run from elasticsearch user

When the plugin script copies over the plugin config dir within the es config dir, it should take care of setting the proper user, group and permissions, which vary depending on how elasticsearch was installed in the first place. Should be root:elasticsearch 750 if installed from a package, or elasticsearch:elasticsearch if installed from an archive.

This commit makes sure that the plugin script looks at user, group and permissions of the config dir and copies them over to the plugin config subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed in the first place.

Relates to #11016

@javanna javanna added >enhancement review :Core/Infra/Plugins Plugin API and infrastructure labels Oct 9, 2015
@javanna
Copy link
Member Author

javanna commented Oct 9, 2015

@jaymode @tlrx can you have a look?

@nik9000
Copy link
Member

nik9000 commented Oct 9, 2015

  1. tar/zip archive: es config dir is elasticsearch:elasticsearch and the plugin script is run from elasticsearch user

Err, well, tar/zip is wild west. bin/plugin needs to be run as a user that can modify the elasticsearch files but beyond that we can't be sure of anything. Right?

@@ -274,15 +275,47 @@ private void extract(PluginHandle pluginHandle, Terminal terminal, Path pluginFi
try {
terminal.println(VERBOSE, "Found config, moving to %s", destConfigDirectory.toAbsolutePath());
moveFilesWithoutOverwriting(sourceConfigDirectory, destConfigDirectory, ".new");

if (Environment.getFileStore(destConfigDirectory).supportsFileAttributeView(PosixFileAttributeView.class)) {
//We take owner, group and permissions from the parent ES_CONFIG directory, assuming they were properly set depending
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/We take owner/We copy owner/ ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

@nik9000
Copy link
Member

nik9000 commented Oct 9, 2015

Left a question about +x but otherwise LGTM.

@javanna
Copy link
Member Author

javanna commented Oct 12, 2015

I pushed new commits, ready for another review round, @jaymode @nik9000 can you have a look? ;)

@nik9000
Copy link
Member

nik9000 commented Oct 12, 2015

LGTM

@jaymode
Copy link
Member

jaymode commented Oct 13, 2015

LGTM

@javanna javanna force-pushed the enhancement/config_plugin_permissions branch from eef24fa to c61acc1 Compare October 13, 2015 12:33
Depending on how elasticsearch is installed, we have two scenarios to take into account that relate to user, group and permissions assigned to the config directory:

1) deb/rpm package: /etc/elasticsearch is root:elasticsearch 750 and the plugin script is run from root user
2) tar/zip archive: es config dir is most likely elasticsearch:elasticsearch and the plugin script is most likely run from elasticsearch user

When the plugin script copies over the plugin config dir within the es config dir, it should take care of setting the proper user, group and permissions, which vary depending on how elasticsearch was installed in the first place. Should be root:elasticsearch 750 if installed from a package, or elasticsearch:elasticsearch if installed from an archive.

This commit makes sure that the plugin script looks at user, group and permissions of the config dir and copies them over to the plugin config subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed in the first place. We also make sure that execute permissions are left untouched for files.

Relates to elastic#11016
Closes elastic#14048
@javanna javanna force-pushed the enhancement/config_plugin_permissions branch from c61acc1 to 4d7d29f Compare October 13, 2015 13:56
@javanna javanna merged commit 4d7d29f into elastic:master Oct 13, 2015
javanna added a commit that referenced this pull request Oct 13, 2015
Depending on how elasticsearch is installed, we have two scenarios to take into account that relate to user, group and permissions assigned to the config directory:

1) deb/rpm package: /etc/elasticsearch is root:elasticsearch 750 and the plugin script is run from root user
2) tar/zip archive: es config dir is most likely elasticsearch:elasticsearch and the plugin script is most likely run from elasticsearch user

When the plugin script copies over the plugin config dir within the es config dir, it should take care of setting the proper user, group and permissions, which vary depending on how elasticsearch was installed in the first place. Should be root:elasticsearch 750 if installed from a package, or elasticsearch:elasticsearch if installed from an archive.

This commit makes sure that the plugin script looks at user, group and permissions of the config dir and copies them over to the plugin config subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed in the first place. We also make sure that execute permissions are left untouched for files.

Relates to #11016
Closes #14048
javanna added a commit that referenced this pull request Oct 13, 2015
Depending on how elasticsearch is installed, we have two scenarios to take into account that relate to user, group and permissions assigned to the config directory:

1) deb/rpm package: /etc/elasticsearch is root:elasticsearch 750 and the plugin script is run from root user
2) tar/zip archive: es config dir is most likely elasticsearch:elasticsearch and the plugin script is most likely run from elasticsearch user

When the plugin script copies over the plugin config dir within the es config dir, it should take care of setting the proper user, group and permissions, which vary depending on how elasticsearch was installed in the first place. Should be root:elasticsearch 750 if installed from a package, or elasticsearch:elasticsearch if installed from an archive.

This commit makes sure that the plugin script looks at user, group and permissions of the config dir and copies them over to the plugin config subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed in the first place. We also make sure that execute permissions are left untouched for files.

Relates to #11016
Closes #14048
javanna added a commit that referenced this pull request Oct 13, 2015
Depending on how elasticsearch is installed, we have two scenarios to take into account that relate to user, group and permissions assigned to the config directory:

1) deb/rpm package: /etc/elasticsearch is root:elasticsearch 750 and the plugin script is run from root user
2) tar/zip archive: es config dir is most likely elasticsearch:elasticsearch and the plugin script is most likely run from elasticsearch user

When the plugin script copies over the plugin config dir within the es config dir, it should take care of setting the proper user, group and permissions, which vary depending on how elasticsearch was installed in the first place. Should be root:elasticsearch 750 if installed from a package, or elasticsearch:elasticsearch if installed from an archive.

This commit makes sure that the plugin script looks at user, group and permissions of the config dir and copies them over to the plugin config subdirectory, whatever they are, so that they get properly setup depending on how elasticsearch was installed in the first place. We also make sure that execute permissions are left untouched for files.

Relates to #11016
Closes #14048
@clintongormley clintongormley changed the title Plugins: plugin script to set proper plugin config dir attributes Plugin script to set proper plugin config dir attributes Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants