OWASP / OWASP/SecurityShepherd

[BUG] Building Web Container Image fails: "Can't rename file ... server.xml ... Invalid argument

Open
#753 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Java
Stars
1.5k
Forks
515
Avg merge
3h 46m
Merged PRs (30d)
1

Description

Describe the bug
When I try to install SecurityShepherd, docker build phase fails:

 $ docker compose up
...
 => [stage-1  8/13] RUN apt-get -qq update && apt-get install -y patch libargon2-0             8.2s
 => [stage-1  9/13] RUN adduser --system --group tomcat --home /usr/local/tomcat               5.6s
 => [stage-1 10/13] RUN chown -R tomcat:${RUN_GROUP} /usr/local/tomcat                         8.2s
 => [stage-1 11/13] RUN rm -rf /usr/local/tomcat/webapps/ROOT                                  3.2s
 => ERROR [stage-1 12/13] RUN patch /usr/local/tomcat/conf/server.xml /usr/local/tomcat/conf/  0.4s
------
 > [stage-1 12/13] RUN patch /usr/local/tomcat/conf/server.xml /usr/local/tomcat/conf/serverxml.patch:
#0 0.350 patching file /usr/local/tomcat/conf/server.xml
#0 0.353 Hunk #2 succeeded at 109 (offset -1 lines).
#0 0.361 patch: **** Can't rename file /usr/local/tomcat/conf/server.xml to /usr/local/tomcat/conf/server.xml.orig : Invalid argument
------
failed to solve: process "/bin/sh -c patch /usr/local/tomcat/conf/server.xml /usr/local/tomcat/conf/serverxml.patch" did not complete successfully: exit code: 2 

To Reproduce
Steps to reproduce the behavior: (following the instructions in https://github.com/OWASP/SecurityShepherd/wiki/Docker-Environment-Setup)

  1. Login to fresh and up-to-date Ubuntu 22.04 system with Docker and docker-compose preinstalled; user is already member of docker group
  2. sudo apt install git maven openjdk-8-jdk
  3. git clone https://github.com/OWASP/SecurityShepherd.git
  4. cd SecurityShepherd
  5. mvn -Pdocker clean install -DskipTests
  6. docker compose up
  7. See error above

Expected behavior
The docker compose up should not fail but successfully start up docker containers.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04.2 LTS
  • Browser: none; just a headless box that we entered with ssh

Further Information:

  • mvn version: 3.6.3-5
  • docker version: 23.0.1, built Thu Feb 9 19:47:01 2023, Git commit a5ee5b1
  • docker-compose version: v2.16.0 (compose as plugin)
  • java version: openjdk 11.0.18 2023-01-17

Screenshots
none, just see excerpt from build above

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Docker image build step shown in the report, especially the patch command involving /usr/local/tomcat/conf/server.xml and serverxml.patch. Reproduce it with docker compose up after the Maven build, then inspect the container build definition and patch inputs. Done means the image builds and the Docker containers start successfully on the reported environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.