Plugin security policies not reliably being automatically loaded?

(Jason Anderson) #1

We have been having an interesting issue with the repository-hdfs plugin on our Elasticsearch cluster. It seems as though the plugin security policy is not "sticking" - that is the best way I can describe this confusing behavior.

What happens is, we start the Elasticsearch cluster. Then, we create a new repository:

curl -XPUT --data-binary @- localhost:9200/_snapshot/new_repo <<JSON
  "type": "hdfs",
  "settings": {
    "uri": "hdfs://",
    "path": "/path/to/snapshot/dir"
    "conf_location": "/path/to/hdfs-site.xml"

Then we attempt to verify it:

curl -XPOST localhost:9200/_snapshot/new_repo/_verify

The first time we run this on our node, we get an acknowledgement from Elasticsearch and the repository verification also succeeds. However, creating a snapshot subsequently fails with this error:

2017-07-12_19:00:49.25873 [2017-07-12T19:00:49,211][WARN ][r.suppressed             ] path: /_snapshot/testrepo/snapshot1, params: {repository=testrepo, wait_for_completion=true, snapshot=snapshot1}
2017-07-12_19:00:49.25876 org.elasticsearch.repositories.RepositoryException: [testrepo] could not read repository data from index blob
2017-07-12_19:00:49.25876 	at org.elasticsearch.repositories.blobstore.BlobStoreRepository.getRepositoryData( ~[elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25876 	at org.elasticsearch.snapshots.SnapshotsService.createSnapshot( ~[elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25876 	at org.elasticsearch.action.admin.cluster.snapshots.create.TransportCreateSnapshotAction.masterOperation( ~[elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25877 	at org.elasticsearch.action.admin.cluster.snapshots.create.TransportCreateSnapshotAction.masterOperation( ~[elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25877 	at ~[elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25878 	at$AsyncSingleAction$2.doRun( ~[elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25878 	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun( [elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25878 	at [elasticsearch-5.4.3.jar:5.4.3]
2017-07-12_19:00:49.25878 	at java.util.concurrent.ThreadPoolExecutor.runWorker( [?:1.8.0_112]
2017-07-12_19:00:49.25879 	at java.util.concurrent.ThreadPoolExecutor$ [?:1.8.0_112]
2017-07-12_19:00:49.25879 	at [?:1.8.0_112]
2017-07-12_19:00:49.25879 Caused by: access denied ("" "" "read")
2017-07-12_19:00:49.25879 	at org.apache.hadoop.ipc.ProtobufHelper.getRemoteException( ~[?:?]
2017-07-12_19:00:49.25880 	at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getListing( ~[?:?]
2017-07-12_19:00:49.25880 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
2017-07-12_19:00:49.25880 	at sun.reflect.NativeMethodAccessorImpl.invoke( ~[?:?]
2017-07-12_19:00:49.25881 	at sun.reflect.DelegatingMethodAccessorImpl.invoke( ~[?:?]
2017-07-12_19:00:49.25881 	at java.lang.reflect.Method.invoke( ~[?:1.8.0_112]
2017-07-12_19:00:49.25881 	at ~[?:?]
2017-07-12_19:00:49.25881 	at ~[?:?]
2017-07-12_19:00:49.25881 	at com.sun.proxy.$Proxy34.getListing(Unknown Source) ~[?:?]
2017-07-12_19:00:49.25882 	at org.apache.hadoop.hdfs.DFSClient.listPaths( ~[?:?]
2017-07-12_19:00:49.25883 	at org.apache.hadoop.hdfs.DFSClient.listPaths( ~[?:?]
2017-07-12_19:00:49.25883 	at org.apache.hadoop.fs.Hdfs.listStatus( ~[?:?]
2017-07-12_19:00:49.25883 	at org.apache.hadoop.fs.FileContext$Util$ ~[?:?]
2017-07-12_19:00:49.25884 	at org.apache.hadoop.fs.FileContext$Util$ ~[?:?]
2017-07-12_19:00:49.25884 	at org.apache.hadoop.fs.FSLinkResolver.resolve( ~[?:?]
2017-07-12_19:00:49.25884 	at org.apache.hadoop.fs.FileContext$Util.listStatus( ~[?:?]
2017-07-12_19:00:49.25884 	at org.apache.hadoop.fs.FileContext$Util.listStatus( ~[?:?]
2017-07-12_19:00:49.25884 	at org.apache.hadoop.fs.FileContext$Util.listStatus( ~[?:?]
2017-07-12_19:00:49.25885 	at org.elasticsearch.repositories.hdfs.HdfsBlobContainer$ ~[?:?]
2017-07-12_19:00:49.25885 	at org.elasticsearch.repositories.hdfs.HdfsBlobContainer$ ~[?:?]
2017-07-12_19:00:49.25885 	at org.elasticsearch.repositories.hdfs.HdfsBlobStore.lambda$execute$0( ~[?:?]
2017-07-12_19:00:49.25885 	at Method) ~[?:1.8.0_112]
2017-07-12_19:00:49.25885 	at ~[?:1.8.0_112]

Furthermore, if we restart Elasticsearch, repository verification fails with a similar security exception.

The only way I've found to fix these errors is to manually specify an override to point the java process directly to the security policy file, via$ES_HOME/plugins/repository-hdfs/plugin-security.policy... which seems wrong.

After looking through the code, it looks like these policy files should be automatically loaded and applied when using the plugins. And, I have been unable to find other users who are experiencing the same error, which makes me think that there is something peculiar with our particular setup or environment, but I haven't found anything that seems fishy.

Has anybody else experienced a similar error? Are any of my assumptions about how the plugin architecture works incorrect? And, what else could I provide to help debug this particular error?

Thanks very much in advance.

(Simon Willnauer) #2

I just looked briefly but I wonder if this is related to what version of ES are you running?

(James Baiera) #3

@Jason_Anderson Have you seen this behavior happen on any other plugins or is it only happening on the HDFS Plugin? Are you executing against a secured HDFS deployment?

(Jason Anderson) #4

@s1monw That's what I had suspected as well at first, as I was on 5.3.0. I made sure to upgrade everything and I'm now running 5.4.3 on my test cluster, but I have the same issue as before. Although I am testing against a development HDFS setup that does not have security enabled on it.

@james.baiera I haven't seen it with any other plugins, but I'm also not using any other plugins that I know of. So it could very well be affecting all plugins. As mentioned to Simon, I'm not hitting a secured HDFS deployment.

The fact that it sometimes works is particularly odd, and leads me to believe there's something wonky with how the policy files themselves are loaded, or some idiosyncrasy with my current environment.

Update: one other thing that may be of note is that I'm running elasticsearch out of /srv/elasticsearch, which is symlinked to /srv/elasticsearch-5.4.3. I saw other issues reported in the past relating to symlink resolution. The docs specify that it should be allowed if your home path or config path is a symlink, so I figured I was safe.

(James Baiera) #5

@Jason_Anderson Could you include the full logs from the node that is failing? I'd also be interested if you are able to reproduce this with a different plugin or if it is just entirely an HDFS Plugin issue.

(Pacer Girl) #6

@Jason_Anderson I just about to create a separate thread describing this issue when I came across this post. I am facing the exact same issue initially on 5.3.0 but since then I upgraded to 5.4.2 and this issue still remains.

I have tried installing the repository-s3 plugin and have not run into issues with the plugin security policy. It works as expected. Also, I am not running a secured HDFS setup so the github issue shouldn't apply to my setup as well (unless this bug is not isolated to just secure HDFS setups)
Is there anyone looking into this?

@james.baiera If you still need logs, I can provide them privately.


(Jason Anderson) #7

@james.baiera @Pacer_Girl, I compiled a test-case that would reliably fail on my infrastructure. It creates a repository, verifies it, creates a snapshot, then deletes the repository. That typically all works fine. But, if I re-run the test again, it fails on snapshot creation reliably. I hope it helps diagnose the root cause.

(Pacer Girl) #8

@Jason_Anderson Thanks for putting this together, hopefully we get some kind of feedback soon.

(James Baiera) #9

@Jason_Anderson Thanks for the reproduction steps, but I'm having a hard time getting it to reproduce for myself locally on v5.4.3. Are you able to get the issue to reproduce with a locally installed instance instead of your deployment environment? This might help narrow down which factors are causing the problem. Could you also include your HDFS version that you are trying to connect with?

(system) #10

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.