Skip to content

Commit

Permalink
Update security-txt service rule in docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Utesgui committed Jul 19, 2024
1 parent 2e557b7 commit 1d9e526
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# security.txt
Takes an Email-Address (or any other string) and serves it under /security.txt (RFC 5785) as plain text.

# Usage
## Portainer - Repository
Use this repo via git in Portainer directly.
Just add the following URL to your stack:
```https://github.com/Utesgui/security.txt```
As well as a environment variable:
```SECURITY_STRING=something```
If necessary, you can also change the path the file is served
```PATH=/betterpath.json``` -> default is /security.txt
![url to repo, add variable](/assets/stacksettings.png)

## Docker-Compose
Use the docker-compose.yml file and change it to your liking.
Then use `docker-compose up -d` to start the container or Portainer to deploy the stack.

# Variables
- ```SECURITY_STRING```: The string that should be served under /security.txt
- ```PATH```: The path the file is served under. Default is /security.txt
Binary file added assets/stacksettings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
image: git.b0t.at/b0t-at/security.txt:latest
environment:
- SECURITY_STRING=${SECURITY_STRING}
- PATH=${PATH:-/security.txt}
# volumes:
# - /opt/security-txt/public_html:/usr/share/nginx/html
# ports:
Expand All @@ -14,7 +15,7 @@ services:
- "com.centurylinklabs.watchtower.enable=true"
- "traefik.enable=true"
- "traefik.docker.network=proxy"
- traefik.http.routers.security-txt.rule=PathRegexp(`security\.txt$`)
- traefik.http.routers.security-txt.rule=Path(`${PATH:-/security.txt}`)
- "traefik.http.routers.security-txt.entrypoints=https,http"
- "traefik.http.routers.security-txt.priority=420"
- "traefik.http.routers.security-txt.tls.certresolver=le-tls" # le-dns, le-tls, le-http
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [ -z "$SECURITY_STRING" ]; then
fi

# Write the content of SECURITY_STRING to /usr/share/nginx/html/security.txt
echo "$SECURITY_STRING" > /usr/share/nginx/html/security.txt
echo "$SECURITY_STRING" > /usr/share/nginx/html/$PATH

# Execute the CMD from the Dockerfile, keeping nginx in the foreground
exec "$@"

0 comments on commit 1d9e526

Please sign in to comment.