diff --git a/scripts/pkg/build_templates/opensearch-dashboards/deb/debian/postinst b/scripts/pkg/build_templates/opensearch-dashboards/deb/debian/postinst index 6f3034cbd4..e2ee3f3fa4 100755 --- a/scripts/pkg/build_templates/opensearch-dashboards/deb/debian/postinst +++ b/scripts/pkg/build_templates/opensearch-dashboards/deb/debian/postinst @@ -40,11 +40,15 @@ echo " In a future release of OpenSearch Dashboards, we plan to change the permi echo " If you are configuring tools that require read access to the OpenSearch Dashboards configuration files, we recommend you add the user that runs these tools to the 'opensearch-dashboards' group" echo " For more information, see https://github.com/opensearch-project/opensearch-build/pull/4043" -# Set owner -chown -R opensearch-dashboards.opensearch-dashboards ${product_dir} -chown -R opensearch-dashboards.opensearch-dashboards ${config_dir} -chown -R opensearch-dashboards.opensearch-dashboards ${log_dir} +# Set ownership and permissions +chmod -R u=rwX,g=rX,o= ${config_dir} + +chown -R opensearch-dashboards.adm ${log_dir} +chmod 750 ${log_dir} + chown -R opensearch-dashboards.opensearch-dashboards ${data_dir} +chmod 750 ${data_dir} + chown -R opensearch-dashboards.opensearch-dashboards ${pid_dir} exit 0 diff --git a/scripts/pkg/build_templates/opensearch-dashboards/deb/debmake_opensearch_dashboards_install.sh b/scripts/pkg/build_templates/opensearch-dashboards/deb/debmake_opensearch_dashboards_install.sh index 1c4f593a53..e41763e071 100755 --- a/scripts/pkg/build_templates/opensearch-dashboards/deb/debmake_opensearch_dashboards_install.sh +++ b/scripts/pkg/build_templates/opensearch-dashboards/deb/debmake_opensearch_dashboards_install.sh @@ -42,6 +42,7 @@ ln -s ${data_dir} ${buildroot}${product_dir}/data ln -s ${log_dir} ${buildroot}${product_dir}/logs # Change Permissions -chmod -Rf a+rX,u+w,g-w,o-w ${buildroot}/* +chmod -Rf g-s ${buildroot}/* +chmod -Rf u=rwX,g=rX,o=rX ${buildroot}/* exit 0 diff --git a/scripts/pkg/build_templates/opensearch-dashboards/rpm/opensearch-dashboards.rpm.spec b/scripts/pkg/build_templates/opensearch-dashboards/rpm/opensearch-dashboards.rpm.spec index 6e61931e0d..e7752cb4b5 100644 --- a/scripts/pkg/build_templates/opensearch-dashboards/rpm/opensearch-dashboards.rpm.spec +++ b/scripts/pkg/build_templates/opensearch-dashboards/rpm/opensearch-dashboards.rpm.spec @@ -63,7 +63,8 @@ chmod 0755 %{buildroot}%{product_dir}/bin/* ln -s %{data_dir} %{buildroot}%{product_dir}/data ln -s %{log_dir} %{buildroot}%{product_dir}/logs # Change Permissions -chmod -Rf a+rX,u+w,g-w,o-w %{buildroot}/* +chmod -Rf g-s %{buildroot}/* +chmod -Rf u=rwX,g=rX,o= %{buildroot}/etc exit 0 %pre @@ -112,7 +113,7 @@ exit 0 %files # Permissions -%defattr(-, %{name}, %{name}) +%defattr(-, root, root) # Root dirs/docs/licenses %dir %{product_dir} @@ -141,9 +142,9 @@ exit 0 %{product_dir}/node_modules %{product_dir}/plugins %{product_dir}/src -%{log_dir} -%{pid_dir} -%dir %{data_dir} +%attr(750, %{name}, %{name}) %{log_dir} +%attr(750, %{name}, %{name}) %{pid_dir} +%dir %attr(750, %{name}, %{name}) %{data_dir} # Symlinks %{product_dir}/data