Skip to content

Commit 7a291e2

Browse files
authored
docs: provide usage guide with highlightings around security (#96)
1 parent f16ec0c commit 7a291e2

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h1 align="center">Docker PaperMC Server</h1>
1+
<h1 align="center">🐳 Docker PaperMC Server</h1>
22

33
<div align="center">
44

@@ -15,6 +15,32 @@ Available in [Docker Hub](https://hub.docker.com/r/djaytan/papermc-server).
1515

1616
</div>
1717

18+
## 📘 Usage
19+
20+
For production-grade deployments, it is recommended to use the following command:
21+
22+
```bash
23+
$ docker run -it \
24+
--name papermc-server \
25+
--restart=on-failure:10 \
26+
--cap-drop all \
27+
--security-opt no-new-privileges \
28+
--ulimit nofile=16384 \
29+
--ulimit nproc=4096 \
30+
--ulimit core=0 \
31+
--cpus=4 \
32+
--memory=8GB \
33+
-p 25565:25565/tcp -p 25565:25565/udp \
34+
-e EULA=true \
35+
'djaytan/papermc-server:1.21.4'
36+
```
37+
38+
_**Note:** These settings provide sensible defaults, but you may need to adjust them based on your server's specific requirements._
39+
40+
Details about security best practices and recommendations can be found [here](docs/security-best-practices.md).
41+
42+
Available tags can be found [here](https://hub.docker.com/r/djaytan/papermc-server/tags).
43+
1844
## ✨ Features
1945

2046
* **[Alpine](https://hub.docker.com/_/alpine)-based image**
@@ -39,8 +65,9 @@ The image is under active development, with the following enhancements planned:
3965
* **Enable/Disable Aikar's flags**: Aikar's researches ([link](https://aikar.co/2018/07/02/tuning-the-jvm-g1gc-garbage-collector-flags-for-minecraft/)) and [PaperMC recommendations](https://docs.papermc.io/paper/aikars-flags/)
4066
* **Configurable TimeZone**
4167
* **Auto-updating builds**: Scheduled rebuilds for including upstream JDK/PaperMC updates and security patches.
42-
* **Compliancy with [OWASP Docker rules](https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html)**
4368
* **GraalVM variant**
69+
* **Read-only filesystem**
70+
* **Helm chart**
4471

4572
The below features may be implemented too, but are not a priority:
4673

docs/GUIDE.md renamed to docs/security-best-practices.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
# Guide
1+
²# Security Best Practices
22

3-
This guide helps you make the most of the OCI image, with a focus on compatibility and security.
3+
This guide provides practical instructions for optimizing the OCI image, with an emphasis on ensuring both compatibility and security.
44

55
## OWASP - Docker Security Cheat Sheet
66

7-
The [OWASP Docker Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html) provides a comprehensive overview of
8-
best practices that we recommend you to follow when running the PaperMC server container.
7+
The [OWASP Docker Security Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html) offers a thorough guide to securing
8+
Docker containers. We strongly recommend following these best practices when running the PaperMC server container.
9+
10+
In the following sections, we’ll explain how to implement some of these recommendations specifically for this image.
11+
12+
_**Note:** Making the filesystem read-only is not yet fully supported in this image._
913

1014
## UID/GID
1115

@@ -22,6 +26,14 @@ writable (`o+r`, `o+rw`) modes.
2226
For more details about OpenShift’s Security Context Constraints (SCCs), refer to
2327
the [official documentation](https://docs.openshift.com/container-platform/latest/concepts/policy/security-context-constraints.html).
2428

29+
## Linux Kernel Capabilities & Privileges
30+
31+
It is recommended to drop all Linux kernel capabilities, as this enhances security without affecting the container’s functionality. The PaperMC server does not
32+
require any special privileges, so this should not cause issues for most workloads. However, if you encounter specific problems, you can re-enable individual
33+
capabilities as needed.
34+
35+
Additionally, disabling privilege escalation tools like `su` and `sudo` is recommended to further restrict potential security risks.
36+
2537
## Resource Limits
2638

2739
Setting appropriate resource limits is essential to ensure the container behaves reliably, securely, and within predictable boundaries. This aligns with [OWASP

localdev.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/usr/bin/env sh
2-
# TODO: document security recommendations adapted to this project
3-
# TODO: document requirements for OWASP RULE#8 https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html#rule-7-limit-resources-memory-cpu-file-descriptors-processes-restarts
4-
# TODO: try OWASP RULE#8 here
52

63
set -eu
74

0 commit comments

Comments
 (0)