Commit graph

443 commits

Author SHA1 Message Date
William Brafford
c117c0cf0a
Password-protected Keystore Feature Branch PR (#51123)
* Reload secure settings with password (#43197)

If a password is not set, we assume an empty string to be
compatible with previous behavior.
Only allow the reload to be broadcast to other nodes if TLS is
enabled for the transport layer.

* Add passphrase support to elasticsearch-keystore (#38498)

This change adds support for keystore passphrases to all subcommands
of the elasticsearch-keystore cli tool and adds a subcommand for
changing the passphrase of an existing keystore.
The work to read the passphrase in Elasticsearch when
loading, which will be addressed in a different PR.

Subcommands of elasticsearch-keystore can handle (open and create)
passphrase protected keystores

When reading a keystore, a user is only prompted for a passphrase
only if the keystore is passphrase protected.

When creating a keystore, a user is allowed (default behavior) to create one with an
empty passphrase

Passphrase can be set to be empty when changing/setting it for an
existing keystore

Relates to: #32691
Supersedes: #37472

* Restore behavior for force parameter (#44847)

Turns out that the behavior of `-f` for the add and add-file sub
commands where it would also forcibly create the keystore if it
didn't exist, was by design - although undocumented.
This change restores that behavior auto-creating a keystore that
is not password protected if the force flag is used. The force
OptionSpec is moved to the BaseKeyStoreCommand as we will presumably
want to maintain the same behavior in any other command that takes
a force option.

*  Handle pwd protected keystores in all CLI tools  (#45289)

This change ensures that `elasticsearch-setup-passwords` and
`elasticsearch-saml-metadata` can handle a password protected
elasticsearch.keystore.
For setup passwords the user would be prompted to add the
elasticsearch keystore password upon running the tool. There is no
option to pass the password as a parameter as we assume the user is
present in order to enter the desired passwords for the built-in
users.
For saml-metadata, we prompt for the keystore password at all times
even though we'd only need to read something from the keystore when
there is a signing or encryption configuration.

* Modify docs for setup passwords and saml metadata cli (#45797)

Adds a sentence in the documentation of `elasticsearch-setup-passwords`
and `elasticsearch-saml-metadata` to describe that users would be
prompted for the keystore's password when running these CLI tools,
when the keystore is password protected.

Co-Authored-By: Lisa Cawley <lcawley@elastic.co>

* Elasticsearch keystore passphrase for startup scripts (#44775)

This commit allows a user to provide a keystore password on Elasticsearch
startup, but only prompts when the keystore exists and is encrypted.

The entrypoint in Java code is standard input. When the Bootstrap class is
checking for secure keystore settings, it checks whether or not the keystore
is encrypted. If so, we read one line from standard input and use this as the
password. For simplicity's sake, we allow a maximum passphrase length of 128
characters. (This is an arbitrary limit and could be increased or eliminated.
It is also enforced in the keystore tools, so that a user can't create a
password that's too long to enter at startup.)

In order to provide a password on standard input, we have to account for four
different ways of starting Elasticsearch: the bash startup script, the Windows
batch startup script, systemd startup, and docker startup. We use wrapper
scripts to reduce systemd and docker to the bash case: in both cases, a
wrapper script can read a passphrase from the filesystem and pass it to the
bash script.

In order to simplify testing the need for a passphrase, I have added a
has-passwd command to the keystore tool. This command can run silently, and
exit with status 0 when the keystore has a password. It exits with status 1 if
the keystore doesn't exist or exists and is unencrypted.

A good deal of the code-change in this commit has to do with refactoring
packaging tests to cleanly use the same tests for both the "archive" and the
"package" cases. This required not only moving tests around, but also adding
some convenience methods for an abstraction layer over distribution-specific
commands.

* Adjust docs for password protected keystore (#45054)

This commit adds relevant parts in the elasticsearch-keystore
sub-commands reference docs and in the reload secure settings API
doc.

* Fix failing Keystore Passphrase test for feature branch (#50154)

One problem with the passphrase-from-file tests, as written, is that
they would leave a SystemD environment variable set when they failed,
and this setting would cause elasticsearch startup to fail for other
tests as well. By using a try-finally, I hope that these tests will fail
more gracefully.

It appears that our Fedora and Ubuntu environments may be configured to
store journald information under /var rather than under /run, so that it
will persist between boots. Our destructive tests that read from the
journal need to account for this in order to avoid trying to limit the
output we check in tests.

* Run keystore management tests on docker distros (#50610)

* Add Docker handling to PackagingTestCase

Keystore tests need to be able to run in the Docker case. We can do this
by using a DockerShell instead of a plain Shell when Docker is running.

* Improve ES startup check for docker

Previously we were checking truncated output for the packaged JDK as
an indication that Elasticsearch had started. With new preliminary
password checks, we might get a false positive from ES keystore
commands, so we have to check specifically that the Elasticsearch
class from the Bootstrap package is what's running.

* Test password-protected keystore with Docker (#50803)

This commit adds two tests for the case where we mount a
password-protected keystore into a Docker container and provide a
password via a Docker environment variable.

We also fix a logging bug where we were logging the identifier for an
array of strings rather than the contents of that array.

* Add documentation for keystore startup prompting (#50821)

When a keystore is password-protected, Elasticsearch will prompt at
startup. This commit adds documentation for this prompt for the archive,
systemd, and Docker cases.

Co-authored-by: Lisa Cawley <lcawley@elastic.co>

* Warn when unable to upgrade keystore on debian (#51011)

For Red Hat RPM upgrades, we warn if we can't upgrade the keystore. This
commit brings the same logic to the code for Debian packages. See the
posttrans file for gets executed for RPMs.

* Restore handling of string input

Adds tests that were mistakenly removed. One of these tests proved
we were not handling the the stdin (-x) option correctly when no
input was added. This commit restores the original approach of
reading stdin one char at a time until there is no more (-1, \r, \n)
instead of using readline() that might return null

* Apply spotless reformatting

* Use '--since' flag to get recent journal messages

When we get Elasticsearch logs from journald, we want to fetch only log
messages from the last run. There are two reasons for this. First, if
there are many logs, we might get a string that's too large for our
utility methods. Second, when we're looking for a specific message or
error, we almost certainly want to look only at messages from the last
execution.

Previously, we've been trying to do this by clearing out the physical
files under the journald process. But there seems to be some contention
over these directories: if journald writes a log file in between when
our deletion command deletes the file and when it deletes the log
directory, the deletion will fail.

It seems to me that we might be able to use journald's "--since" flag to
retrieve only log messages from the last run, and that this might be
less likely to fail due to race conditions in file deletion.

Unfortunately, it looks as if the "--since" flag has a granularity of
one-second. I've added a two-second sleep to make sure that there's a
sufficient gap between the test that will read from journald and the
test before it.

* Use new journald wrapper pattern

* Update version added in secure settings request

Co-authored-by: Lisa Cawley <lcawley@elastic.co>
Co-authored-by: Ioannis Kakavas <ikakavas@protonmail.com>
2020-01-27 19:51:39 -05:00
Rory Hunter
8a6d68b173
Make the Docker build more re-usable in Cloud (#50277)
Closes #49926 and #46166. Rework the Docker image so that it comes with a tiny
init system, to ensure ML processes are correctly cleaned up, and to run ES
as a regular user instead of root.

Also:

   * Ensure no files in the image have the setuid/setgid flag
   * Also improve dependency tracking in the build
   * Remove TAKE_FILE_OWNERSHIP option and its documentation
2020-01-23 10:58:40 +00:00
Nhat Nguyen
09b46c8646
Goodbye and thank you synced flush! (#50882)
Synced flush was a brilliant idea. It supports instant recoveries with a 
quite small implementation. However, with the presence of sequence
numbers and retention leases, it is no longer needed. This change
removes it from 8.0.

Relates #5077
2020-01-16 09:43:07 -05:00
Lisa Cawley
f4ff5d866d
[DOCS] Adds elasticsearch-keystore command reference (#50872) 2020-01-13 13:02:06 -08:00
Evgenia Badyanova
bb736f7ecd
[DOCS] Update reference documentation that mentions CMS (#50542)
Relates to https://github.com/elastic/elasticsearch/issues/46973
2020-01-07 17:19:15 -05:00
Xiang Dai
432bd0e92c Fix docs typos (#50365)
Fixes a few typos in the docs.

Signed-off-by: Xiang Dai 764524258@qq.com
2019-12-23 10:35:14 -05:00
Lisa Cawley
362ce41eaf
[DOCS] Updates ML links (#50387) 2019-12-19 14:47:28 -08:00
Kevin Woblick
77d94caa70 [DOCS] Add warning about Docker port exposure (#50169)
Docker bypasses the Uncomplicated Firewall (UFW) on Linux by editing the `iptables` config directly, which leads to the exposure of port 9200, even if you blocked it via UFW.

This adds a warning along with work-arounds to the docs.

Signed-off-by: Kovah <mail@kovah.de>
2019-12-18 09:03:44 -05:00
Ryan Ernst
59a571edd5
Fix incorrect use of multiline NOTE in rpm docs (#49962)
This was a copy/paste error from #49893. This commit converts the NOTE
to use inline style instead of one needing closing linebreak.
2019-12-06 17:43:12 -08:00
Ryan Ernst
16a7a04664
Disable repo configuration for rpm based systems (#49893)
This commit changes the recommended repository file for rpm based
systems to be disabled by default. This is a safer practice so upgrades
of the system do no accidentally upgrade elasticsearch itself.

closes #30660
2019-12-06 15:54:30 -08:00
Ryan Ernst
6c54b38a1b
Remove legacy referene to file scripts (#49339)
This commit removes outdated documentation about a path setting for file
scripts which no longer exist.

closes #45827
2019-11-27 10:42:15 -08:00
Ryan Ernst
0042500026
Add JAVA_HOME env override location to docs (#49565)
This commit clarifies how to override JAVA_HOME from the bundled jdk for
deb and rpm installs, which each have their own file that is sourced
upon service startup.

closes #49068
2019-11-27 10:39:54 -08:00
Xiang Dai
7a7d15ba0b [DOCS] Clarify how to update max memory size in bootstrap checks (#48975) 2019-11-27 09:39:34 -05:00
glerb
815ea928b2 [Docs] Correct typo in log file name (#49620) 2019-11-27 14:38:19 +01:00
Dimitrios Liappis
1c9efba809
Clarify gid used by docker image process and bind-mount method
Fix reference about the uid:gid that Elasticsearch runs as inside
the Docker container and add a packaging test to ensure that bind
mounting a data dir with a random uid and gid:0 works as
expected.

Relates #49529
Closes #47929
2019-11-27 10:36:30 +02:00
István Zoltán Szabó
ec9d8cf2c1
[DOCS] Adds test clause to the code snippets in the cluster restart page (#49023) 2019-11-13 10:21:43 +01:00
Rory Hunter
2a4e101a97
Support _FILE suffixed env vars in Docker entrypoint (#47573)
Closes #43603. Allow environment variables to be passed to ES in a Docker
container via a file, by setting an environment variable with the `_FILE`
suffix that points to the file with the intended value of the env var.
2019-11-12 14:20:12 +00:00
István Zoltán Szabó
1508766a38
[DOCS] Creates a cluster restart documentation page (#48583)
Co-Authored-By: James Rodewig <james.rodewig@elastic.co>
2019-11-12 14:49:11 +01:00
Arne Welzel
552cc2ea59 [DOCS] Remove extra "when" (#48926) 2019-11-11 10:11:38 +01:00
debadair
d92f362df0
[DOCS] Fix cross-doc link. (#48783)
* [DOCS] Fix cross-doc link.

* Fixed xref
2019-10-31 18:57:02 -07:00
debadair
2f9f5765e3
[DOCS] Edited Docker install & tweaked Docker compose file. (#47715)
* [DOCS] Edited Docker install & tweaked Docker compose file.

* Synced with Docker GS in SO

* Incorporated review comments
2019-10-31 18:04:07 -07:00
harsha-s
f9227da5b9 Update docker.asciidoc (#47651)
Update `docker-compose.yml` in the documentation in order to increase the max
file descriptor limit.
2019-10-19 15:41:15 +01:00
David Turner
9e30a57ca5
More bootstrap docs tweaks (#47809)
Clarifies not to set `cluster.initial_master_nodes` on nodes that are joining
an existing cluster.

Co-Authored-By: James Rodewig <james.rodewig@elastic.co>
2019-10-10 10:53:27 +02:00
Przemyslaw Gomulka
78e7a2e728
Update deprecation logging doc with logger configuration (#47649)
Explicitly adds a configuration snippet to change logging level
2019-10-07 15:13:38 +02:00
Lisa Cawley
4e4990c6a0
[DOCS] Cleans up links to security content (#47610) 2019-10-04 16:10:26 -07:00
AndyHunt66
ac543d5386 [DOCS] Remove duplicated half-sentence from secure settings docs (#47498) 2019-10-03 08:40:31 -04:00
Lisa Cawley
91992a805f
[DOCS] Moves Watcher content into Elasticsearch book (#47147)
Co-Authored-By: James Rodewig <james.rodewig@elastic.co>
2019-09-27 16:05:44 -07:00
James Rodewig
e43be90e6c
[DOCS] [5 of 5] Change // TESTRESPONSE comments to [source,console-results] (#46449) 2019-09-06 14:05:36 -04:00
Jason Tedor
1936f64f3b
Add docs on upgrading the keystore (#46331)
This commit adds a note to the docs regarding upgrading the keystore.
2019-09-05 14:40:38 -04:00
Lisa Cawley
06c4c5cca3
[DOCS] Identify reloadable Azure repository plugin settings (#46358) 2019-09-05 10:44:21 -07:00
Lisa Cawley
7e112ca0f2
[DOCS] Identify reloadable GCS repository plugin settings (#46352) 2019-09-04 16:24:55 -07:00
Lisa Cawley
f196e96bea
[DOCS] Identify reloadable S3 repository plugin settings (#46349) 2019-09-04 14:43:58 -07:00
Lisa Cawley
860aff0f37
[DOCS] Identify reloadable EC2 Discovery Plugin settings (#46102) 2019-09-04 10:12:03 -07:00
James Rodewig
f5827ba0ae
[DOCS] Replace "// CONSOLE" comments with [source,console] (#46159) 2019-09-04 12:51:02 -04:00
Przemyslaw Gomulka
97bd8de1d2
Improve documentation for X-Opaque-ID (#46167)
this field can be present in search slow logs and deprecation logs. The
docs describes how to enable this functionality and what expect in logs.
closes #44851
2019-09-04 15:48:37 +02:00
Ryan Ernst
80f2a4066c
Add package docs for bundled jdk location (#46153)
This commit expands the documented directory layout of the rpm and deb
packages to include the bundled jdk.

closes #45150
2019-08-29 14:13:35 -07:00
Lisa Cawley
538ce6d1e3
[DOCS] Remove xpack terminology from installation pages (#44973) 2019-07-30 14:59:20 -07:00
David Turner
b73f4e934c
Avoid IP addresses for bootstrapping in setup docs (#43802)
Removes the suggestion to use IP addresses for `cluster.initial_master_nodes`
in the "important settings" discovery docs, leaving only the suggestion to use
node names.

Relates #41179, #41569
2019-07-01 12:39:12 +01:00
Ryan Ernst
f879e84e5a
Clarify unsupported secure settings behavior (#43454)
This commit tweaks the docs for secure settings to ensure the user is
aware adding non secure settings to the keystore will result in
elasticsearch not starting.

fixes #43328

Co-Authored-By: James Rodewig <james.rodewig@elastic.co>
2019-06-20 14:27:07 -07:00
debadair
19c253ccc9
[DOCS] Fixed path to install directory. (#43443) 2019-06-20 10:33:54 -07:00
debadair
f3ed2bd693 [DOCS] Add brew install instructions. Closes #42914 (#42915) 2019-06-20 07:49:50 -07:00
Dimitrios Liappis
481b359da3
Clarify heap setting in Docker docs (#42754)
Add note in the Docker docs that even when container memory is limited,
we still require specifying -Xms/-Xmx using one of the supported
methods.
2019-06-03 15:12:29 +03:00
Travis Steel
50ed840e52 Fixed typo in docker.asciidoc (#42455) 2019-05-27 11:56:51 +02:00
David Roberts
37be0a164f [DOCS] Adding ML-specific prerequisites to setup docs (#42529) 2019-05-24 10:44:51 -07:00
Lisa Cawley
ffa5461b7f
[DOCS] Removes X-Pack Java client configuration (#42480) 2019-05-24 09:31:24 -07:00
Lisa Cawley
dfc3b8e416
[DOCS] Removes X-Pack setup (#42481) 2019-05-24 09:00:38 -07:00
Lisa Cawley
6e307d9fee
[DOCS] Removes inclusion of java.asciidoc (#42459) 2019-05-23 14:05:38 -07:00
Lisa Cawley
9002be4e61
[DOCS] Updates TLS configuration info (#41983) 2019-05-20 09:06:42 -04:00
David Turner
ed3230b3eb
Minor cluster coordination docs fixes (#42111)
Fixes a typo and a badly-formatted warning.
2019-05-15 09:26:04 -04:00
David Turner
e56d557c75
Recognise direct buffers in heap size docs (#42070)
This commit slightly reworks the recommendations in the docs about setting the
heap size:

* the "rules of thumb" are actually instructions that should be followed

* the reason for setting `Xmx` to 50% of the heap size is more subtle than just
  leaving space for the filesystem cache

* it is normal to see Elasticsearch using more memory than `Xmx`

* replace `cutoff` and `limit` with `threshold` since all three terms are used
  interchangeably

* since we recommend setting `Xmx` equal to `Xms`, avoid talking about setting
  `Xmx` in isolation

Relates #41954
2019-05-10 13:55:27 +01:00