Docker image on ghcr-io

This commit is contained in:
Domingo Dirutigliano
2022-08-03 13:44:30 +02:00
committed by DomySh
parent cd3dd2627f
commit 850e408360
22 changed files with 92 additions and 103 deletions

View File

@@ -16,6 +16,8 @@ Dockerfile
/backend/db/ /backend/db/
/backend/db/** /backend/db/**
/frontend/build/
/frontend/build/**
/backend/modules/cppqueue /backend/modules/cppqueue
/backend/modules/proxy /backend/modules/proxy
docker-compose.yml docker-compose.yml

66
.github/workflows/docker-image.yml vendored Normal file
View File

@@ -0,0 +1,66 @@
name: Create and publish a Docker image
on:
release:
types:
- published
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# - name: init node
# uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Install dependencies from package.json
# working-directory: ./frontend
# run: npm install
# - name: Build React frontend
# working-directory: ./frontend
# run: npm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

2
.gitignore vendored
View File

@@ -14,6 +14,8 @@
/backend/db/ /backend/db/
/backend/db/** /backend/db/**
/frontend/build/
/frontend/build/**
/backend/modules/cppqueue /backend/modules/cppqueue
/backend/modules/proxy /backend/modules/proxy
docker-compose.yml docker-compose.yml

View File

@@ -1,8 +1,22 @@
FROM node:16-alpine AS frontend
RUN apk add --update npm
RUN npm install -g npm@latest
RUN mkdir /app
WORKDIR /app
ADD ./frontend/package.json .
ADD ./frontend/package-lock.json .
RUN npm install
COPY ./frontend/ .
RUN npm run build
#Building main conteiner #Building main conteiner
FROM python:alpine FROM python:alpine AS base
RUN apk update RUN apk update
RUN apk add g++ git pcre2-dev libnetfilter_queue-dev libpcap-dev libcrypto1.1 libnfnetlink-dev libmnl-dev make cmake nftables boost-dev libcap bash RUN apk add g++ git pcre2-dev libnetfilter_queue-dev libpcap-dev\
libcrypto1.1 libnfnetlink-dev libmnl-dev make cmake nftables\
boost-dev libcap autoconf automake bash rust cargo openssl-dev
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
@@ -22,10 +36,8 @@ COPY ./backend/binsrc /execute/binsrc
RUN g++ binsrc/nfqueue.cpp -o modules/cppqueue -O3 -lnetfilter_queue -pthread -lpcre2-8 -ltins -lmnl -lnfnetlink RUN g++ binsrc/nfqueue.cpp -o modules/cppqueue -O3 -lnetfilter_queue -pthread -lpcre2-8 -ltins -lmnl -lnfnetlink
RUN g++ binsrc/proxy.cpp -o modules/proxy -O3 -pthread -lboost_system -lboost_thread -lpcre2-8 RUN g++ binsrc/proxy.cpp -o modules/proxy -O3 -pthread -lboost_system -lboost_thread -lpcre2-8
COPY ./backend/ /execute/ COPY ./backend/ /execute/
COPY ./frontend/build/ ./frontend/ COPY --from=frontend /app/build/ ./frontend/
ENTRYPOINT ["/bin/sh", "/execute/docker-entrypoint.sh"] ENTRYPOINT ["/bin/sh", "/execute/docker-entrypoint.sh"]

View File

@@ -1,5 +1,7 @@
# [Fi]*regex 🔥 # [Fi]*regex 🔥
<a href="https://github.com/Pwnzer0tt1/firegex/releases/latest"><img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/pwnzer0tt1/firegex?color=D62246&style=flat-square"></a> <img alt="GitHub" src="https://img.shields.io/github/license/pwnzer0tt1/firegex?style=flat-square"> <a href="https://discord.gg/79NNVJBK5Z" target="_blank"><img alt="Discord" src="https://img.shields.io/discord/860223571594051605?color=%237289DA&label=Discord&style=flat-square"></a> <img alt="GitHub top language" src="https://img.shields.io/github/languages/top/pwnzer0tt1/firegex?style=flat-square&color=44AA44"> <img alt="Lines of code" src="https://img.shields.io/tokei/lines/github/pwnzer0tt1/firegex?color=947BD3&style=flat-square"> <img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/pwnzer0tt1/firegex?color=F0A7A0&style=flat-square">
## What is Firegex? ## What is Firegex?
Firegex is a firewall that includes different functionalities, created for CTF Attack-Defence competitions that has the aim to limit or totally deny malicious traffic through the use of different kind of filters. Firegex is a firewall that includes different functionalities, created for CTF Attack-Defence competitions that has the aim to limit or totally deny malicious traffic through the use of different kind of filters.
@@ -52,5 +54,4 @@ Initiially the project was based only on regex filters, and also now the main fu
- Explanation about tools in the dedicated pages making them more user-friendly - Explanation about tools in the dedicated pages making them more user-friendly
- Give the permission to set a startup password in start.py protecting firegex also at the first run - Give the permission to set a startup password in start.py protecting firegex also at the first run
- buffering the TCP and(/or) the UDP stream to avoid to bypass the proxy dividing the information in more packets - buffering the TCP and(/or) the UDP stream to avoid to bypass the proxy dividing the information in more packets
- Publish a docker image making the start of firegex fast (skip the compiling of the binaries and libraries)
- Adding new section with "general firewall rules" to manage "simple" TCP traffic rules graphically and through nftables - Adding new section with "general firewall rules" to manage "simple" TCP traffic rules graphically and through nftables

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -1,13 +0,0 @@
{
"files": {
"main.css": "/static/css/main.96ef8f18.css",
"main.js": "/static/js/main.8da55c0a.js",
"index.html": "/index.html",
"main.96ef8f18.css.map": "/static/css/main.96ef8f18.css.map",
"main.8da55c0a.js.map": "/static/js/main.8da55c0a.js.map"
},
"entrypoints": [
"static/css/main.96ef8f18.css",
"static/js/main.8da55c0a.js"
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

View File

@@ -1 +0,0 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="/site.webmanifest"><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#FFFFFFFF"/><meta name="description" content="Firegex by Pwnzer0tt1"/><title>Firegex</title><script defer="defer" src="/static/js/main.8da55c0a.js"></script><link href="/static/css/main.96ef8f18.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>

View File

@@ -1,3 +0,0 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:

View File

@@ -1 +0,0 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

View File

@@ -1,2 +0,0 @@
@import url(https://fonts.googleapis.com/css2?family=Lato&display=swap);.center-flex,.center-flex-row{align-items:center;display:flex;justify-content:center}.center-flex-row{flex-direction:column}.flex-spacer{flex-grow:1}.Footer_center-flex-row__Iibc4,.Footer_center-flex__mTXcH,.Footer_footer__V8Lu\+{align-items:center;display:flex;justify-content:center}.Footer_center-flex-row__Iibc4{flex-direction:column}.Footer_flex-spacer__6R1Ah{flex-grow:1}.Footer_footer__V8Lu\+{background-color:#242a33;margin-top:50px}.Header_center-flex-row__IvRvv,.Header_center-flex__DB4BQ,.Header_divlogo__5tqvT,.Header_navbtn__0vn69{align-items:center;display:flex;justify-content:center}.Header_center-flex-row__IvRvv{flex-direction:column}.Header_flex-spacer__lqMXa{flex-grow:1}.Header_header__MY7fH{align-items:center;background-color:#242a33;display:flex;justify-content:center;width:100%}.Header_divlogo__5tqvT{cursor:pointer;height:100%;width:110px}.Header_navbtn__0vn69{margin:0;width:30px}.ServiceRow_center-flex-row__NF59z,.ServiceRow_center-flex__Ffq-d,.ServiceRow_row__HwgWF{align-items:center;display:flex;justify-content:center}.ServiceRow_center-flex-row__NF59z{flex-direction:column}.ServiceRow_flex-spacer__OVA44{flex-grow:1}.ServiceRow_row__HwgWF{border-radius:20px;margin:10px;padding:30px 0;width:95%}.ServiceRow_name__HSrHR{color:#fff;font-size:2.3em;font-weight:bolder;margin-bottom:13px;margin-right:10px}body{font-family:Lato,sans-serif;margin:0}.ServiceRow_center-flex-row__KpTZC,.ServiceRow_center-flex__OM87P,.ServiceRow_row__q7RbE{align-items:center;display:flex;justify-content:center}.ServiceRow_center-flex-row__KpTZC{flex-direction:column}.ServiceRow_flex-spacer__5N54i{flex-grow:1}::-webkit-scrollbar{background:#333;cursor:pointer;margin:3px;width:12px}::-webkit-scrollbar-thumb{background:#757575;border-radius:8px}.ServiceRow_row__q7RbE{border-radius:20px;margin:10px;padding:30px 0;width:95%}.ServiceRow_name__Qefq\+{color:#fff;font-size:2.3em;font-weight:bolder;margin-bottom:13px;margin-right:10px}.RegexView_box__IDvxB{margin:5px;padding:30px}.RegexView_regex_text__pFvPS{background-color:#25262b;border-radius:8px;margin:6px;padding:6px}
/*# sourceMappingURL=main.96ef8f18.css.map*/

View File

@@ -1 +0,0 @@
{"version":3,"file":"static/css/main.96ef8f18.css","mappings":"wEAUA,8BAGE,mBAFA,aACA,sBACA,CAGF,iBAEE,sBAGF,aACE,YAZF,iFAGE,mBAFA,aACA,sBACA,CAGF,+BAEE,sBAGF,2BACE,YCnBF,uBAEI,yBADA,eCHY,CFShB,uGAGE,mBAFA,aACA,sBACA,CAGF,+BAEE,sBAGF,2BACE,YGlBF,sBAII,mBAFA,wBDLY,CCMZ,aAEA,uBAJA,UAIA,CAGJ,uBAGI,eADA,YADA,WAEA,CAIJ,sBAGI,QAAO,CADP,UACQ,CHZZ,yFAGE,mBAFA,aACA,sBACA,CAGF,mCAEE,sBAGF,+BACE,YInBF,uBAGI,mBACA,YAFA,eADA,SAGA,CAIJ,wBAKI,WAJA,gBACA,mBAEA,mBADA,iBAEA,CJXJ,KAEE,4BADA,QACA,CAGF,yFAGE,mBAFA,aACA,sBACA,CAGF,mCAEE,sBAGF,+BACE,YAGF,oBAGE,gBACA,eAFA,UAAU,CADV,UAGA,CAEF,0BACE,mBACA,kBK9BF,uBAGI,mBACA,YAFA,eADA,SAGA,CAIJ,yBAKI,WAJA,gBACA,mBAEA,mBADA,iBAEA,CCbJ,sBAEI,UAAS,CADT,YACU,CAGd,6BAEI,wBJPS,CIQT,kBACA,WAHA,WAGA","sources":["index.scss","components/Footer/index.module.scss","_vars.scss","components/Header/index.module.scss","components/NFRegex/ServiceRow/index.module.scss","components/RegexProxy/ServiceRow/ServiceRow.module.scss","components/RegexView/index.module.scss"],"sourcesContent":["\n@use \"vars\" as *;\n\n@import url('https://fonts.googleapis.com/css2?family=Lato&display=swap');\n\nbody {\n margin: 0;\n font-family: 'Lato', sans-serif;\n}\n\n.center-flex{\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.center-flex-row{\n @extend .center-flex;\n flex-direction: column;\n}\n\n.flex-spacer{\n flex-grow: 1;\n}\n\n::-webkit-scrollbar {\n width: 12px;\n margin:3px;\n background: #333;\n cursor: pointer;\n}\n::-webkit-scrollbar-thumb {\n background: #757575;\n border-radius: 8px;\n}","@use \"../../vars\" as *;\r\n@use \"../../index.scss\" as *;\r\n\r\n.footer{\r\n margin-top: 50px;\r\n background-color: $primary_color;\r\n @extend .center-flex;\r\n}","\r\n$primary_color: #242a33;\r\n$second_color: #1A1B1E;\r\n$third_color:#25262b;\r\n","\r\n@use \"../../vars\" as *;\r\n@use \"../../index.scss\" as *;\r\n\r\n.header{\r\n width: 100%;\r\n background-color: $primary_color;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n\r\n.divlogo{\r\n width: 110px;\r\n height: 100%;\r\n cursor: pointer;\r\n @extend .center-flex;\r\n}\r\n\r\n.navbtn{\r\n @extend .center-flex;\r\n width: 30px;\r\n margin:0;\r\n}","\r\n@use \"../../../index.scss\" as *;\r\n\r\n.row{\r\n width: 95%;\r\n padding: 30px 0px;\r\n border-radius: 20px;\r\n margin: 10px;\r\n @extend .center-flex;\r\n}\r\n\r\n.name{\r\n font-size: 2.3em;\r\n font-weight: bolder;\r\n margin-right: 10px;\r\n margin-bottom: 13px;\r\n color:#FFF;\r\n}","\r\n@use \"../../../index.scss\" as *;\r\n\r\n.row{\r\n width: 95%;\r\n padding: 30px 0px;\r\n border-radius: 20px;\r\n margin: 10px;\r\n @extend .center-flex;\r\n}\r\n\r\n.name{\r\n font-size: 2.3em;\r\n font-weight: bolder;\r\n margin-right: 10px;\r\n margin-bottom: 13px;\r\n color:#FFF;\r\n}","\r\n@use \"../../vars\" as *;\r\n\r\n.box{\r\n padding:30px;\r\n margin:5px;\r\n}\r\n\r\n.regex_text{\r\n padding: 6px;\r\n background-color: $third_color;\r\n border-radius: 8px;\r\n margin: 6px;\r\n}"],"names":[],"sourceRoot":""}

File diff suppressed because one or more lines are too long

View File

@@ -1,70 +0,0 @@
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* React Router v6.3.0
*
* Copyright (c) Remix Software Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

File diff suppressed because one or more lines are too long

View File

@@ -23,6 +23,7 @@ parser = argparse.ArgumentParser()
parser.add_argument('--port', "-p", type=int, required=False, help='Port where open the web service of the firewall', default=4444) parser.add_argument('--port', "-p", type=int, required=False, help='Port where open the web service of the firewall', default=4444)
parser.add_argument('--threads', "-t", type=int, required=False, help='Number of threads started for each service/utility', default=1) parser.add_argument('--threads', "-t", type=int, required=False, help='Number of threads started for each service/utility', default=1)
parser.add_argument('--no-autostart', "-n", required=False, action="store_true", help='Auto-execute "docker-compose up -d --build"', default=False) parser.add_argument('--no-autostart', "-n", required=False, action="store_true", help='Auto-execute "docker-compose up -d --build"', default=False)
parser.add_argument('--build', "-b", required=False, action="store_true", help='Build the container locally', default=False)
args = parser.parse_args() args = parser.parse_args()
sep() sep()
@@ -45,7 +46,7 @@ version: '3.9'
services: services:
firewall: firewall:
restart: unless-stopped restart: unless-stopped
build: . {"build: ." if args.build else "image: ghcr.io/pwnzer0tt1/firegex:latest"}
network_mode: "host" network_mode: "host"
environment: environment:
- PORT={args.port} - PORT={args.port}
@@ -66,7 +67,7 @@ version: '3.9'
services: services:
firewall: firewall:
restart: unless-stopped restart: unless-stopped
build: . {"build: ." if args.build else "image: ghcr.io/pwnzer0tt1/firegex:latest"}
ports: ports:
- {args.port}:{args.port} - {args.port}:{args.port}
environment: environment: