我在研究百人座。我已经为XMPP服务器安装了openfire。我正在Openstack (带有浮动IP的公共服务器)上使用虚拟机。由于限制和ACL,端口9090或9091不能用于入口通信。配置的唯一端口是80和443。
我试图通过打开端口80来配置iptable,但是,这似乎没有什么区别。即使没有将端口80添加到iptable中,当我使用:https://www.yougetsignal.com/tools/open-ports/检查端口80时,它仍然是https://www.yougetsignal.com/tools/open-ports/。
因此,我正在尝试设置openfire admin从配置文件中监听端口80,因为,当然,我无法连接到admin GUI来从那里更改它。这台机器有一个Apache服务器,默认情况下它会监听端口80。我用:
sudo service httpd stop当我查看netstat -tulpn | grep 80时,我可以看到端口80上没有任何东西在监听,所以我可以假设没有其他东西在使用端口80。
我更改了openfire.xml in opt/openfire/conf/
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file stores bootstrap properties needed by Openfire.
Property names must be in the format: "prop.name.is.blah=value"
That will be stored as:
<prop>
<name>
<is>
<blah>value</blah>
</is>
</name>
</prop>
Most properties are stored in the Openfire database. A
property viewer and editor is included in the admin console.
-->
<!-- root element, all properties must be under this element -->
<jive>
<adminConsole>
<!-- Disable either port by setting the value to -1 -->
<port>80</port>
<securePort>-1</securePort>
</adminConsole>
<locale>en</locale>
<!-- Network settings. By default, Openfire will bind to all network interfaces.
Alternatively, you can specify a specific network interfaces that the server
will listen on. For example, 127.0.0.1. This setting is generally only useful
on multi-homed servers. -->
<!--
<network>
<interface></interface>
</network>
-->
</jive>当我再次做netstat -tulpn | grep 80时,我看不到在80上打开任何东西。我读过一些关于如果openfire不是作为root启动的,那么它就不能监听端口范围1024以下的任何内容。因此,我确保我开始使用:sudo service openfire start来启动openfire服务。
是否有我所缺少的开火枪的配置?
发布于 2018-05-24 09:21:45
您可以预先记录您的流量,以便从80端口进入端口9090。我想9090港口是开着的。
您可以像这样打开端口9090:
sudo iptables -A INPUT -p tcp -m tcp --dport 9090 -j ACCEPT保存您的iptable规则:
sudo iptables-save然后,您可以添加如下所示的PREROUTING规则:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 9090检查您的规则,以确定是否正确分配。类型:
iptables -t nat -L -n输出应该如下所示:
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 9090然后重新启动Openfire服务:
sudo service openfire stop
sudo service openfire start您甚至可以更改Apache侦听的端口,以确保没有使用端口80。
如果您转到/etc/httpd/conf/,然后转到sudo vi httpd.conf,您可以更改它。编辑文件后,您可以将端口从80更改为另一个未使用的端口,例如8080。请记住,如果仍然希望Apache工作,则另一个端口必须未使用。
要进一步阅读PREROUTING,请阅读以下文章:https://askubuntu.com/questions/579231/whats-the-difference-between-prerouting-and-forward-in-iptables
https://stackoverflow.com/questions/50486220
复制相似问题