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

TASK-6559 - Security: IVA Docker - Avoid port 80 and Root privileges #965

Merged
merged 13 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions docker/iva-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM httpd:2.4-bullseye
## Custom httpd.conf file to update exposed port from 80 to 8080
COPY ./docker/iva-app/custom-httpd.conf /usr/local/apache2/conf/httpd.conf

## To run the docker use:
## docker build -f ./docker/iva-app/Dockerfile -t iva-httpd .
## docker run --name jsorolla -p 8888:80 opencb/iva-app
## docker run --name jsorolla -p 8888:8080 opencb/iva-app
## Then open: http://localhost:8888/iva o http://localhost:8888/api

LABEL org.label-schema.vendor="OpenCB" \
Expand All @@ -15,20 +17,24 @@ LABEL org.label-schema.vendor="OpenCB" \
## Update and create iva user
RUN apt-get update && apt-get -y upgrade && \
apt-get install -y vim jq && \
rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/* && \
chown -R www-data /usr/local/apache2/logs/

## Allow to build different images by passing the path to the SITE
ARG SITE=src/sites

## Copy files
## IVA
COPY ./build/iva /usr/local/apache2/htdocs/iva
COPY ./${SITE}/iva/conf /usr/local/apache2/htdocs/iva/conf/
COPY ./${SITE}/iva/img /usr/local/apache2/htdocs/iva/img/
COPY --chown=www-data ./build/iva /usr/local/apache2/htdocs/iva
COPY --chown=www-data ./${SITE}/iva/conf /usr/local/apache2/htdocs/iva/conf/
COPY --chown=www-data ./${SITE}/iva/img /usr/local/apache2/htdocs/iva/img/

RUN true

## Run Docker images as non root
USER www-data

## Genome Maps (Coming soon :-) )
#COPY ./build/genome-maps /usr/local/apache2/htdocs/genome-maps

ENTRYPOINT ["httpd-foreground"]
ENTRYPOINT ["httpd-foreground"]
17 changes: 17 additions & 0 deletions docker/iva-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# How to update this docker

If you want to update the base image https://hub.docker.com/_/httpd , it is necesary repeat this steps

To customize the configuration of the httpd server, first obtain the upstream default configuration from the container:

```bash
docker run --rm httpd:2.4-bullseye cat /usr/local/apache2/conf/httpd.conf > ./docker/iva-app/custom-httpd.conf
```

And then change custom-httpd.conf

```
Listen 8080
```


Loading
Loading