File tree Expand file tree Collapse file tree 7 files changed +105
-0
lines changed
Expand file tree Collapse file tree 7 files changed +105
-0
lines changed Original file line number Diff line number Diff line change 1+ venv /
2+ * .venv /
3+ __pycache__ /
4+ * .pyc
5+ * .pyo
6+ * .pyd
7+ .vscode /
8+ .idea /
9+
10+ .git /
Original file line number Diff line number Diff line change 1+ FROM python:3.10-slim
2+ WORKDIR /app
3+ COPY requirements_docker.txt .
4+
5+ RUN apt-get update && \
6+ apt-get install -y gcc build-essential python3-dev && \
7+ pip install -r requirements_docker.txt && \
8+ apt-get purge -y gcc build-essential python3-dev && \
9+ apt-get autoremove -y && \
10+ apt-get clean
11+
12+
13+ COPY . .
14+ RUN chmod +x /app/entrypoint.sh
15+ ENTRYPOINT ["/app/entrypoint.sh" ]
16+
17+ CMD ["python" , "main.py" ]
Original file line number Diff line number Diff line change @@ -125,6 +125,49 @@ python3 main.py --create-config
125125sudo python3 main.py -v
126126` ` `
127127
128+ # 🐳 Running with Docker
129+
130+ Using Docker is the recommended way to run the firewall, as it automatically manages all dependencies and network permissions.
131+
132+ ---
133+
134+ # # ✅ Prerequisites
135+
136+ Make sure you have the following installed:
137+
138+ - ** Docker**
139+ - ** Docker Compose**
140+ * (Docker Desktop for Windows/macOS includes both.)*
141+
142+ ---
143+
144+
145+ # ## **1. Build and Run**
146+
147+ Open your terminal in the project’s root directory and run:
148+
149+ ` ` ` bash
150+ docker-compose run --rm firewall
151+ ` ` `
152+
153+ The image will build the ** first time** you run this command.
154+
155+ ` --rm` ensures the container is automatically removed when it stops.
156+
157+ ---
158+
159+ # # 2. Select Network Interface
160+
161+ After the container starts, you will be prompted to choose the interface:
162+
163+ Select an interface (0–2): 2
164+
165+
166+ ---
167+
168+ # # ✅ To Stop
169+
170+ Press: Ctrl + C
128171
129172
130173# # Configuration
Original file line number Diff line number Diff line change 1+ services :
2+ firewall :
3+ build : .
4+ container_name : firewall
5+
6+ cap_add :
7+ - NET_ADMIN
8+ network_mode : " host"
9+
10+ restart : unless-stopped
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # This script runs inside the container
4+ # It checks if a config file exists. If not, it creates one.
5+
6+ CONFIG_FILE=" firewall_config.json"
7+
8+ if [ ! -f " $CONFIG_FILE " ]; then
9+ echo " --- No $CONFIG_FILE found, creating one... ---"
10+ python main.py --create-config
11+ echo " --- Default config file created. ---"
12+ else
13+ echo " --- Using existing $CONFIG_FILE . ---"
14+ fi
15+ echo " --- Starting firewall... ---"
16+ exec " $@ "
Original file line number Diff line number Diff line change 1+ pytest>=7.0.0
2+ pytest-cov>=4.0.0
3+ black>=22.0.0
4+ flake8>=5.0.0
5+ isort>=5.10.0
Original file line number Diff line number Diff line change 1+ scapy>=2.4.0
2+ psutil>=5.8.0
3+ colorama>=0.4.0
4+ netifaces>=0.11.0
You can’t perform that action at this time.
0 commit comments