CentOS - IPtablesに世界をブロックし、一意のURLのみを許可するように指示する方法は?

CentOS - IPtablesに世界をブロックし、一意のURLのみを許可するように指示する方法は?

私は次のようなiptablesを持っています:ただし、このサーバーの全員を許可する必要があります(固有のURLがある場合)。www.example.com/IamEncodedencodedencodedencodedencodedencoded_Allow_Me

$ yum install iptables-services
$ cat /etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]

# 1 ############ My office ##########
-A INPUT -s 217.1.2.3 -j ACCEPT
-A INPUT -s 82.1.2.3 -j ACCEPT
############# My office END ######

-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT

# 2 ########### Service center ############
-A INPUT -s 18.16.0.0/16 -j ACCEPT
############ Service center END ############


-A INPUT -j DROP    
COMMIT

$ systemctl restart iptables
$ systemctl reload iptables

編集する:

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -s 217.1.2.3 -j ACCEPT
-A INPUT -s 82.1.2.3 -j ACCEPT    
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT    
-A INPUT -s 18.16.0.0/16 -j ACCEPT

-A INPUT -j DROP

-A INPUT -p tcp --dport 80 -j ACCEPT

COMMIT

ベストアンサー1

ブラウザでアクセスを許可して使用している場合ApacheWebサーバーとして次の行を追加できます。Apacheサービスを構成して開始します。

#Deny the access to everything first
<Location />
 Order Deny,Allow
 Deny from All
</Location>

# then allow access to specific URL
<Location /test.html>
 Order Allow,Deny
 Allow from All
</Location>

この場合、以前はこの質問に対する回答がありました。ここで。

おすすめ記事