Skip to content

Commit

Permalink
fix: Remove VNC support
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 4, 2024
1 parent 9c231b1 commit 695cd7c
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -Eeuo pipefail
# Docker environment variables

: ${DHCP:='N'}
: ${HOST_PORTS:=''}
: ${MAC:='02:11:32:AA:BB:CC'}

: ${VM_NET_DEV:=''}
Expand Down Expand Up @@ -91,26 +90,6 @@ configureDNS() {
return 0
}

getPorts() {

local list=$1
local vnc="5900"

if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then
[ -z "$list" ] && list="$vnc" || list="$list,$vnc"
fi

[ -z "$list" ] && return 0

if [[ "$list" != *","* ]]; then
echo " ! --dport $list"
else
echo " -m multiport ! --dports $list"
fi

return 0
}

configureNAT() {

# Create the necessary file structure for /dev/net/tun
Expand Down Expand Up @@ -165,11 +144,8 @@ configureNAT() {
update-alternatives --set iptables /usr/sbin/iptables-legacy > /dev/null
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy > /dev/null

exclude="$(getPorts "$HOST_PORTS")"

iptables -t nat -A POSTROUTING -o "$VM_NET_DEV" -j MASQUERADE
# shellcheck disable=SC2086
iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p tcp${exclude} -j DNAT --to "$VM_NET_IP"
iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p tcp -j DNAT --to "$VM_NET_IP"
iptables -t nat -A PREROUTING -i "$VM_NET_DEV" -d "$IP" -p udp -j DNAT --to "$VM_NET_IP"

if (( KERNEL > 4 )); then
Expand Down

0 comments on commit 695cd7c

Please sign in to comment.