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

Makefile: Add implicit SELinux labels when using podman #1598

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

cmuellner
Copy link
Contributor

Podman is a Docker replacement, which is developed by RedHat and available on related Linux distributions (e.g. RHEL or Fedora). Podman differs from Docker in several security-related aspects. One of them is, that Podman requires poper SELinux labels on volume content mounted into a container. This difference to Docker results in the following error when building the specification:

Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
/var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:238:in `stat': Permission denied @ rb_file_s_stat - src/riscv-privileged.adoc (Errno::EACCES)
	from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:238:in `block in parse!'
	from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:236:in `each'
	from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:236:in `parse!'
	from /var/lib/gems/3.0.0/gems/asciidoctor-pdf-2.3.18/bin/asciidoctor-pdf:40:in `<top (required)>'
	from /usr/local/bin/asciidoctor-pdf:25:in `load'
	from /usr/local/bin/asciidoctor-pdf:25:in `<main>'
make[2]: *** [Makefile:92: build/riscv-privileged.pdf] Error 1

To address this, podman-run(1) recommends using the :z suffix to the volume mount. This patch does so if the docker command has been identified (reliably) to be emulated by Podman.

Tested on Fedora 40.

Podman is a Docker replacement, which is developed by RedHat and available
on related Linux distributions (e.g. RHEL or Fedora).  Podman differs from
Docker in several security-related aspects.  One of them is, that Podman
requires poper SELinux labels on volume content mounted into a container.
This difference to Docker results in the following error when building
the specification:

  Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
  /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:238:in `stat': Permission denied @ rb_file_s_stat - src/riscv-privileged.adoc (Errno::EACCES)
	from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:238:in `block in parse!'
	from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:236:in `each'
	from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:236:in `parse!'
	from /var/lib/gems/3.0.0/gems/asciidoctor-pdf-2.3.18/bin/asciidoctor-pdf:40:in `<top (required)>'
	from /usr/local/bin/asciidoctor-pdf:25:in `load'
	from /usr/local/bin/asciidoctor-pdf:25:in `<main>'
  make[2]: *** [Makefile:92: build/riscv-privileged.pdf] Error 1

To address this, podman-run(1) recommends using the ':z' suffix to the
volume mount.  This patch does so, if the docker command has been
identified (reliably) to be emulated by Podman.

Tested on Fedora 40.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
@aswaterman aswaterman self-requested a review August 14, 2024 11:20
@aswaterman
Copy link
Member

It's a bug that podman pretends to be docker when it isn't. But the patch is harmless, so we'll run with it.

@aswaterman aswaterman enabled auto-merge (squash) August 14, 2024 11:27
@aswaterman aswaterman merged commit 98a9223 into riscv:main Aug 14, 2024
2 checks passed
cmuellner added a commit to cmuellner/docs-spec-template that referenced this pull request Aug 14, 2024
Podman is a Docker replacement, which is developed by RedHat and available
on related Linux distributions (e.g. RHEL or Fedora).  Podman differs from
Docker in several security-related aspects.  One of them is, that Podman
requires poper SELinux labels on volume content mounted into a container.
This difference to Docker results in the following error when building
a document (the riscv-isa-manual in this example):

  Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
  /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:238:in `stat': Permission denied @ rb_file_s_stat - src/riscv-privileged.adoc (Errno::EACCES)
        from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:238:in `block in parse!'
        from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:236:in `each'
        from /var/lib/gems/3.0.0/gems/asciidoctor-2.0.23/lib/asciidoctor/cli/options.rb:236:in `parse!'
        from /var/lib/gems/3.0.0/gems/asciidoctor-pdf-2.3.18/bin/asciidoctor-pdf:40:in `<top (required)>'
        from /usr/local/bin/asciidoctor-pdf:25:in `load'
        from /usr/local/bin/asciidoctor-pdf:25:in `<main>'
  make[2]: *** [Makefile:92: build/riscv-privileged.pdf] Error 1

To address this, podman-run(1) recommends using the ':z' suffix to the
volume mount.  This patch does so, if the docker command has been
identified (reliably) to be emulated by Podman.

Tested on Fedora 40.

This change was also accepted and merged as part of the riscv-isa-manual
repo, but the patch might be better suited to be included in this
project.  See also riscv/riscv-isa-manual#1598.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants