Skip to content

Commit

Permalink
Fix files ownership and permissions in OpenSearch-Dashboards packages (
Browse files Browse the repository at this point in the history
…opensearch-project#3952)

Signed-off-by: Romain Tartière <[email protected]>
Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
smortex authored and peterzhuamazon committed Mar 14, 2024
1 parent 18b7abd commit 4f3baff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -112,7 +113,7 @@ exit 0

%files
# Permissions
%defattr(-, %{name}, %{name})
%defattr(-, root, root)

# Root dirs/docs/licenses
%dir %{product_dir}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4f3baff

Please sign in to comment.