在 Jelastic 环境中保护 Tomcat 个节点
Protect Tomcat node in Jelastic environment
我在 Jelastic 环境中有一个 Tomcat 7.0.68 节点(public IPv4 已启用)。此环境还包含一个 CentOS VPS 节点(public IPv4 也已启用)。
我想保护这两个节点免受暴力攻击,因为例如Tomcat 的日志包含很多警告,例如:
WARNING: An attempt was made to authenticate the locked user "admin1"
对于 CentOS,可以使用 fail2ban 来完成(我已经这样做了)。但是我不能为 Tomcat 节点做同样的事情——jelastic 没有为 root 用户提供密码,也没有办法 reset/change 这个密码。
之前我为Tomcat的用户配置了非常安全的密码并配置了
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
但它仅保护 Tomcat 内的应用程序。
所以我的问题是:
- 是否足以配置 LockOutRealm 以保护 Tomcat 免受暴力破解?
- 无论如何,LockOutRealm 不保护 SSH 端口。如何在 Tomcat 的节点上保护 SSH?
- Jelastic 是否提供任何反暴力破解保护"out of the box"?
Anyway LockOutRealm doesn't protect SSH port. How can I protect SSH on Tomcat's node?
根据您的托管服务提供商,默认情况下通常应设置 SSH 防火墙。如果没有,您可以按照 https://docs.jelastic.com/setting-custom-firewall
中的说明自行设置防火墙
(基本上,在 /etc/sysconfig/iptables-custom
中设置自定义防火墙规则,然后 运行 sudo /usr/bin/jem firewall fwstart
)。
最好的选择是在您的 Tomcat 节点上安装 fail2ban 并根据我们的 official documentation 配置防火墙规则。
但要执行此操作,您应该拥有根权限。联系您的托管服务提供商的支持,以便他们可以为您提供对容器的 SSH root 访问权限。
我在 Jelastic 环境中有一个 Tomcat 7.0.68 节点(public IPv4 已启用)。此环境还包含一个 CentOS VPS 节点(public IPv4 也已启用)。
我想保护这两个节点免受暴力攻击,因为例如Tomcat 的日志包含很多警告,例如:
WARNING: An attempt was made to authenticate the locked user "admin1"
对于 CentOS,可以使用 fail2ban 来完成(我已经这样做了)。但是我不能为 Tomcat 节点做同样的事情——jelastic 没有为 root 用户提供密码,也没有办法 reset/change 这个密码。
之前我为Tomcat的用户配置了非常安全的密码并配置了
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>
但它仅保护 Tomcat 内的应用程序。
所以我的问题是:
- 是否足以配置 LockOutRealm 以保护 Tomcat 免受暴力破解?
- 无论如何,LockOutRealm 不保护 SSH 端口。如何在 Tomcat 的节点上保护 SSH?
- Jelastic 是否提供任何反暴力破解保护"out of the box"?
Anyway LockOutRealm doesn't protect SSH port. How can I protect SSH on Tomcat's node?
根据您的托管服务提供商,默认情况下通常应设置 SSH 防火墙。如果没有,您可以按照 https://docs.jelastic.com/setting-custom-firewall
中的说明自行设置防火墙(基本上,在 /etc/sysconfig/iptables-custom
中设置自定义防火墙规则,然后 运行 sudo /usr/bin/jem firewall fwstart
)。
最好的选择是在您的 Tomcat 节点上安装 fail2ban 并根据我们的 official documentation 配置防火墙规则。 但要执行此操作,您应该拥有根权限。联系您的托管服务提供商的支持,以便他们可以为您提供对容器的 SSH root 访问权限。