WGET Продолжить без --no-check-certificate

Звучит как относительно простой набор правил.

  1. Разрешить что-либо в кольцевой проверке
  2. Разрешить все, что является «второй половиной» исходящего запроса
  3. Разрешить все исходящее (от маршрутизатора до INT, от маршрутизатора до EXT или от INT до EXT)
  4. Разрешить порт 22 из INT (выводится из вашего объяснения)
  5. Разрешить порт 80 из EXT и перенаправить его на внутренний сервер
  6. Разрешить порт 443 из EXT и перенаправить его на внутренний сервер
  7. Разрешить порт 32400 из EXT и перенаправить его на внутренний сервер

Вот мое предложение. Непроверено, потому что сейчас у меня нет доступной виртуальной машины с двумя интерфейсами.

# Definitions
INTIF=eth1             # Internal interface
EXTIF=eth0             # External interface
SERVERIP=192.168.1.12  # Internal webserver address

# Prepare to wipe the ruleset, so default to allowing everything
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

# Erase the rulesets
iptables -F INPUT
iptables -F OUTPUT
iptables -F FORWARD
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING

# Allow anything on loopback
iptables -i lo -j ACCEPT

# Allow anything in that is the "other half" of an outbound request
iptables -A INPUT -m state --state ESTABLISHED,RELATED

# Allow anything out (from router to INT, router to EXT, or INT to EXT)
iptables -A OUTPUT -j ACCEPT

# Allow port 22 in from INT (inferred from your explanation)
# Strictly, this is only required if you apply additional restrictions
# in the next rule, but I'm going to leave it here anyway
iptables -A INPUT -i $INTIF -p tcp --dport 22 -j ACCEPT

# Allow everything through from INT
# This allows internal access to the router too. You could add some extra
# rules here that disallow access to both the router's own IP addresses
iptables -A INPUT -i $INTIF -j ACCEPT

# Allow port 80 in from EXT, and forward it on to the internal server
# Allow port 443 in from EXT, and forward it on to the internal server
# Allow port 32400 in from EXT, and forward it on to the internal server
iptables -t nat -A PREROUTING -i $EXTIF -p tcp --dport 80 -j DNAT --to-destination $SERVERIP
iptables -t nat -A PREROUTING -i $EXTIF -p tcp --dport 443 -j DNAT --to-destination $SERVERIP
iptables -t nat -A PREROUTING -i $EXTIF -p tcp --dport 32400 -j DNAT --to-destination $SERVERIP

# Set the default action to discard all traffic
iptables -P INPUT DENY
iptables -P OUTPUT DENY

# Enable forwarding
echo 1 >/proc/sys/net/ipv4/ip_forward
0
28.07.2015, 21:35
0 ответов

Теги

Похожие вопросы