Defaut config permission too relaxed in deb and rpm packages #3815
Description
After installing the Debian package, all users can read all configuration files:
$ ls -dl /etc/opensearch
drwxr-xr-x 9 opensearch opensearch 4096 25 juil. 15:57 /etc/opensearch/
$ ls -l /etc/opensearch/opensearch.yml
-rw-r--r-- 1 opensearch opensearch 6503 25 juil. 15:57 /etc/opensearch/opensearch.yml
$ ls -dl /etc/opensearch/opensearch-security
drwxr-xr-x 2 opensearch opensearch 4096 25 juil. 15:57 /etc/opensearch/opensearch-security/
$ ls -l /etc/opensearch/opensearch-security
total 76
-rw-r--r-- 1 opensearch opensearch 50 14 oct. 2022 action_groups.yml
-rw-r--r-- 1 opensearch opensearch 1973 14 oct. 2022 allowlist.yml
-rw-r--r-- 1 opensearch opensearch 2541 14 oct. 2022 audit.yml
-rw-r--r-- 1 opensearch opensearch 10063 14 oct. 2022 config.yml
-rw-r--r-- 1 opensearch opensearch 1689 14 oct. 2022 internal_users.yml
-rw-r--r-- 1 opensearch opensearch 154 14 oct. 2022 nodes_dn.yml
-rw-r--r-- 1 opensearch opensearch 12381 14 oct. 2022 opensearch.yml.example
-rw-r--r-- 1 opensearch opensearch 844 14 oct. 2022 roles_mapping.yml
-rw-r--r-- 1 opensearch opensearch 12649 14 oct. 2022 roles.yml
-rw-r--r-- 1 opensearch opensearch 170 14 oct. 2022 tenants.yml
-rw-r--r-- 1 opensearch opensearch 1973 14 oct. 2022 whitelist.yml
Some of these files contain or can contain sensitive data, for example:
internal_users.yml
contain hashed password;config.yml
can contain clear-text credential for authentication against an LDAP directory.
Upon initial investigation, this is the result of this chmod
on the whole tree of files installed by the package:
It looks like the tarball of OpenSearch has different and more restrictive permissions by default
Filename | Debian package permission | Tarball permission |
---|---|---|
config (read /etc/opensearch with the Debian package) |
755 | 755 |
config/opensearch.yml |
644 | 640 |
config/opensearch-security |
755 | 750 |
config/opensearch-security/*.yml |
644 | 640 |
I am opening this issue in order to discuss this packaging issue and fix it. IMHO, the tarball default permissions are better than the Debian ones, but there is still room for improvement such as changing files ownership to root:opensearch in order to prevent a compromised service from rewriting it's configuration (and yes, currently all the files installed by the package are owned by the opensearch user so he can overwrite all the application code, but let's tackle this in another PR).
What do you think?
Metadata
Assignees
Type
Projects
Status
Done