Linux Web サーバーが接続を「受け入れる」ことはありません。

Linux Web サーバーが接続を「受け入れる」ことはありません。

まず、誰でも提供できる助けに感謝します。本当にありがとうございます!

テスト用にデフォルトネットワークを設定しました。ゲートウェイ/ DHCP / DNSホストとしてpfSenseがあり、その後に2つのLinuxシステムがあります。 Linuxシステムの1つがApache Webサーバーをホストし、他のLinuxシステムからWebページをロードできません。

私はこれがループバックIPアドレスへのhttpdバインディングに関連していると思いましたが、問題を解決したようで、問題が解決しません。最後のnmapを見ると、Webサーバーへの外部アクセスのためにポート80または443が開いていないようです。

以下はnetstatWebサーバーの出力です。

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      1502/mariadbd       
tcp        0      0 127.0.0.1:44321         0.0.0.0:*               LISTEN      1570/pmcd           
tcp        0      0 127.0.0.1:60999         0.0.0.0:*               LISTEN      809/glance-apiuWSGI 
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      760/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1199/sshd: /usr/sbi 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1247/httpd          
tcp        0      0 0.0.0.0:8775            0.0.0.0:*               LISTEN      811/nova-api-metauW 
tcp        0      0 0.0.0.0:25672           0.0.0.0:*               LISTEN      1190/beam.smp       
tcp        0      0 0.0.0.0:9696            0.0.0.0:*               LISTEN      820/ml2_conf.ini    
tcp        0      0 127.0.0.54:53           0.0.0.0:*               LISTEN      760/systemd-resolve 
tcp        0      0 127.0.0.1:6640          0.0.0.0:*               LISTEN      1013/ovsdb-server   
tcp        0      0 0.0.0.0:6642            0.0.0.0:*               LISTEN      937/ovsdb-server    
tcp        0      0 0.0.0.0:6641            0.0.0.0:*               LISTEN      909/ovsdb-server    
tcp        0      0 127.0.0.1:39711         0.0.0.0:*               LISTEN      811/nova-api-metauW 
tcp        0      0 20.20.20.11:2379        0.0.0.0:*               LISTEN      1169/etcd           
tcp        0      0 127.0.0.1:4330          0.0.0.0:*               LISTEN      2234/pmlogger       
tcp        0      0 0.0.0.0:5355            0.0.0.0:*               LISTEN      760/systemd-resolve 
tcp        0      0 0.0.0.0:6080            0.0.0.0:*               LISTEN      815/python3.11      
tcp6       0      0 :::2380                 :::*                    LISTEN      1169/etcd           
tcp6       0      0 ::1:4330                :::*                    LISTEN      2234/pmlogger       
tcp6       0      0 :::22                   :::*                    LISTEN      1199/sshd: /usr/sbi 
tcp6       0      0 :::443                  :::*                    LISTEN      1247/httpd          
tcp6       0      0 :::9090                 :::*                    LISTEN      1/systemd           
tcp6       0      0 :::4369                 :::*                    LISTEN      1/systemd           
tcp6       0      0 ::1:44321               :::*                    LISTEN      1570/pmcd           
tcp6       0      0 :::5355                 :::*                    LISTEN      760/systemd-resolve 
tcp6       0      0 :::5672                 :::*                    LISTEN      1190/beam.smp  

これはWebサーバーの私のIPテーブルです。

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination      type here

これはnmapWebサーバー自体です。

Starting Nmap 7.93 ( https://nmap.org ) at 2023-08-09 19:18 CDT
Nmap scan report for opendevhost.testing.prox (20.20.20.11)
Host is up (0.0000080s latency).
Not shown: 995 closed tcp ports (reset)
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
443/tcp  open  https
3306/tcp open  mysql
9090/tcp open  zeus-admin

Nmap done: 1 IP address (1 host up) scanned in 0.09 seconds

これはnmap、LAN上の他のLinuxボックスにあるWebサーバーです。

Starting Nmap 7.93 ( https://nmap.org ) at 2023-08-09 19:17 CDT
Nmap scan report for opendevhost.testing.prox (20.20.20.11)
Host is up (0.00041s latency).
Not shown: 988 filtered tcp ports (no-response), 10 filtered tcp ports (admin-prohibited)
PORT     STATE SERVICE
22/tcp   open  ssh
9090/tcp open  zeus-admin
MAC Address: 46:0E:A2:7D:12:1A (Unknown)

Nmap done: 1 IP address (1 host up) scanned in 5.20 seconds


I added http and https services through the firewall by logging into the server via the web console.

ベストアンサー1

常に一致する汎用REJECTルールの後にアクティブ化ルールを追加しました。追加のルールは通過しないので役に立たない。端末ルールは常に即時です。 REJECTが評価されると、このフック(INPUT)でルールは評価されなくなります。

この問題を解決する1つの方法は、REJECTルールを削除(どこにいても)して再度(最後に)配置することです。その間、REJECTルールの前にINVALIDステータスをドロップするルールを追加して、遅延パケットに関連するまれなケース(例:拒否する新しいバージョンでは警告)。

iptables -D INPUT -j REJECT
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
iptables -A INPUT -j REJECT

スクリプトを使用するかペアを使用するかは、既知の良いソースからルールセットを再構築するのが最善です。iptables-saveファイルに保存/iptables-restoreこのファイルまたはファイアウォールフレームワーク(例:ファイアウォールまたは極細糸束

おすすめ記事