Skip to content

[DOCS] RHEL Security TMP override #77285

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/reference/setup/install/rpm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ endif::[]

include::skip-set-kernel-parameters.asciidoc[]

[[install-rhel-security]]
==== Override Red Hat TMP if Security Compliance
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be something like the following? This feels convoluted.

Suggested change
==== Override Red Hat TMP if Security Compliance
==== Override Red Hat TMP if Security Compliant

Copy link
Contributor

Choose a reason for hiding this comment

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

Compliant is better than Compliance, but "Security Compliant" is still vague. Can we be more specific here and say something like, "Override Red Hat TMP if FIPS mode is enabled"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately it's nothing to do with FIPS mode - these steps are necessary today if the user is using SELinux with a particular config (which we don't test and haven't even fully characterised). Admittedly there will be significant overlap between users of FIPS mode and users of this kind of SELinux config.


If you are applying a security compliance in your RHEL installation
you must change the path of the TMP directory that will use elasticsearch as Java.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
you must change the path of the TMP directory that will use elasticsearch as Java.
you must change the path of the TMP directory that Java and {es} will use.


1. Uncomment `-Djava.io.tmpdir=${ES_TMPDIR}` under `/etc/elasticsearch/jvm.options`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shouldn't be telling users to edit jvm.options, they should be adding extra options files in jvm.options.d.

But then I think this isn't necessary anyway, we already copy ES_TMPDIR to java.io.tmpdir IIRC.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we tell people to add custom options files. If this step is necessary, I'd cross reference the info on setting JVM options (https://www.elastic.co/guide/en/elasticsearch/reference/master/advanced-configuration.html#set-jvm-options). Something like:

In a <<set-jvm-options, custom JVM options>> file, override the -Djava.io.tempdir setting:

-Djava.io.tmpdir=${ES_TMPDIR}

Copy link
Contributor

Choose a reason for hiding this comment

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

I can confirm this is unnecessary: we already have this setting in the default jvm.options file:

## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}

2. Add `ES_TMPDIR=/usr/share/elasticsearch/tmp` under `/etc/sysconfig/elasticsearch`
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd make this the first step, even if you do need to explicitly set the JVM TMP directory to ES_TMPDIR.

Suggested change
2. Add `ES_TMPDIR=/usr/share/elasticsearch/tmp` under `/etc/sysconfig/elasticsearch`
2. Configure a dedicated {es} TMP directory outside of the system TMP directory:
+
[source,shell]
----
ES_TMPDIR=/usr/share/elasticsearch/tmp
---

3. Create the /usr/share/elasticsearch/tmp directory and make sure that the owner and group are elasticsearch and the permissions are `0755`
Copy link
Contributor

@pugnascotia pugnascotia Sep 10, 2021

Choose a reason for hiding this comment

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

Suggested change
3. Create the /usr/share/elasticsearch/tmp directory and make sure that the owner and group are elasticsearch and the permissions are `0755`
3. Create the `/usr/share/elasticsearch/tmp` directory and make sure that the owner and group are `elasticsearch` and the permissions are `0755`.

Copy link
Contributor

Choose a reason for hiding this comment

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

If step 4 is deemed unacceptable, I'd add a note to this step indicating that no users other than the elasticsearch user should have access to this directory.

4. Lastly make sure that `/dev/shm` doesn't have the noexec attribute with command: `mount | grep tmpfs | grep '/dev/shm'`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably unacceptable to many users of locked-down systems. Instead we should set TMPDIR (eventually LIBFFI_TMPDIR to point to a location to which only the elasticsearch user has access.


ifdef::include-xpack[]
[role="xpack"]
[[rpm-enable-indices]]
Expand Down