Skip to content
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

Allow to drop privileges at startup #36341

Merged
merged 36 commits into from
May 25, 2022

Conversation

alexey-milovidov
Copy link
Member

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Allow to drop privileges at startup. This simplifies Docker images. Closes #36293.

@@ -63,7 +63,7 @@ RUN arch=${TARGETARCH:-amd64} \
&& chown clickhouse:clickhouse /var/lib/clickhouse \
&& chown root:clickhouse /var/log/clickhouse-server \
&& chmod +x /entrypoint.sh \
&& apk add --no-cache su-exec bash tzdata \
&& apk add --no-cache bash tzdata \
&& cp /usr/share/zoneinfo/UTC /etc/localtime \
Copy link
Member Author

Choose a reason for hiding this comment

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

This looks outdated.

@robot-clickhouse robot-clickhouse added the pr-build Pull request with build/testing/packaging improvement label Apr 16, 2022
chmod 0755 /bin/su-exec && \
rm /su-exec.c && \
apt-get purge -y --auto-remove tcc libc-dev libc-dev-bin libc6-dev linux-libc-dev \
tzdata
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks old, we should work without tzdata and locales.

@alexey-milovidov
Copy link
Member Author

Merging with master after #36337.

@alexey-milovidov
Copy link
Member Author

Waiting for #36361

@alexey-milovidov alexey-milovidov marked this pull request as draft April 18, 2022 04:06
@nikitamikhaylov
Copy link
Member

@alexey-milovidov Keeper images also can be simplified

@nikitamikhaylov nikitamikhaylov self-assigned this Apr 19, 2022
@alexey-milovidov alexey-milovidov marked this pull request as ready for review May 6, 2022 21:28
@alexey-milovidov
Copy link
Member Author

@nikitamikhaylov no review?

@alexey-milovidov
Copy link
Member Author

I will unassign as one month has passed.

@alexey-milovidov
Copy link
Member Author

At least now it works as expected: https://pastila.nl/?001c5a5c/93287c2e9c4f57eafe6a98962306bb52
Let's check what is wrong with the stress tests...

@alexey-milovidov
Copy link
Member Author

Does not work due to

  1. If the effective user ID is changed from 0 to nonzero, then
    all capabilities are cleared from the effective set.

@alexey-milovidov
Copy link
Member Author

Amazing...

@alexey-milovidov alexey-milovidov merged commit f321925 into master May 25, 2022
@alexey-milovidov alexey-milovidov deleted the allow-setuid-inside-clickhouse branch May 25, 2022 22:07
@alexey-milovidov alexey-milovidov self-assigned this May 25, 2022
@excitoon
Copy link
Contributor

excitoon commented Jun 3, 2022

Cool! It would be also awesome to have ping and netstat for more convenient network debugging inside docker images.

@alexey-milovidov
Copy link
Member Author

@excitoon This su tool is added to solve a very specific problem with Docker and Linux.
See the comments in the code.

@pkit
Copy link
Contributor

pkit commented Aug 4, 2022

@alexey-milovidov this PR totally breaks the NFS mounts for metadata, because of root squash.
Mainly because it assumes that root access is uid=0 (while it can be uid=nobody for NFS)
Will try to roll back some of the changes

pkit pushed a commit to pkit/ClickHouse that referenced this pull request Aug 4, 2022
@pkit
Copy link
Contributor

pkit commented Aug 4, 2022

See #39898

zzcclp pushed a commit to zzcclp/ClickHouse that referenced this pull request Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-build Pull request with build/testing/packaging improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault in su-exec on Linux ARM64 Docker image
5 participants