Added optional whitelist feature
This commit is contained in:
parent
4da32724dc
commit
ade06e1945
11
Dockerfile
11
Dockerfile
@ -1,9 +1,10 @@
|
|||||||
FROM --platform=linux/amd64 debian:latest
|
FROM --platform=linux/amd64 ubuntu:22.04
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
screen \
|
screen \
|
||||||
curl \
|
curl \
|
||||||
|
ufw \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Create user
|
# Create user
|
||||||
@ -14,8 +15,12 @@ RUN su rexuiz -c 'curl https://raw.githubusercontent.com/kasymovga/rexuiz/master
|
|||||||
RUN su rexuiz -c 'bash /home/rexuiz/rexuiz_install.sh /home/rexuiz/Rexuiz/'
|
RUN su rexuiz -c 'bash /home/rexuiz/rexuiz_install.sh /home/rexuiz/Rexuiz/'
|
||||||
RUN su rexuiz -c 'chmod 755 /home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64'
|
RUN su rexuiz -c 'chmod 755 /home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64'
|
||||||
|
|
||||||
|
# Copy run script
|
||||||
|
COPY run-rexuiz.sh /usr/local/bin/run-rexuiz.sh
|
||||||
|
RUN chmod +x /usr/local/bin/run-rexuiz.sh
|
||||||
|
|
||||||
# Expose server port
|
# Expose server port
|
||||||
EXPOSE 26000/udp
|
EXPOSE 26000/udp
|
||||||
|
|
||||||
# Start server
|
# Start server with run script
|
||||||
CMD ["su", "rexuiz", "-c", "/home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64"]
|
CMD ["/usr/local/bin/run-rexuiz.sh"]
|
||||||
|
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ build:
|
|||||||
docker build -t $(IMAGE_NAME) .
|
docker build -t $(IMAGE_NAME) .
|
||||||
|
|
||||||
run:
|
run:
|
||||||
docker compose up
|
docker-compose up
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf config/*
|
rm -rf config/*
|
||||||
|
0
config/allowed_ips.txt
Normal file
0
config/allowed_ips.txt
Normal file
@ -8,6 +8,9 @@
|
|||||||
hostname "Some Awesome Server Name"
|
hostname "Some Awesome Server Name"
|
||||||
motd "Welcome to this server"
|
motd "Welcome to this server"
|
||||||
|
|
||||||
|
// States if the server is public or not
|
||||||
|
sv_public 0
|
||||||
|
|
||||||
//Network settings
|
//Network settings
|
||||||
port 26000
|
port 26000
|
||||||
net_http_server 1 //use embedded http server
|
net_http_server 1 //use embedded http server
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
rexuiz:
|
rexuiz:
|
||||||
image: rexuiz-server
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
environment:
|
||||||
|
- WHITELIST_ENABLED=true
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/home/rexuiz/.rexuiz/data
|
- ./config:/home/rexuiz/.rexuiz/data
|
||||||
ports:
|
ports:
|
||||||
|
22
run-rexuiz.sh
Normal file
22
run-rexuiz.sh
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$WHITELIST_ENABLED" = "true" ]; then
|
||||||
|
# Load in allowed IPs from file
|
||||||
|
mapfile -t allowed_ips < /home/rexuiz/.rexuiz/data/allowed_ips.txt
|
||||||
|
|
||||||
|
# Enable UFW firewall
|
||||||
|
ufw --force reset
|
||||||
|
ufw default deny incoming
|
||||||
|
ufw default allow outgoing
|
||||||
|
|
||||||
|
# Allow specified IPs
|
||||||
|
for ip in "${allowed_ips[@]}"
|
||||||
|
do
|
||||||
|
ufw allow from "$ip" to any port 26000 proto udp
|
||||||
|
done
|
||||||
|
|
||||||
|
ufw --force enable
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start server
|
||||||
|
su rexuiz -c "/home/rexuiz/Rexuiz/server/rexuiz-linux-dedicated-x86_64"
|
Loading…
x
Reference in New Issue
Block a user