final version

This commit is contained in:
2024-11-08 21:19:14 +03:00
parent ff77ed1204
commit c0e8c94a56
6 changed files with 23 additions and 2 deletions

8
ctl.sh
View File

@@ -16,6 +16,14 @@ case "${1}" in
docker-compose up -d;
;;
reinit )
yes | docker-compose rm --stop;
docker rmi $(docker images | grep "docker_and_networks" | awk '{print $1}');
docker rmi $(docker images | grep "ngx-template" | awk '{print $1}');
docker rmi $(docker images | grep "visor" | awk '{print $1}');
docker-compose up -d;
;;
watch )
watch "docker-compose ps"
;;

View File

@@ -79,6 +79,7 @@ services:
visor:
container_name: visor
image: visor
build:
context: .
dockerfile: ./dockerfiles/Dockerfile_visor

View File

@@ -5,6 +5,8 @@ ARG NET_NAME=kek
ARG CONTAINER_NAME=lol
ARG STATIC_FILE=/usr/share/nginx/html/index.html
COPY ./scripts/.env /root/scripts/.env
# change default nginx index.html
RUN sed -i '13,21d' $STATIC_FILE && \
sed -i "13i <table>\

View File

@@ -1,6 +1,9 @@
FROM nginx:latest
COPY ./scripts/knocking_setup.sh /root/scripts/knocking_setup.sh
COPY ./scripts/.env /root/scripts/.env
WORKDIR /root/scripts/
RUN apt update \
&& apt install knockd htop iptables iproute2 vim curl -y

View File

@@ -1,5 +1,10 @@
FROM ubuntu:latest
COPY ./scripts/.env /root/scripts/.env
COPY ./scripts/block_port.sh /root/scripts/block_port.sh
WORKDIR /root/scripts/
CMD apt update \
&& apt install iproute2 vim curl nmap knockd -y \
&& sleep infinity

View File

@@ -4,18 +4,20 @@
INTERFACE=$(ip -br a | grep -E "172.28" | awk '{print $1}') || \
exit 0
source .env
echo -E "
[options]
Interface = ${INTERFACE%@*}
[openNGINX]
sequence = 8100, 7200, 13000
sequence = ${OPEN_PORT_SEQ}
seq_timeout = 5
command = /sbin/iptables -D INPUT -p tcp --dport 80 -j REJECT
tcpflags = syn
[closeNGINX]
sequence = 6300, 5200, 12001
sequence = ${CLOSE_PORT_SEQ}
seq_timeout = 5
command = /sbin/iptables -A INPUT -p tcp --dport 80 -j REJECT
tcpflags = syn