我正在运行一个小型 apache2/iRedMail 服务器,但我遇到了 iptables 的问题。经过一段时间正常工作(数小时)后,我的服务器无法访问编辑:从我家中某些端口的互联网连接(端口 80、443 测试,编辑:apache?)直到我重新启动 iptables 服务(sudo service iptables restart)。这样做会使一切恢复正常!我不知道是什么导致了这个问题,特别是因为它在重新启动 iptables 服务几个小时后发生。
我可以查看哪些日志文件?该kern.log文件没有显示任何明显的内容(我读到它包含有关 iptables 的信息)。
所有 iptables 规则都在 iRedMail 中使用的标准文件中配置,该文件是/etc/default/iptables.
提前致谢!
编辑1:输出 iptables -L -n -v
user@server:~$ sudo iptables -L -n -v
Chain INPUT (policy DROP 102 packets, 19966 bytes)
pkts bytes target prot opt in out source destination
9500 2164K fail2ban-dovecot tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 80,443,25,587,110,9
95,143,993,4190
18543 6112K ACCEPT all -- * …Run Code Online (Sandbox Code Playgroud) 我有两个规则。首先阻止范围内的所有端口:
-A INPUT -m state --state NEW -m tcp -p tcp --match multiport --dports 200:65535 -j DROP
和第二个在这个范围内打开一个:
-A INPUT -i eth0 -p tcp --dport 5901 -m state --state NEW,ESTABLISHED -j ACCEPT
但它不起作用。有谁知道为什么?
好的,这是 CentOs 7 的全新安装(最小)。
这是iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD_IN_ZONES (0 references)
target prot opt source destination
Chain FORWARD_IN_ZONES_SOURCE (0 references)
target prot opt source destination
Chain FORWARD_OUT_ZONES (0 references)
target prot opt source destination
Chain FORWARD_OUT_ZONES_SOURCE (0 references)
target prot opt source destination
Chain FORWARD_direct (0 references)
target prot opt source destination
Chain FWDI_public …Run Code Online (Sandbox Code Playgroud) 在 iptables 中,我正在记录某些公共 IP 地址……比如从不同工作站访问的网站,具体取决于目标端口号……所有这些都与问题无关,但我只是在这里说明,所以我的目标变得清晰。
现在我要分析数据...我只有IP地址...获得域名的最佳方法是什么。好的,我知道您可以使用 nslookup 和 dig 但显示的域名可能是 DNS 数据中的 A 记录,这通常不是人们正在寻找的域名...
我对细节有点模糊……但我需要的是,例如,有人访问 cnbc.com,我查看记录的 IP 地址,并获得从亚马逊网络服务到 facebook.com 的各种域。记录 IP 的最近域是 nbcuni.com...
是否有一些“服务”、API、软件、第三方解决方案可用于获取给定 IP 的“最接近”可识别域名?
编辑:还有另一个问题......监控系统似乎可以处理它们。代理系统(如下推荐)无法区分指定的 URL 和所访问页面中内容的 URL。或者他们可以吗?任何访问过的 URL,在浏览器中明确指定或间接显示在页面中的任何 URL 都将显示为访问过的 URL。有没有办法区分?通过代理日志还是其他方式?
我的 iptables 规则:
# delete all current rules and user chains
iptables -F
iptables -X
# global policy (target by default)
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
# localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# dns -> udp
iptables -A INPUT -i eth0 -p udp --sport 53 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p udp --dport 53 -m state --state …Run Code Online (Sandbox Code Playgroud) 我在 systemd 中启用了 iptables:
systemctl enable iptables
Run Code Online (Sandbox Code Playgroud)
但是当我尝试重新启动后service iptables status,它显示:
# service iptables status
Redirecting to /bin/systemctl status iptables.service
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Run Code Online (Sandbox Code Playgroud)
但是当我手动启动它时systemctl start iptables,它正常启动。
我正在运行 Fedora 22。
我正在运行一个安装了 FreePBX/Astrisk 的 linux 机器。我已经使用来自 ip2location 的列表屏蔽了中国和香港。com/blockvisitorsbycountry.aspx 网站。我的 fail2ban 每隔 3-9 分钟就会出现一次,现在我的尝试非常有限,通常每天大约 8-10 次。我很想阻止更多,但我担心如果我再向表中添加 10k,我可能会限制系统回到石器时代。你怎么认为?
我的 Nginx 有一个非常奇怪的问题,我无法从浏览器访问它。
我已经在我的计算机上安装了 CentOS 7 虚拟机,并安装并配置了 Nginx、PHP-FPM 和 MariaDB。
Nginx的配置如下:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /path/to/www
index index.php;
try_files $uri $uri/ /index.php?$args;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} …Run Code Online (Sandbox Code Playgroud) 我正在尝试将 iptables 规则文件保存到 /etc/sysconfig/iptables。我想在不登录 root 的情况下执行此操作。我尝试使用
须藤 iptables-save > /etc/sysconfig/iptables
但它抛出权限被拒绝错误。
如何在不登录 root 的情况下保存文件?我在我的应用程序中使用它,所以我不想通过应用程序登录到 root。
谢谢
我运行了 iptables 并应用了最新的规则(即我重新启动了服务,它说一切都“正常”)。
我只使用 system-config-firewall 来编辑/定义任何规则,所以我不应该有手动创建的错误。如果我可以避免它,我不想手动编辑它。
我以为我已经配置了它,以便我的 Apache 端口80和443将打开,但不是 Tomcat 正在侦听的端口(即8080,8443)。然而,事实并非如此......我可以在任何机器上毫无问题地浏览它们。
最终我确实希望可以访问 Tomcat 端口,但我不明白为什么它们已经存在。我希望我需要明确打开它们。
此外,在我添加规则以显式打开它们之前,我的所有邮件端口也都可以访问(110, 143, 587, 993, 995...)同样,我确实希望打开它们,但我不明白为什么它们总是如此?
这是我的 iptables 输出。为什么一切似乎都是开放的?可能是因为没有OUTPUT规则?另外,为什么会有看似重复的规则?system-config-firewall 不控制此类重复项吗?我怎样才能清理它?我想只能通过手动编辑...
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
num pkts bytes target prot opt in out source destination
1 2834 692K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 5 511 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
3 14 990 …Run Code Online (Sandbox Code Playgroud)