pptp または L2TP/IPsec ルールの Redhat/Centos 7 Firewalld ベストプラクティス

pptp または L2TP/IPsec ルールの Redhat/Centos 7 Firewalld ベストプラクティス

Centos 7を少し見て、VPNデーモンまたは3を起動している間、一般的に使用されているパッケージがまだコアリポジトリにないことにすぐに気付いたので、EPELベータなどの必要な部分を見つけて迷いました。木。とにかく主な質問に関してはiptables到着ファイアウォール。私はゲームボックスを次に復元できることを知っています。iptables上司を気にしないでください。しかし、これは新しいおもちゃなので、遊ぶ必要があります。 RTFMを使って素早く見て発見しましょう。オープンVPNそしてネットワークセキュリティプロトコルこの新しいおもちゃのサービス定義はありますが、このようなサービス定義はありません。PPTPl2tpNAT-T.... したがって、次のようなものを作成するために数分を投資してください。

/etc/firewalld/services/pptp.xml

<?xml version="1.0" encoding="utf-8"?>
  <service>
    <short>pptp</short>
    <description>Point-to-Point Tunneling Protocol (PPTP)</description>
    <port protocol="tcp" port="1723"/>
  </service>

または: /etc/firewalld/services/l2tp.xml

<?xml version="1.0" encoding="utf-8"?>
  <service>
    <short>L2TP</short>
    <description>Layer 2 Tunneling Protocol (L2TP)</description>
    <port protocol="udp" port="1701"/>
  </service>

または: /etc/firewalld/services/nat-t.xml

<?xml version="1.0" encoding="utf-8"?>
  <service>
    <short>NAT-T</short>
    <description>Network Address Translation (NAT-T)</description>
    <port protocol="udp" port="4500"/>
  </service>

など.....

chmod 640 /etc/firewalld/services/*.xml
restorecon /etc/firewalld/services/*.xml

その後、いくつかのルールがあります。

firewall-cmd --zone=external --add-interface=ip_vti0 --permanent
firewall-cmd --zone=external --add-interface=ppp0 --permanent
firewall-cmd --reload
firewall-cmd --get-services

firewall-cmd --zone=external --add-service=l2tp --permanent
firewall-cmd --zone=external --add-service=pptp --permanent
firewall-cmd --zone=external --add-service=nat-t --permanent
....
firewall-cmd --reload

など.....

しかし、このアプローチに固執し、ゾーンについて学ぶ必要があるのか​​、単にファイアウォールダイレクトルールプリグを使用して標準のiptablesルールをコピーするのか疑問に思います。

iptables -A INPUT -i enp3s0 -p tcp --dport pptp-j ACCEPT
iptables -A INPUT -i enp3s0 -p tcp --dport l2tp -j ACCEPT
iptables -A INPUT -i enp3s0 -p tcp --dport ipsec-nat-t -j ACCEPT
iptables -A INPUT -i enp3s0 -p gre -j ACCEPT
....
iptables -t nat -A POSTROUTING -o enp3s0 -j MASQUERADE
iptables -t nat -A POSTROUTING -s 192.168.0.0/28 -o enp3s0 -j MASQUERADE
iptables-save

そして:

firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i enp3s0 -p tcp --dport pptp-j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i enp3s0 -p tcp --dport l2tp -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0T -i enp3s0 -p tcp --dport ipsec-nat-t -j ACCEPT
firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i enp3s0 -p gre -j ACCEPT
....
firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -o enp3s0 -j MASQUERADE 
firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -s 192.168.0.0/28 -o enp3s0 -j MASQUERADE -t nat
firewall-cmd --reload

一般的な考え方(iptablesルールセットの複製/新しいサービスの実行+ゾーン)とは何ですか?Webで偽装して公開するための公開/推奨ルールセットはありますか?

ベストアンサー1

おすすめ記事