frontend fixes, dockerfile passed to bun, nftable python installed using apt
This commit is contained in:
@@ -18,6 +18,7 @@ Dockerfile
|
|||||||
/backend/db/**
|
/backend/db/**
|
||||||
/frontend/build/
|
/frontend/build/
|
||||||
/frontend/build/**
|
/frontend/build/**
|
||||||
|
/frontend/node_modules/
|
||||||
/backend/modules/cppqueue
|
/backend/modules/cppqueue
|
||||||
/backend/modules/proxy
|
/backend/modules/proxy
|
||||||
docker-compose.yml
|
docker-compose.yml
|
||||||
|
|||||||
10
Dockerfile
10
Dockerfile
@@ -1,11 +1,10 @@
|
|||||||
FROM --platform=$BUILDPLATFORM node:18 AS frontend
|
FROM --platform=$BUILDPLATFORM oven/bun as frontend
|
||||||
RUN mkdir /app
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ADD ./frontend/package.json .
|
ADD ./frontend/package.json .
|
||||||
ADD ./frontend/package-lock.json .
|
ADD ./frontend/bun.lockb .
|
||||||
RUN npm ci
|
RUN bun install
|
||||||
COPY ./frontend/ .
|
COPY ./frontend/ .
|
||||||
RUN npm run build
|
RUN bun run build
|
||||||
|
|
||||||
|
|
||||||
#Building main conteiner
|
#Building main conteiner
|
||||||
@@ -16,6 +15,7 @@ RUN apt-get install -qq git libpcre2-dev libnetfilter-queue-dev
|
|||||||
RUN apt-get install -qq libssl-dev libnfnetlink-dev libmnl-dev libcap2-bin
|
RUN apt-get install -qq libssl-dev libnfnetlink-dev libmnl-dev libcap2-bin
|
||||||
RUN apt-get install -qq make cmake nftables libboost-all-dev autoconf
|
RUN apt-get install -qq make cmake nftables libboost-all-dev autoconf
|
||||||
RUN apt-get install -qq automake cargo libffi-dev libvectorscan-dev libtins-dev
|
RUN apt-get install -qq automake cargo libffi-dev libvectorscan-dev libtins-dev
|
||||||
|
RUN apt-get install -qq python3-nftables
|
||||||
|
|
||||||
WORKDIR /tmp/
|
WORKDIR /tmp/
|
||||||
RUN git clone --single-branch --branch release https://github.com/jpcre2/jpcre2
|
RUN git clone --single-branch --branch release https://github.com/jpcre2/jpcre2
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from utils.sqlite import SQLite
|
|||||||
from utils import API_VERSION, FIREGEX_PORT, JWT_ALGORITHM, get_interfaces, socketio_emit, DEBUG, SysctlManager
|
from utils import API_VERSION, FIREGEX_PORT, JWT_ALGORITHM, get_interfaces, socketio_emit, DEBUG, SysctlManager
|
||||||
from utils.loader import frontend_deploy, load_routers
|
from utils.loader import frontend_deploy, load_routers
|
||||||
from utils.models import ChangePasswordModel, IpInterface, PasswordChangeForm, PasswordForm, ResetRequest, StatusModel, StatusMessageModel
|
from utils.models import ChangePasswordModel, IpInterface, PasswordChangeForm, PasswordForm, ResetRequest, StatusModel, StatusMessageModel
|
||||||
|
from contextlib import asynccontextmanager
|
||||||
|
|
||||||
# DB init
|
# DB init
|
||||||
db = SQLite('db/firegex.db')
|
db = SQLite('db/firegex.db')
|
||||||
@@ -22,7 +23,13 @@ sysctl = SysctlManager({
|
|||||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/login", auto_error=False)
|
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/login", auto_error=False)
|
||||||
crypto = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
crypto = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||||
|
|
||||||
app = FastAPI(debug=DEBUG, redoc_url=None)
|
@asynccontextmanager
|
||||||
|
async def lifespan(app):
|
||||||
|
await startup_main()
|
||||||
|
yield
|
||||||
|
await shutdown_main()
|
||||||
|
|
||||||
|
app = FastAPI(debug=DEBUG, redoc_url=None, lifespan=lifespan)
|
||||||
utils.socketio = SocketManager(app, "/sock", socketio_path="")
|
utils.socketio = SocketManager(app, "/sock", socketio_path="")
|
||||||
|
|
||||||
def APP_STATUS(): return "init" if db.get("password") is None else "run"
|
def APP_STATUS(): return "init" if db.get("password") is None else "run"
|
||||||
@@ -117,8 +124,7 @@ async def get_ip_interfaces():
|
|||||||
#Routers Loader
|
#Routers Loader
|
||||||
reset, startup, shutdown = load_routers(api)
|
reset, startup, shutdown = load_routers(api)
|
||||||
|
|
||||||
@app.on_event("startup")
|
async def startup_main():
|
||||||
async def startup_event():
|
|
||||||
db.init()
|
db.init()
|
||||||
if os.getenv("HEX_SET_PSW"):
|
if os.getenv("HEX_SET_PSW"):
|
||||||
set_psw(bytes.fromhex(os.getenv("HEX_SET_PSW")).decode())
|
set_psw(bytes.fromhex(os.getenv("HEX_SET_PSW")).decode())
|
||||||
@@ -127,8 +133,7 @@ async def startup_event():
|
|||||||
if not JWT_SECRET(): db.put("secret", secrets.token_hex(32))
|
if not JWT_SECRET(): db.put("secret", secrets.token_hex(32))
|
||||||
await refresh_frontend()
|
await refresh_frontend()
|
||||||
|
|
||||||
@app.on_event("shutdown")
|
async def shutdown_main():
|
||||||
async def shutdown_event():
|
|
||||||
await shutdown()
|
await shutdown()
|
||||||
sysctl.reset()
|
sysctl.reset()
|
||||||
db.disconnect()
|
db.disconnect()
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ passlib[bcrypt]
|
|||||||
psutil
|
psutil
|
||||||
python-jose[cryptography]
|
python-jose[cryptography]
|
||||||
fastapi-socketio
|
fastapi-socketio
|
||||||
git+https://salsa.debian.org/pkg-netfilter-team/pkg-nftables#egg=nftables&subdirectory=py
|
#git+https://salsa.debian.org/pkg-netfilter-team/pkg-nftables#egg=nftables&subdirectory=py
|
||||||
|
|||||||
4387
frontend/package-lock.json
generated
4387
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -5,13 +5,13 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.11.0",
|
"@emotion/react": "^11.11.0",
|
||||||
"@hello-pangea/dnd": "^16.3.0",
|
"@hello-pangea/dnd": "^16.3.0",
|
||||||
"@mantine/core": "^6.0.13",
|
"@mantine/core": "^6.0.21",
|
||||||
"@mantine/form": "^6.0.13",
|
"@mantine/form": "^6.0.21",
|
||||||
"@mantine/hooks": "^6.0.13",
|
"@mantine/hooks": "^6.0.21",
|
||||||
"@mantine/modals": "^6.0.13",
|
"@mantine/modals": "^6.0.21",
|
||||||
"@mantine/notifications": "^6.0.13",
|
"@mantine/notifications": "^6.0.21",
|
||||||
"@mantine/prism": "^6.0.13",
|
"@mantine/prism": "^6.0.21",
|
||||||
"@mantine/spotlight": "^6.0.13",
|
"@mantine/spotlight": "^6.0.21",
|
||||||
"@tanstack/react-query": "^4.35.3",
|
"@tanstack/react-query": "^4.35.3",
|
||||||
"@testing-library/dom": "^9.3.0",
|
"@testing-library/dom": "^9.3.0",
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"lib": ["dom", "dom.iterable", "esnext"],
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"types": ["vite/client", "vite-plugin-svgr/client", "node"],
|
"types": ["vite/client", "vite-plugin-svgr/client", "node"],
|
||||||
"allowJs": false,
|
"allowJs": false,
|
||||||
"skipLibCheck": false,
|
"skipLibCheck": true,
|
||||||
"esModuleInterop": false,
|
"esModuleInterop": false,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|||||||
4
start.py
4
start.py
@@ -79,8 +79,6 @@ def write_compose(psw_set=None):
|
|||||||
|
|
||||||
if "linux" in sys.platform and not 'microsoft-standard' in platform.uname().release: #Check if not is a wsl also
|
if "linux" in sys.platform and not 'microsoft-standard' in platform.uname().release: #Check if not is a wsl also
|
||||||
compose.write(f"""
|
compose.write(f"""
|
||||||
version: '3.9'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
firewall:
|
firewall:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
@@ -116,8 +114,6 @@ volumes:
|
|||||||
puts("--- WARNING ---", color=colors.yellow)
|
puts("--- WARNING ---", color=colors.yellow)
|
||||||
puts("You are not in a linux machine, the firewall will not work in this machine.", color=colors.red)
|
puts("You are not in a linux machine, the firewall will not work in this machine.", color=colors.red)
|
||||||
compose.write(f"""
|
compose.write(f"""
|
||||||
version: '3.9'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
firewall:
|
firewall:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -1,22 +1,28 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
TMP=$1
|
||||||
|
PASSWORD=${TMP:=testpassword}
|
||||||
|
|
||||||
pip3 install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
|
|
||||||
echo "Running standard API test"
|
echo "Running standard API test"
|
||||||
python3 api_test.py -p testpassword
|
python3 api_test.py -p $PASSWORD
|
||||||
echo "Running Netfilter Regex TCP ipv4"
|
echo "Running Netfilter Regex TCP ipv4"
|
||||||
python3 nf_test.py -p testpassword -m tcp
|
python3 nf_test.py -p $PASSWORD -m tcp
|
||||||
echo "Running Netfilter Regex TCP ipv6"
|
echo "Running Netfilter Regex TCP ipv6"
|
||||||
python3 nf_test.py -p testpassword -m tcp -6
|
python3 nf_test.py -p $PASSWORD -m tcp -6
|
||||||
echo "Running Netfilter Regex UDP ipv4"
|
echo "Running Netfilter Regex UDP ipv4"
|
||||||
python3 nf_test.py -p testpassword -m udp
|
python3 nf_test.py -p $PASSWORD -m udp
|
||||||
echo "Running Netfilter Regex UDP ipv6"
|
echo "Running Netfilter Regex UDP ipv6"
|
||||||
python3 nf_test.py -p testpassword -m udp -6
|
python3 nf_test.py -p $PASSWORD -m udp -6
|
||||||
echo "Running Proxy Regex"
|
echo "Running Proxy Regex"
|
||||||
python3 px_test.py -p testpassword
|
python3 px_test.py -p $PASSWORD
|
||||||
echo "Running Port Hijack TCP ipv4"
|
echo "Running Port Hijack TCP ipv4"
|
||||||
python3 ph_test.py -p testpassword -m tcp
|
python3 ph_test.py -p $PASSWORD -m tcp
|
||||||
echo "Running Port Hijack TCP ipv6"
|
echo "Running Port Hijack TCP ipv6"
|
||||||
python3 ph_test.py -p testpassword -m tcp -6
|
python3 ph_test.py -p $PASSWORD -m tcp -6
|
||||||
echo "Running Port Hijack UDP ipv4"
|
echo "Running Port Hijack UDP ipv4"
|
||||||
python3 ph_test.py -p testpassword -m udp
|
python3 ph_test.py -p $PASSWORD -m udp
|
||||||
echo "Running Port Hijack UDP ipv6"
|
echo "Running Port Hijack UDP ipv6"
|
||||||
python3 ph_test.py -p testpassword -m udp -6
|
python3 ph_test.py -p $PASSWORD -m udp -6
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user