Skip to content

Commit b272689

Browse files
Remove spurious SGID (#9447) (#10313)
Setting the SGID bit on directories is maybe something some users will want to use, but setting it by default for all users does not really make sense and when packaging OpenSearch, we need to remove this customization when building packges. This was added to ElasticSearch to make it possible to manage the keystore as root while the service runs as an unprivileged user. Without the SGID trick, the generated keystore was owned by root and ElasticSearch could not access it. It is preferable to manage the keystore with non-root privileges, and this hack is not required in this case. Stick to the default permissions and remove this personalization. (cherry picked from commit 9d0db5e) Signed-off-by: Romain Tartière <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 967f09d commit b272689

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4444
### Deprecated
4545

4646
### Removed
47+
- Remove spurious SGID bit on directories ([#9447](https://github.com/opensearch-project/OpenSearch/pull/9447))
4748

4849
### Fixed
4950
- Fix ignore_missing parameter has no effect when using template snippet in rename ingest processor ([#9725](https://github.com/opensearch-project/OpenSearch/pull/9725))

distribution/packages/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
213213
configurationFile '/etc/opensearch/jvm.options'
214214
configurationFile '/etc/opensearch/log4j2.properties'
215215
from("${packagingFiles}") {
216-
dirMode 02750
216+
dirMode 0750
217217
into('/etc')
218218
permissionGroup 'opensearch'
219219
includeEmptyDirs true
@@ -223,7 +223,7 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
223223
}
224224
from("${packagingFiles}/etc/opensearch") {
225225
into('/etc/opensearch')
226-
dirMode 02750
226+
dirMode 0750
227227
fileMode 0660
228228
permissionGroup 'opensearch'
229229
includeEmptyDirs true
@@ -281,8 +281,8 @@ Closure commonPackageConfig(String type, boolean jdk, String architecture) {
281281
dirMode mode
282282
}
283283
}
284-
copyEmptyDir('/var/log/opensearch', 'opensearch', 'opensearch', 02750)
285-
copyEmptyDir('/var/lib/opensearch', 'opensearch', 'opensearch', 02750)
284+
copyEmptyDir('/var/log/opensearch', 'opensearch', 'opensearch', 0750)
285+
copyEmptyDir('/var/lib/opensearch', 'opensearch', 'opensearch', 0750)
286286
copyEmptyDir('/usr/share/opensearch/plugins', 'root', 'root', 0755)
287287

288288
into '/usr/share/opensearch'

distribution/packages/src/deb/lintian/opensearch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ missing-dep-on-jarwrapper
1515

1616
# we prefer to not make our config and log files world readable
1717
non-standard-file-perm etc/default/opensearch 0660 != 0644
18-
non-standard-dir-perm etc/opensearch/ 2750 != 0755
19-
non-standard-dir-perm etc/opensearch/jvm.options.d/ 2750 != 0755
18+
non-standard-dir-perm etc/opensearch/ 0750 != 0755
19+
non-standard-dir-perm etc/opensearch/jvm.options.d/ 0750 != 0755
2020
non-standard-file-perm etc/opensearch/*
21-
non-standard-dir-perm var/lib/opensearch/ 2750 != 0755
22-
non-standard-dir-perm var/log/opensearch/ 2750 != 0755
21+
non-standard-dir-perm var/lib/opensearch/ 0750 != 0755
22+
non-standard-dir-perm var/log/opensearch/ 0750 != 0755
2323
executable-is-not-world-readable etc/init.d/opensearch 0750
2424
non-standard-file-permissions-for-etc-init.d-script etc/init.d/opensearch 0750 != 0755
2525

qa/os/src/test/java/org/opensearch/packaging/util/Packages.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ private static void verifyInstallation(Installation opensearch, Distribution dis
194194

195195
// we shell out here because java's posix file permission view doesn't support special modes
196196
assertThat(opensearch.config, file(Directory, "root", "opensearch", p750));
197-
assertThat(sh.run("find \"" + opensearch.config + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("2750"));
197+
assertThat(sh.run("find \"" + opensearch.config + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("750"));
198198

199199
final Path jvmOptionsDirectory = opensearch.config.resolve("jvm.options.d");
200200
assertThat(jvmOptionsDirectory, file(Directory, "root", "opensearch", p750));
201-
assertThat(sh.run("find \"" + jvmOptionsDirectory + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("2750"));
201+
assertThat(sh.run("find \"" + jvmOptionsDirectory + "\" -maxdepth 0 -printf \"%m\"").stdout, containsString("750"));
202202

203203
Stream.of("opensearch.keystore", "opensearch.yml", "jvm.options", "log4j2.properties")
204204
.forEach(configFile -> assertThat(opensearch.config(configFile), file(File, "root", "opensearch", p660)));

0 commit comments

Comments
 (0)