38 Commits

Author SHA1 Message Date
Robert Muir
06482e8424 Use Releasables.close here 2015-05-04 14:55:10 -04:00
Robert Muir
2be1a09c77 add a null check for safety 2015-05-04 14:21:11 -04:00
Robert Muir
a048f8944b Remove exitVM permission 2015-05-04 14:06:32 -04:00
Robert Muir
54d361259e Merge pull request #10962 from rmuir/lockdown2
Remove JNI permissions, improve JNI testing.
2015-05-04 10:22:46 -07:00
Robert Muir
b8efa8ea21 Remove JNI permissions, improve JNI testing. 2015-05-04 12:30:03 -04:00
Robert Muir
5a701c1f9f remove shutdownHooks permission 2015-05-04 10:18:09 -04:00
Robert Muir
f599c237bd Security manager cleanups
1. initialize SM after things like mlockall. Their tests currently
   don't run with securitymanager enabled, and its simpler to just
   run mlockall etc first.
2. remove redundant test permissions (junit4.childvm.cwd/temp). This
   is alreay added as java.io.tmpdir.
3. improve tests to load the generated policy with some various
   settings and assert things about the permissions on configured
   directories.
4. refactor logic to make it easier to fine-grain the permissions later.
   for example we currently allow write access to conf/. In the future
   I think we can improve testing so we are able to make improvements here.
2015-04-27 20:29:57 -04:00
Robert Muir
a3d03fdeb8 style changes to Bootstrap 2015-04-24 10:09:30 -04:00
Robert Muir
fca05edbd4 add constant only used once to make it harder to read the code 2015-04-24 09:51:01 -04:00
Robert Muir
500c956b45 Remove policy config file, its a resource.
Remove exposed boolean to turn off security.
Add unit test
2015-04-23 22:02:57 -04:00
Robert Muir
b2850bff47 remove logging statements for another bikeshed 2015-04-23 21:18:56 -04:00
Robert Muir
0865d220f4 Remove crazy permissions for filestores, ssds, now that
this logic has been refactored.

Log a warning when security is disabled.
2015-04-23 15:04:58 -04:00
Robert Muir
270cb9f349 enable securitymanager 2015-04-22 03:04:50 -04:00
Robert Muir
6ac4d6daef contain filesystem access 2015-04-15 18:23:30 -04:00
Shay Banon
e2a05bb43f Cleanup JVM info and stats
Remove reflection since its not needed with Java 7, remove lastGcInfo since its not used, and move to only provide getters
closes #10553
2015-04-13 15:24:14 -07:00
Simon Willnauer
d738b3d1e2 [BUILD] Use SuppressFrobidden annotation instead of class level excludes
Forbidden APIs 1.8 allows excludes based on annotations which can now be on methods etc. for more find grained control.

Closes #10560
2015-04-13 10:08:50 +02:00
Robert Muir
6da99b3ef0 [Bootstrap] Throw exception if the JVM will corrupt data.
Detect the worst-offenders, all IBM versions and several known hotspot
versions that can cause index corruption, and fail on startup.

Provide/detect compiler workarounds when they exist, but warn about
performance degradation.

In all cases the check can be bypassed completely with a safety
switch via undocumented system property (es.bypass.vm.check=true)

Closes #7580
2015-03-21 02:47:44 -04:00
Simon Willnauer
ce53e20351 [CORE] Remove Restart API and remove Node#stop()
The restart API seems pretty esoteric and is entirely untested.
This commit removes it without a replacement.

Closes #9841
2015-02-27 13:58:23 +01:00
tlrx
a4133ec4a3 Shutdown: Add support for Ctrl-Close event on Windows platforms to gracefully shutdown node
This commit adds the support for the Ctrl-Close event on Windows using native system calls. This way, it is possible to catch the Ctrl-Close event sent by a 'taskill /pid' command (or when the user closes the console window where elasticsearch.bat was started) and gracefully close the node. Before this commit, the node was simply killed on taskkill/window closing.
2014-12-22 09:36:29 +01:00
Simon Willnauer
f4052fd936 Factor out PID file creation and add tests
This commit factors out the PID file creation from bootstrap and adds
tests for error conditions etc. We also can't rely on DELETE_ON_CLOSE
since it might not even write the file depending on the OS and JVM implementation.
This impl uses a shutdown hook to best-effort remove the pid file if it was written.

Closes #8771
2014-12-04 11:12:16 +01:00
Simon Willnauer
a6510f9245 Add File.java to forbidden APIs
This commit cuts over all of core (not quite all tests) to java.nio.Path
It also adds the file class to the core forbidden APIs to prevent its usage.

This commit also resolves #8254 since we now consistently useing the NIO Path
API. The Changes in this commit allow for more information if IO operations fail
since the NIO API throws exceptions instead of boolean return values. The build-in
methods used in this commit are also more resillient to encodeing errors like
unmappable characters and throw exceptions if those chars are present in a file.

Closes #8254
Closes #8666
2014-12-02 21:29:26 +01:00
Mark J Greene
d5e813929c Boostrap: Log startup exception to console if needed and to file as error
Closes #6581
2014-10-20 20:48:37 +02:00
Simon Willnauer
c561900512 Use UTF-8 as string encoding 2014-05-16 20:54:01 +02:00
Simon Willnauer
8dd5dd409e Remove FileSystemUtils#maxOpenFiles
This method basically forcefully creates as many files as possible
to find out the process limit in a brute-force manner. The number of
possible probles with this approach would exceed the number of lines
left on this commit message.

This commit uses a JMX based alternative to print the process limit.
2014-04-15 13:22:51 +02:00
Timo Rantalaiho
3ae02b0b60 Show stacktrace of startup exception
Whether or not the stacktrace is displayed is controlled by bootstrap
log level setting, so that bootstrap: DEBUG displays the stack trace on
output, like it does on log

Closes #5102
2014-04-04 17:15:41 +02:00
Alexander Reelsen
53dab85fa2 Fix logging on immediate exit on start
If elasticsearch was started in the foreground an immediate exit on startup
led to logging in the logfile, where as when starting in the background,
an immediate exit logged to stdout.

Closes #4805
2014-01-20 15:31:54 +01:00
Simon Willnauer
10ec2e948a Fix ASL Header in source files to reflect s/ElasticSearch/Elasticsearch
This commit also removes the license to Shay Banon in favor of soley
Elasticsearch. Thanks Shay for this awesome product you took it far!

Closes #4636
2014-01-07 11:22:01 +01:00
Andrew Raines
6c9542d967 Fix misspellings. 2013-09-11 13:49:33 -05:00
Alexander Reelsen
9c7a87f118 Overwriting pidfile on startup
The current implementation does not overwrite, but only prepend the new PID into the pidfile.
So if the process is 4 digits long, but the file is already there with a 5 digit number, the file will contain 5 digits after the write.

Note: If the pidfile still exists this usually means, there either is already an instance running using this pidfile or the process has not finished correctly.

Closes #3425
2013-08-05 11:28:37 +02:00
Simon Willnauer
31f0aca65d Integrate forbiddenAPI checks into Maven build.
This commit integrates the forbiddenAPI checks that checks
Java byte code against a list of "forbidden" API signatures.
The commit also contains the fixes of the current source code
that didn't pass the default API checks.

See https://code.google.com/p/forbidden-apis/ for details.

Closes #3059
2013-05-19 23:25:44 +02:00
Shay Banon
e26a56e025 add to the keep alive thread name the version number, so it will be simpler to know from stack traces the es version 2012-08-02 10:50:28 +03:00
Shay Banon
6fb836c25e better thread naming 2012-06-23 18:35:42 +02:00
Shay Banon
b0e0dd81eb don't write \n after teh pid in the pid file 2012-02-27 10:58:49 +02:00
Shay Banon
0ff84d222f improve class loader to use the class loader set in the settings constructing the node 2012-02-12 23:55:16 +02:00
Shay Banon
91b60f1d2f Generate pid file even when running in foreground mode, closes #1553. 2011-12-21 05:28:28 +02:00
Shay Banon
367a608707 remove jline from distribution to simplify it (no longer painting log levels though...) 2011-12-16 15:36:22 +02:00
Shay Banon
6a71eab51f finalize structure, tests pass 2011-12-06 02:43:17 +02:00
Shay Banon
a8fd2d48b8 first cleanup phase, move to single src 2011-12-06 00:59:23 +02:00